OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_PUBLIC_BROWSER_USER_METRICS_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_USER_METRICS_H_ |
6 #define CONTENT_PUBLIC_BROWSER_USER_METRICS_H_ | 6 #define CONTENT_PUBLIC_BROWSER_USER_METRICS_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
| 10 #include "base/callback.h" |
10 #include "content/common/content_export.h" | 11 #include "content/common/content_export.h" |
11 | 12 |
12 namespace content { | 13 namespace content { |
13 | 14 |
14 // This module provides some helper functions for logging actions tracked by | 15 // This module provides some helper functions for logging actions tracked by |
15 // the user metrics system. | 16 // the user metrics system. |
16 | 17 |
17 | 18 |
18 // UserMetricsAction exist purely to standardize on the paramters passed to | 19 // UserMetricsAction exist purely to standardize on the paramters passed to |
19 // UserMetrics. That way, our toolset can scan the sourcecode reliable for | 20 // UserMetrics. That way, our toolset can scan the sourcecode reliable for |
(...skipping 23 matching lines...) Expand all Loading... |
43 // possible actions), see RecordComputedAction. | 44 // possible actions), see RecordComputedAction. |
44 CONTENT_EXPORT void RecordAction(const UserMetricsAction& action); | 45 CONTENT_EXPORT void RecordAction(const UserMetricsAction& action); |
45 | 46 |
46 // This function has identical input and behavior to RecordAction, but is | 47 // This function has identical input and behavior to RecordAction, but is |
47 // not automatically found by the action-processing scripts. It can be used | 48 // not automatically found by the action-processing scripts. It can be used |
48 // when it's a pain to enumerate all possible actions, but if you use this | 49 // when it's a pain to enumerate all possible actions, but if you use this |
49 // 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 |
50 // chrome/tools/extract_actions.py. | 51 // chrome/tools/extract_actions.py. |
51 CONTENT_EXPORT void RecordComputedAction(const std::string& action); | 52 CONTENT_EXPORT void RecordComputedAction(const std::string& action); |
52 | 53 |
| 54 // Called with the action string. |
| 55 typedef base::Callback<void(const std::string&)> ActionCallback; |
| 56 |
| 57 // Add/remove action callbacks (see above). |
| 58 CONTENT_EXPORT void AddActionCallback(const ActionCallback& callback); |
| 59 CONTENT_EXPORT void RemoveActionCallback(const ActionCallback& callback); |
| 60 |
53 } // namespace content | 61 } // namespace content |
54 | 62 |
55 #endif // CONTENT_PUBLIC_BROWSER_USER_METRICS_H_ | 63 #endif // CONTENT_PUBLIC_BROWSER_USER_METRICS_H_ |
OLD | NEW |