summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormirandac@chromium.org <mirandac@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-16 20:30:14 +0000
committermirandac@chromium.org <mirandac@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-16 20:30:14 +0000
commit96b3c5c54e8c96a11daf0c8457d7034792665035 (patch)
treed4783364710efe3aa0635bb741683c34c3dceed3
parent9d4a694dbdcbcac8f738e3a49e27e0abdb6c0c6c (diff)
downloadchromium_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
-rw-r--r--chrome/browser/browser_main.cc25
-rw-r--r--chrome/browser/search_engines/template_url_prepopulate_data.cc25
-rw-r--r--chrome/browser/search_engines/template_url_prepopulate_data.h23
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_