1 // Copyright (c) 2011 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.
5 #ifndef CHROME_BROWSER_UI_WEBUI_METRICS_HANDLER_H_
6 #define CHROME_BROWSER_UI_WEBUI_METRICS_HANDLER_H_
8 #include "base/compiler_specific.h"
9 #include "content/public/browser/web_ui_message_handler.h"
11 ///////////////////////////////////////////////////////////////////////////////
14 // Let the page contents record UMA actions. Only use when you can't do it from
15 // C++. For example, we currently use it to let the NTP log the position of the
16 // Most Visited or Bookmark the user clicked on, as we don't get that
17 // information through RequestOpenURL. You will need to update the metrics
18 // dashboard with the action names you use, as our processor won't catch that
19 // information (treat it as RecordComputedMetrics)
25 class MetricsHandler
: public content::WebUIMessageHandler
{
28 ~MetricsHandler() override
;
30 // WebUIMessageHandler implementation.
31 void RegisterMessages() override
;
33 // Callback for the "metricsHandler:recordAction" message. This records a
35 void HandleRecordAction(const base::ListValue
* args
);
37 // TODO(dbeam): http://crbug.com/104338
39 // Callback for the "metricsHandler:recordInHistogram" message. This records
40 // into a histogram. |args| contains the histogram name, the value to record,
41 // and the maximum allowed value, which can be at most 4000. The histogram
42 // will use at most 100 buckets, one for each 1, 10, or 100 different values,
43 // depending on the maximum value.
44 void HandleRecordInHistogram(const base::ListValue
* args
);
46 // Callback for the "metricsHandler:logEventTime" message.
47 void HandleLogEventTime(const base::ListValue
* args
);
49 // Used to log when a user mouses over a tile or title on the NTP.
50 void HandleLogMouseover(const base::ListValue
* args
);
53 DISALLOW_COPY_AND_ASSIGN(MetricsHandler
);
56 #endif // CHROME_BROWSER_UI_WEBUI_METRICS_HANDLER_H_