| 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" |
| 11 #include "base/threading/non_thread_safe.h" |
| 10 #include "content/common/content_export.h" | 12 #include "content/common/content_export.h" |
| 11 | 13 |
| 12 namespace content { | 14 namespace content { |
| 13 | 15 |
| 14 // This module provides some helper functions for logging actions tracked by | 16 // This module provides some helper functions for logging actions tracked by |
| 15 // the user metrics system. | 17 // the user metrics system. |
| 16 | 18 |
| 17 | 19 |
| 18 // UserMetricsAction exist purely to standardize on the paramters passed to | 20 // UserMetricsAction exist purely to standardize on the paramters passed to |
| 19 // UserMetrics. That way, our toolset can scan the sourcecode reliable for | 21 // UserMetrics. That way, our toolset can scan the sourcecode reliable for |
| (...skipping 23 matching lines...) Expand all Loading... |
| 43 // possible actions), see RecordComputedAction. | 45 // possible actions), see RecordComputedAction. |
| 44 CONTENT_EXPORT void RecordAction(const UserMetricsAction& action); | 46 CONTENT_EXPORT void RecordAction(const UserMetricsAction& action); |
| 45 | 47 |
| 46 // This function has identical input and behavior to RecordAction, but is | 48 // This function has identical input and behavior to RecordAction, but is |
| 47 // not automatically found by the action-processing scripts. It can be used | 49 // 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 | 50 // 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 | 51 // you need to also update the rules for extracting known actions in |
| 50 // chrome/tools/extract_actions.py. | 52 // chrome/tools/extract_actions.py. |
| 51 CONTENT_EXPORT void RecordComputedAction(const std::string& action); | 53 CONTENT_EXPORT void RecordComputedAction(const std::string& action); |
| 52 | 54 |
| 55 // Called with the action string. |
| 56 typedef base::Callback<void(const std::string&)> ActionCallback; |
| 57 |
| 58 // Add/remove action callbacks (see above). |
| 59 CONTENT_EXPORT void AddActionCallback(const ActionCallback& callback); |
| 60 CONTENT_EXPORT void RemoveActionCallback(const ActionCallback& callback); |
| 61 |
| 53 } // namespace content | 62 } // namespace content |
| 54 | 63 |
| 55 #endif // CONTENT_PUBLIC_BROWSER_USER_METRICS_H_ | 64 #endif // CONTENT_PUBLIC_BROWSER_USER_METRICS_H_ |
| OLD | NEW |