diff options
author | mirandac@chromium.org <mirandac@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-16 20:30:14 +0000 |
---|---|---|
committer | mirandac@chromium.org <mirandac@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-16 20:30:14 +0000 |
commit | 96b3c5c54e8c96a11daf0c8457d7034792665035 (patch) | |
tree | d4783364710efe3aa0635bb741683c34c3dceed3 /chrome/browser/search_engines | |
parent | 9d4a694dbdcbcac8f738e3a49e27e0abdb6c0c6c (diff) | |
download | chromium_src-96b3c5c54e8c96a11daf0c8457d7034792665035.zip chromium_src-96b3c5c54e8c96a11daf0c8457d7034792665035.tar.gz chromium_src-96b3c5c54e8c96a11daf0c8457d7034792665035.tar.bz2 |
Add UMA calls to record search engine choice during first run.
BUG= 37565
TEST= UMA calls should be recorded correctly.
Review URL: http://codereview.chromium.org/1528037
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@44816 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/search_engines')
-rw-r--r-- | chrome/browser/search_engines/template_url_prepopulate_data.cc | 25 | ||||
-rw-r--r-- | chrome/browser/search_engines/template_url_prepopulate_data.h | 23 |
2 files changed, 48 insertions, 0 deletions
diff --git a/chrome/browser/search_engines/template_url_prepopulate_data.cc b/chrome/browser/search_engines/template_url_prepopulate_data.cc index 0eab11b0..7688150 100644 --- a/chrome/browser/search_engines/template_url_prepopulate_data.cc +++ b/chrome/browser/search_engines/template_url_prepopulate_data.cc @@ -2829,4 +2829,29 @@ void GetPrepopulatedEngines(PrefService* prefs, } } +UMASearchEngineType GetSearchEngineType(const TemplateURL* search_engine) { + switch (search_engine->prepopulate_id()) { + case 1: + return SEARCH_ENGINE_GOOGLE; + case 2: + return SEARCH_ENGINE_YAHOO; + case 3: + return SEARCH_ENGINE_BING; + case 4: + return SEARCH_ENGINE_ASK; + case 15: + return SEARCH_ENGINE_YANDEX; + case 25: + return SEARCH_ENGINE_SEZNAM; + case 26: + return SEARCH_ENGINE_CENTRUM; + case 62: + return SEARCH_ENGINE_VIRGILIO; + case 83: + return SEARCH_ENGINE_MAILRU; + default: + return SEARCH_ENGINE_OTHER; + } +} + } // namespace TemplateURLPrepopulateData diff --git a/chrome/browser/search_engines/template_url_prepopulate_data.h b/chrome/browser/search_engines/template_url_prepopulate_data.h index 4826200..d53934b 100644 --- a/chrome/browser/search_engines/template_url_prepopulate_data.h +++ b/chrome/browser/search_engines/template_url_prepopulate_data.h @@ -12,6 +12,21 @@ class TemplateURL; namespace TemplateURLPrepopulateData { +// Enum to record the user's default search engine choice in UMA: +enum UMASearchEngineType { + SEARCH_ENGINE_OTHER = 0, // At the top in case of future list changes. + SEARCH_ENGINE_GOOGLE, + SEARCH_ENGINE_YAHOO, + SEARCH_ENGINE_BING, + SEARCH_ENGINE_ASK, + SEARCH_ENGINE_YANDEX, + SEARCH_ENGINE_MAILRU, + SEARCH_ENGINE_SEZNAM, + SEARCH_ENGINE_CENTRUM, + SEARCH_ENGINE_VIRGILIO, + SEARCH_ENGINE_MAX // Bounding max value needed for UMA histogram macro. +}; + void RegisterUserPrefs(PrefService* prefs); // Returns the current version of the prepopulate data, so callers can know when @@ -26,6 +41,14 @@ void GetPrepopulatedEngines(PrefService* prefs, std::vector<TemplateURL*>* t_urls, size_t* default_search_provider_index); +// Returns the type of the search engine to be recorded in UMA. The type +// is determined by mapping the search engine's |id| to the set of search +// engines we are interested in. Because this is only a temporary test +// for a small set of search engines, we use this simple switch statement +// instead of embedding a UMA type as part of the struct of every search +// engine. +UMASearchEngineType GetSearchEngineType(const TemplateURL* search_engine); + } // namespace TemplateURLPrepopulateData #endif // CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_PREPOPULATE_DATA_H_ |