diff options
author | evan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-23 18:14:28 +0000 |
---|---|---|
committer | evan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-23 18:14:28 +0000 |
commit | 89622004872be7f7ddaa24fa1694f76c7b9539b6 (patch) | |
tree | 81b8a42c7649c8cbca99d04305470ccbc1fe61fa /chrome/browser/metrics | |
parent | b7544eef7b81458a88597419eed6617c41e6d3dc (diff) | |
download | chromium_src-89622004872be7f7ddaa24fa1694f76c7b9539b6.zip chromium_src-89622004872be7f7ddaa24fa1694f76c7b9539b6.tar.gz chromium_src-89622004872be7f7ddaa24fa1694f76c7b9539b6.tar.bz2 |
UMA cleanup. Replacing calls to RecordAction(char*) to use a new structure.
That way it is easier to keep track of those constants in reporting tools.
TEST=Covered with standard ui tests
Patch by Frank Mantek <fmantek@google.com>.
Review URL: http://codereview.chromium.org/811005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@42362 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/metrics')
-rw-r--r-- | chrome/browser/metrics/user_metrics.cc | 19 | ||||
-rw-r--r-- | chrome/browser/metrics/user_metrics.h | 16 |
2 files changed, 28 insertions, 7 deletions
diff --git a/chrome/browser/metrics/user_metrics.cc b/chrome/browser/metrics/user_metrics.cc index 79b4dee..3bdb544 100644 --- a/chrome/browser/metrics/user_metrics.cc +++ b/chrome/browser/metrics/user_metrics.cc @@ -6,14 +6,21 @@ #include "chrome/browser/profile.h" #include "chrome/common/notification_service.h" -void UserMetrics::RecordAction(const char* action, Profile* profile) { - NotificationService::current()->Notify( - NotificationType::USER_ACTION, - Source<Profile>(profile), - Details<const char*>(&action)); +void UserMetrics::RecordAction(const UserMetricsAction& action, + Profile* profile) { + Record(action.str_, profile); } void UserMetrics::RecordComputedAction(const std::string& action, Profile* profile) { - RecordAction(action.c_str(), profile); + Record(action.c_str(), profile); } + +void UserMetrics::Record(const char *action, Profile *profile) { + NotificationService::current()->Notify(NotificationType::USER_ACTION, + Source<Profile>(profile), + Details<const char*>(&action)); +} + + + diff --git a/chrome/browser/metrics/user_metrics.h b/chrome/browser/metrics/user_metrics.h index 4329fcc..6b7c0d3 100644 --- a/chrome/browser/metrics/user_metrics.h +++ b/chrome/browser/metrics/user_metrics.h @@ -12,6 +12,17 @@ class Profile; // This module provides some helper functions for logging actions tracked by // the user metrics system. + +// UserMetricsAction exist purely to standardize on the paramters passed to +// UserMetrics. That way, our toolset can scan the sourcecode reliable for +// constructors and extract the associated string constants +struct UserMetricsAction { + const char* str_; + explicit UserMetricsAction(const char* str) : str_(str) {} +}; + + + class UserMetrics { public: // Record that the user performed an action. @@ -27,7 +38,7 @@ class UserMetrics { // // For more complicated situations (like when there are many different // possible actions), see RecordComputedAction. - static void RecordAction(const char* action, Profile* profile); + static void RecordAction(const UserMetricsAction& action, Profile* profile); // This function has identical input and behavior to RecordAction, but is // not automatically found by the action-processing scripts. It can be used @@ -35,6 +46,9 @@ class UserMetrics { // you need to also update the rules for extracting known actions. static void RecordComputedAction(const std::string& action, Profile* profile); + + private: + static void Record(const char *action, Profile *profile); }; #endif // CHROME_BROWSER_METRICS_USER_METRICS_H_ |