| OLD | NEW |
| (Empty) |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef IOS_CHROME_BROWSER_UI_WEBUI_HISTORY_METRICS_HANDLER_H_ | |
| 6 #define IOS_CHROME_BROWSER_UI_WEBUI_HISTORY_METRICS_HANDLER_H_ | |
| 7 | |
| 8 #include "base/compiler_specific.h" | |
| 9 #include "base/macros.h" | |
| 10 #include "ios/web/public/webui/web_ui_ios_message_handler.h" | |
| 11 | |
| 12 /////////////////////////////////////////////////////////////////////////////// | |
| 13 // MetricsHandler | |
| 14 | |
| 15 // Let the page contents record UMA actions. Only use when you can't do it from | |
| 16 // C++. For example, we currently use it to let the NTP log the position of the | |
| 17 // Most Visited or Bookmark the user clicked on, as we don't get that | |
| 18 // information through RequestOpenURL. You will need to update the metrics | |
| 19 // dashboard with the action names you use, as our processor won't catch that | |
| 20 // information (treat it as RecordComputedMetrics) | |
| 21 | |
| 22 namespace base { | |
| 23 class ListValue; | |
| 24 } | |
| 25 | |
| 26 class MetricsHandler : public web::WebUIIOSMessageHandler { | |
| 27 public: | |
| 28 MetricsHandler(); | |
| 29 ~MetricsHandler() override; | |
| 30 | |
| 31 // WebUIIOSMessageHandler implementation. | |
| 32 void RegisterMessages() override; | |
| 33 | |
| 34 // Callback for the "metricsHandler:recordAction" message. This records a | |
| 35 // user action. | |
| 36 void HandleRecordAction(const base::ListValue* args); | |
| 37 | |
| 38 // TODO(dbeam): http://crbug.com/104338 | |
| 39 | |
| 40 // Callback for the "metricsHandler:recordInHistogram" message. This records | |
| 41 // into a histogram. |args| contains the histogram name, the value to record, | |
| 42 // and the maximum allowed value, which can be at most 4000. The histogram | |
| 43 // will use at most 100 buckets, one for each 1, 10, or 100 different values, | |
| 44 // depending on the maximum value. | |
| 45 void HandleRecordInHistogram(const base::ListValue* args); | |
| 46 | |
| 47 private: | |
| 48 DISALLOW_COPY_AND_ASSIGN(MetricsHandler); | |
| 49 }; | |
| 50 | |
| 51 #endif // IOS_CHROME_BROWSER_UI_WEBUI_HISTORY_METRICS_HANDLER_H_ | |
| OLD | NEW |