1
    2
    3
    4
    5
    6
    7
    8
    9
   10
   11
   12
   13
   14
   15
   16
   17
   18
   19
   20
   21
   22
   23
   24
   25
   26
   27
   28
   29
   30
   31
   32
   33
   34
   35
   36
   37
   38
   39
   40
   41

ash / webui / scanning / scanning_metrics_handler.h [blame]

// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef ASH_WEBUI_SCANNING_SCANNING_METRICS_HANDLER_H_
#define ASH_WEBUI_SCANNING_SCANNING_METRICS_HANDLER_H_

#include "base/values.h"
#include "content/public/browser/web_ui_message_handler.h"

namespace ash {

// ChromeOS Scan app metrics handler for recording metrics from the UI.
class ScanningMetricsHandler : public content::WebUIMessageHandler {
 public:
  ScanningMetricsHandler();
  ~ScanningMetricsHandler() override;

  ScanningMetricsHandler(const ScanningMetricsHandler&) = delete;
  ScanningMetricsHandler& operator=(const ScanningMetricsHandler&) = delete;

  // WebUIMessageHandler:
  void RegisterMessages() override;

 private:
  // Records the number of scan setting changes before a scan is initiated.
  void HandleRecordNumScanSettingChanges(const base::Value::List& args);

  // Records the action taken after a completed scan job.
  void HandleRecordScanCompleteAction(const base::Value::List& args);

  // Records the settings for a scan job.
  void HandleRecordScanJobSettings(const base::Value::List& args);

  // Records the number of completed scans in a Scan app session.
  void HandleRecordNumCompletedScans(const base::Value::List& args);
};

}  // namespace ash

#endif  // ASH_WEBUI_SCANNING_SCANNING_METRICS_HANDLER_H_