OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CONTENT_BROWSER_USER_METRICS_H_ | 5 #ifndef CONTENT_BROWSER_USER_METRICS_H_ |
6 #define CONTENT_BROWSER_USER_METRICS_H_ | 6 #define CONTENT_BROWSER_USER_METRICS_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
| 11 #include "content/common/content_export.h" |
| 12 |
11 // This module provides some helper functions for logging actions tracked by | 13 // This module provides some helper functions for logging actions tracked by |
12 // the user metrics system. | 14 // the user metrics system. |
13 | 15 |
14 | 16 |
15 // UserMetricsAction exist purely to standardize on the paramters passed to | 17 // UserMetricsAction exist purely to standardize on the paramters passed to |
16 // UserMetrics. That way, our toolset can scan the sourcecode reliable for | 18 // UserMetrics. That way, our toolset can scan the sourcecode reliable for |
17 // constructors and extract the associated string constants | 19 // constructors and extract the associated string constants |
18 struct UserMetricsAction { | 20 struct UserMetricsAction { |
19 const char* str_; | 21 const char* str_; |
20 explicit UserMetricsAction(const char* str) : str_(str) {} | 22 explicit UserMetricsAction(const char* str) : str_(str) {} |
21 }; | 23 }; |
22 | 24 |
23 | 25 |
24 class UserMetrics { | 26 class CONTENT_EXPORT UserMetrics { |
25 public: | 27 public: |
26 // Record that the user performed an action. | 28 // Record that the user performed an action. |
27 // "Action" here means a user-generated event: | 29 // "Action" here means a user-generated event: |
28 // good: "Reload", "CloseTab", and "IMEInvoked" | 30 // good: "Reload", "CloseTab", and "IMEInvoked" |
29 // not good: "SSLDialogShown", "PageLoaded", "DiskFull" | 31 // not good: "SSLDialogShown", "PageLoaded", "DiskFull" |
30 // We use this to gather anonymized information about how users are | 32 // We use this to gather anonymized information about how users are |
31 // interacting with the browser. | 33 // interacting with the browser. |
32 // WARNING: Call this function exactly like this: | 34 // WARNING: Call this function exactly like this: |
33 // UserMetrics::RecordAction(UserMetricsAction("foo bar")); | 35 // UserMetrics::RecordAction(UserMetricsAction("foo bar")); |
34 // (all on one line and with the metric string literal [no variables]) | 36 // (all on one line and with the metric string literal [no variables]) |
(...skipping 13 matching lines...) Expand all Loading... |
48 // you need to also update the rules for extracting known actions in | 50 // you need to also update the rules for extracting known actions in |
49 // chrome/tools/extract_actions.py. | 51 // chrome/tools/extract_actions.py. |
50 static void RecordComputedAction(const std::string& action); | 52 static void RecordComputedAction(const std::string& action); |
51 | 53 |
52 private: | 54 private: |
53 static void Record(const char *action); | 55 static void Record(const char *action); |
54 static void CallRecordOnUI(const std::string& action); | 56 static void CallRecordOnUI(const std::string& action); |
55 }; | 57 }; |
56 | 58 |
57 #endif // CONTENT_BROWSER_USER_METRICS_H_ | 59 #endif // CONTENT_BROWSER_USER_METRICS_H_ |
OLD | NEW |