OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 BASE_METRICS_USER_METRICS_H_ | 5 #ifndef BASE_METRICS_USER_METRICS_H_ |
6 #define BASE_METRICS_USER_METRICS_H_ | 6 #define BASE_METRICS_USER_METRICS_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/base_export.h" | 10 #include "base/base_export.h" |
11 #include "base/callback.h" | 11 #include "base/callback.h" |
12 #include "base/metrics/user_metrics_action.h" | 12 #include "base/metrics/user_metrics_action.h" |
13 #include "base/single_thread_task_runner.h" | 13 #include "base/single_thread_task_runner.h" |
14 | 14 |
15 namespace base { | 15 namespace base { |
16 | 16 |
17 // This module provides some helper functions for logging actions tracked by | 17 // This module provides some helper functions for logging actions tracked by |
18 // the user metrics system. | 18 // the user metrics system. |
19 | 19 |
| 20 // For best practices on deciding when to emit a user action, see |
| 21 // https://chromium.googlesource.com/chromium/src.git/+/HEAD/tools/metrics/actio
ns/README.md |
| 22 |
20 // Record that the user performed an action. | 23 // Record that the user performed an action. |
21 // This function must be called after the task runner has been set with | 24 // This function must be called after the task runner has been set with |
22 // SetRecordActionTaskRunner(). | 25 // SetRecordActionTaskRunner(). |
23 // | 26 // |
24 // "Action" here means a user-generated event: | 27 // "Action" here means a user-generated event: |
25 // good: "Reload", "CloseTab", and "IMEInvoked" | 28 // good: "Reload", "CloseTab", and "IMEInvoked" |
26 // not good: "SSLDialogShown", "PageLoaded", "DiskFull" | 29 // not good: "SSLDialogShown", "PageLoaded", "DiskFull" |
27 // We use this to gather anonymized information about how users are | 30 // We use this to gather anonymized information about how users are |
28 // interacting with the browser. | 31 // interacting with the browser. |
29 // WARNING: In calls to this function, UserMetricsAction should be followed by a | 32 // WARNING: In calls to this function, UserMetricsAction should be followed by a |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 BASE_EXPORT void AddActionCallback(const ActionCallback& callback); | 64 BASE_EXPORT void AddActionCallback(const ActionCallback& callback); |
62 BASE_EXPORT void RemoveActionCallback(const ActionCallback& callback); | 65 BASE_EXPORT void RemoveActionCallback(const ActionCallback& callback); |
63 | 66 |
64 // Set the task runner on which to record actions. | 67 // Set the task runner on which to record actions. |
65 BASE_EXPORT void SetRecordActionTaskRunner( | 68 BASE_EXPORT void SetRecordActionTaskRunner( |
66 scoped_refptr<SingleThreadTaskRunner> task_runner); | 69 scoped_refptr<SingleThreadTaskRunner> task_runner); |
67 | 70 |
68 } // namespace base | 71 } // namespace base |
69 | 72 |
70 #endif // BASE_METRICS_USER_METRICS_H_ | 73 #endif // BASE_METRICS_USER_METRICS_H_ |
OLD | NEW |