Chromium Code Reviews| 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/threading/non_thread_safe.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 class UserMetricsObserver : public base::NonThreadSafe { | |
| 55 public: | |
| 56 // Called when the user does a gesture resulting in a noteworthy action | |
| 57 // taking place. | |
| 58 virtual void UserAction(const std::string& action); | |
|
jam
2013/01/29 23:53:25
since this is just one method on the interface, a
| |
| 59 | |
| 60 protected: | |
| 61 // Constructor and destructor automatically handle registration | |
| 62 // and deregistration of the observer. | |
| 63 UserMetricsObserver(); | |
| 64 virtual ~UserMetricsObserver(); | |
| 65 | |
| 66 DISALLOW_COPY_AND_ASSIGN(UserMetricsObserver); | |
| 67 }; | |
| 68 | |
| 53 } // namespace content | 69 } // namespace content |
| 54 | 70 |
| 55 #endif // CONTENT_PUBLIC_BROWSER_USER_METRICS_H_ | 71 #endif // CONTENT_PUBLIC_BROWSER_USER_METRICS_H_ |
| OLD | NEW |