summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
authormirandac@chromium.org <mirandac@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-21 00:35:01 +0000
committermirandac@chromium.org <mirandac@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-21 00:35:01 +0000
commit15406b6ab2f2c701d6e82c8e53c22d1c570c739a (patch)
tree3ec5bf3f1ca12625e4dff0f5579b7f3ad787248b /chrome/browser
parentff62185663f68c9d40dc13dec778ca0e321afdf9 (diff)
downloadchromium_src-15406b6ab2f2c701d6e82c8e53c22d1c570c739a.zip
chromium_src-15406b6ab2f2c701d6e82c8e53c22d1c570c739a.tar.gz
chromium_src-15406b6ab2f2c701d6e82c8e53c22d1c570c739a.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/1709003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@45129 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/browser_main.cc6
-rw-r--r--chrome/browser/first_run.h3
-rw-r--r--chrome/browser/first_run_win.cc17
3 files changed, 24 insertions, 2 deletions
diff --git a/chrome/browser/browser_main.cc b/chrome/browser/browser_main.cc
index f83d34a..5275a3a 100644
--- a/chrome/browser/browser_main.cc
+++ b/chrome/browser/browser_main.cc
@@ -1146,9 +1146,11 @@ int BrowserMain(const MainFunctionParams& parameters) {
// See issue 40144.
profile->GetExtensionsService()->InitEventRouters();
+#if defined(OS_WIN)
// We check this here because if the profile is OTR (chromeos possibility)
// it won't still be accessible after browser is destroyed.
bool record_search_engine = is_first_run && !profile->IsOffTheRecord();
+#endif
int result_code = ResultCodes::NORMAL_EXIT;
if (parameters.ui_task) {
@@ -1187,11 +1189,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 (record_search_engine) {
+ if (FirstRun::InSearchExperimentLocale() && record_search_engine) {
const TemplateURL* default_search_engine =
profile->GetTemplateURLModel()->GetDefaultSearchProvider();
if (master_prefs.run_search_engine_experiment) {
@@ -1208,6 +1211,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 {