diff options
author | mirandac@chromium.org <mirandac@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-21 03:54:56 +0000 |
---|---|---|
committer | mirandac@chromium.org <mirandac@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-21 03:54:56 +0000 |
commit | 1858d60ab5400b24cb510c86cca7d233d75c4f98 (patch) | |
tree | 554f17fd242c69615c4a5b9e334715aee5057a42 | |
parent | 57f3d75c612a6690fc63c5b087b176cc980f554e (diff) | |
download | chromium_src-1858d60ab5400b24cb510c86cca7d233d75c4f98.zip chromium_src-1858d60ab5400b24cb510c86cca7d233d75c4f98.tar.gz chromium_src-1858d60ab5400b24cb510c86cca7d233d75c4f98.tar.bz2 |
Check for proper locale before recording search engine data, or offering the search engine experimental dialog.
BUG= 37564
TEST=none
Review URL: http://codereview.chromium.org/1748001
git-svn-id: svn://svn.chromium.org/chrome/branches/375/src@45145 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/browser_main.cc | 4 | ||||
-rw-r--r-- | chrome/browser/first_run.h | 3 | ||||
-rw-r--r-- | chrome/browser/first_run_win.cc | 17 |
3 files changed, 22 insertions, 2 deletions
diff --git a/chrome/browser/browser_main.cc b/chrome/browser/browser_main.cc index cfba5df..f5c556b 100644 --- a/chrome/browser/browser_main.cc +++ b/chrome/browser/browser_main.cc @@ -1168,11 +1168,12 @@ int BrowserMain(const MainFunctionParams& parameters) { } } +#if defined(OS_WIN) // 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) { + if (FirstRun::InSearchExperimentLocale() && is_first_run) { const TemplateURL* default_search_engine = profile->GetTemplateURLModel()->GetDefaultSearchProvider(); if (master_prefs.run_search_engine_experiment) { @@ -1189,6 +1190,7 @@ int BrowserMain(const MainFunctionParams& parameters) { TemplateURLPrepopulateData::SEARCH_ENGINE_MAX); } } +#endif chrome_browser_net_websocket_experiment::WebSocketExperimentRunner::Stop(); diff --git a/chrome/browser/first_run.h b/chrome/browser/first_run.h index ca00c67..0feb4fb 100644 --- a/chrome/browser/first_run.h +++ b/chrome/browser/first_run.h @@ -54,6 +54,9 @@ class FirstRun { // Creates the quick launch shortcut to chrome for the current user. Returns // false if it fails. It will overwrite the shortcut if it exists. static bool CreateChromeQuickLaunchShortcut(); + // Returns true if we are being run in a locale in which search experiments + // are allowed. + static bool InSearchExperimentLocale(); #endif // OS_WIN // Import bookmarks and/or browser items (depending on platform support) // in this process. This function is paired with FirstRun::ImportSettings(). diff --git a/chrome/browser/first_run_win.cc b/chrome/browser/first_run_win.cc index 086a2c4..cc34dc1 100644 --- a/chrome/browser/first_run_win.cc +++ b/chrome/browser/first_run_win.cc @@ -8,6 +8,7 @@ #include <shellapi.h> #include <shlobj.h> +#include <set> #include <sstream> // TODO(port): trim this include list once first run has been refactored fully. @@ -320,7 +321,8 @@ bool FirstRun::ProcessMasterPreferences(const FilePath& user_data_dir, } } - if (installer_util::GetDistroBooleanPreference(prefs.get(), + if (InSearchExperimentLocale() && + installer_util::GetDistroBooleanPreference(prefs.get(), installer_util::master_preferences::kSearchEngineExperimentPref, &value) && value) { // Set the first run dialog to include the search choice window. @@ -729,6 +731,19 @@ int FirstRun::ImportFromBrowser(Profile* profile, return observer.import_result(); } +// static +bool FirstRun::InSearchExperimentLocale() { + static std::set<std::string> allowed_locales; + if (allowed_locales.empty()) { + // List of locales in which search experiment can be run. + allowed_locales.insert("en-GB"); + allowed_locales.insert("en-US"); + } + const std::string app_locale = g_browser_process->GetApplicationLocale(); + std::set<std::string>::iterator locale = allowed_locales.find(app_locale); + return locale != allowed_locales.end(); +} + ////////////////////////////////////////////////////////////////////////// namespace { |