diff options
-rw-r--r-- | chrome/browser/browser_main.cc | 25 | ||||
-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 |
3 files changed, 73 insertions, 0 deletions
diff --git a/chrome/browser/browser_main.cc b/chrome/browser/browser_main.cc index e363389..e9326a8 100644 --- a/chrome/browser/browser_main.cc +++ b/chrome/browser/browser_main.cc @@ -52,6 +52,8 @@ #include "chrome/browser/profile.h" #include "chrome/browser/profile_manager.h" #include "chrome/browser/renderer_host/resource_dispatcher_host.h" +#include "chrome/browser/search_engines/template_url_model.h" +#include "chrome/browser/search_engines/template_url_prepopulate_data.h" #include "chrome/browser/shell_integration.h" #include "chrome/browser/translate/translate_manager.h" #include "chrome/browser/user_data_manager.h" @@ -1180,6 +1182,29 @@ int BrowserMain(const MainFunctionParams& parameters) { RunUIMessageLoop(browser_process.get()); } } + + // If it's the first run, log the search engine chosen. We wait until + // shutdown because otherwise we can't be sure the user has finished + // selecting a search engine through the dialog reached from the first run + // bubble link. + if (is_first_run) { + const TemplateURL* default_search_engine = + profile->GetTemplateURLModel()->GetDefaultSearchProvider(); + if (master_prefs.run_search_engine_experiment) { + UMA_HISTOGRAM_ENUMERATION( + "Chrome.SearchSelectExperiment", + TemplateURLPrepopulateData::GetSearchEngineType( + default_search_engine), + TemplateURLPrepopulateData::SEARCH_ENGINE_MAX); + } else { + UMA_HISTOGRAM_ENUMERATION( + "Chrome.SearchSelectExempt", + TemplateURLPrepopulateData::GetSearchEngineType( + default_search_engine), + TemplateURLPrepopulateData::SEARCH_ENGINE_MAX); + } + } + chrome_browser_net_websocket_experiment::WebSocketExperimentRunner::Stop(); process_singleton.Cleanup(); 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_ |