| 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 | 13 |
| 14 namespace base { | 14 namespace base { |
| 15 | 15 |
| 16 // This module provides some helper functions for logging actions tracked by | 16 // This module provides some helper functions for logging actions tracked by |
| 17 // the user metrics system. | 17 // the user metrics system. |
| 18 | 18 |
| 19 // Record that the user performed an action. | 19 // Record that the user performed an action. |
| 20 // This method *must* be called from the main thread. |
| 21 // |
| 20 // "Action" here means a user-generated event: | 22 // "Action" here means a user-generated event: |
| 21 // good: "Reload", "CloseTab", and "IMEInvoked" | 23 // good: "Reload", "CloseTab", and "IMEInvoked" |
| 22 // not good: "SSLDialogShown", "PageLoaded", "DiskFull" | 24 // not good: "SSLDialogShown", "PageLoaded", "DiskFull" |
| 23 // We use this to gather anonymized information about how users are | 25 // We use this to gather anonymized information about how users are |
| 24 // interacting with the browser. | 26 // interacting with the browser. |
| 25 // WARNING: In calls to this function, UserMetricsAction and a | 27 // WARNING: In calls to this function, UserMetricsAction and a |
| 26 // string literal parameter must be on the same line, e.g. | 28 // string literal parameter must be on the same line, e.g. |
| 27 // RecordAction(UserMetricsAction("my extremely long action name")); | 29 // RecordAction(UserMetricsAction("my extremely long action name")); |
| 28 // This ensures that our processing scripts can associate this action's hash | 30 // This ensures that our processing scripts can associate this action's hash |
| 29 // with its metric name. Therefore, it will be possible to retrieve the metric | 31 // with its metric name. Therefore, it will be possible to retrieve the metric |
| (...skipping 19 matching lines...) Expand all Loading... |
| 49 // Called with the action string. | 51 // Called with the action string. |
| 50 typedef base::Callback<void(const std::string&)> ActionCallback; | 52 typedef base::Callback<void(const std::string&)> ActionCallback; |
| 51 | 53 |
| 52 // Add/remove action callbacks (see above). | 54 // Add/remove action callbacks (see above). |
| 53 BASE_EXPORT void AddActionCallback(const ActionCallback& callback); | 55 BASE_EXPORT void AddActionCallback(const ActionCallback& callback); |
| 54 BASE_EXPORT void RemoveActionCallback(const ActionCallback& callback); | 56 BASE_EXPORT void RemoveActionCallback(const ActionCallback& callback); |
| 55 | 57 |
| 56 } // namespace base | 58 } // namespace base |
| 57 | 59 |
| 58 #endif // BASE_METRICS_USER_METRICS_H_ | 60 #endif // BASE_METRICS_USER_METRICS_H_ |
| OLD | NEW |