diff options
author | joaodasilva@chromium.org <joaodasilva@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-20 00:41:18 +0000 |
---|---|---|
committer | joaodasilva@chromium.org <joaodasilva@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-20 00:41:18 +0000 |
commit | de5a45de018d8388f7479da3adb6472b991bf4f3 (patch) | |
tree | a1a9eda2cf54940ad59284c811416d45a7cb7ed3 /chrome | |
parent | 8ec2c7e81ab2e1f5bcfa93e3655263d5e27d90cf (diff) | |
download | chromium_src-de5a45de018d8388f7479da3adb6472b991bf4f3.zip chromium_src-de5a45de018d8388f7479da3adb6472b991bf4f3.tar.gz chromium_src-de5a45de018d8388f7479da3adb6472b991bf4f3.tar.bz2 |
Removed code duplication on test for search engine selector on first run.
Also fixes the test logic on the mac, which currently is ignoring
SearchEngineSelectorDisallowed() if the default search provider is not managed,
which is the most common case.
BUG=None
TEST=The search engine selection dialog shows on first run, except when the default search provider is managed by policy or the dialog is disallowed.
Review URL: http://codereview.chromium.org/7936009
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@101877 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/first_run/first_run.cc | 6 | ||||
-rw-r--r-- | chrome/browser/first_run/first_run.h | 8 | ||||
-rw-r--r-- | chrome/browser/ui/cocoa/first_run_dialog.mm | 3 | ||||
-rw-r--r-- | chrome/browser/ui/gtk/first_run_dialog.cc | 4 | ||||
-rw-r--r-- | chrome/browser/ui/views/first_run_search_engine_view.cc | 4 |
5 files changed, 15 insertions, 10 deletions
diff --git a/chrome/browser/first_run/first_run.cc b/chrome/browser/first_run/first_run.cc index f73f179..3cc08bda 100644 --- a/chrome/browser/first_run/first_run.cc +++ b/chrome/browser/first_run/first_run.cc @@ -462,6 +462,12 @@ bool FirstRun::SearchEngineSelectorDisallowed() { } // static +bool FirstRun::ShouldShowSearchEngineSelector(const TemplateURLService* model) { + return !SearchEngineSelectorDisallowed() && + model && !model->is_default_search_managed(); +} + +// static bool FirstRun::SetOEMFirstRunBubblePref() { PrefService* local_state = g_browser_process->local_state(); if (!local_state) diff --git a/chrome/browser/first_run/first_run.h b/chrome/browser/first_run/first_run.h index 35c82ac0..235754c 100644 --- a/chrome/browser/first_run/first_run.h +++ b/chrome/browser/first_run/first_run.h @@ -17,10 +17,11 @@ class CommandLine; class FilePath; class GURL; -class Profile; -class ProcessSingleton; class ImporterHost; class ImporterList; +class Profile; +class ProcessSingleton; +class TemplateURLService; // This class contains the chrome first-run installation actions needed to // fully test the custom installer. It also contains the opposite actions to @@ -131,6 +132,9 @@ class FirstRun { // being shown. static bool SearchEngineSelectorDisallowed(); + // Whether the search engine selection dialog should be shown on first run. + static bool ShouldShowSearchEngineSelector(const TemplateURLService* model); + // -- Platform-specific functions -- // Imports settings. This may be done in a separate process depending on the diff --git a/chrome/browser/ui/cocoa/first_run_dialog.mm b/chrome/browser/ui/cocoa/first_run_dialog.mm index 9458377..36c5788 100644 --- a/chrome/browser/ui/cocoa/first_run_dialog.mm +++ b/chrome/browser/ui/cocoa/first_run_dialog.mm @@ -151,8 +151,7 @@ void ShowFirstRunDialog(Profile* profile, // If the default search is not managed via policy, ask the user to // choose a default. TemplateURLService* model = TemplateURLServiceFactory::GetForProfile(profile); - if (!FirstRun::SearchEngineSelectorDisallowed() || - (model && !model->is_default_search_managed())) { + if (FirstRun::ShouldShowSearchEngineSelector(model)) { ShowSearchEngineSelectionDialog(profile, randomize_search_engine_experiment); } diff --git a/chrome/browser/ui/gtk/first_run_dialog.cc b/chrome/browser/ui/gtk/first_run_dialog.cc index 2143681..07ce629 100644 --- a/chrome/browser/ui/gtk/first_run_dialog.cc +++ b/chrome/browser/ui/gtk/first_run_dialog.cc @@ -111,9 +111,7 @@ bool FirstRunDialog::Show(Profile* profile, const TemplateURLService* search_engines_model = TemplateURLServiceFactory::GetForProfile(profile); bool show_search_engines_dialog = - !FirstRun::SearchEngineSelectorDisallowed() && - search_engines_model && - !search_engines_model->is_default_search_managed(); + FirstRun::ShouldShowSearchEngineSelector(search_engines_model); #if defined(GOOGLE_CHROME_BUILD) // If the metrics reporting is managed, we won't ask. diff --git a/chrome/browser/ui/views/first_run_search_engine_view.cc b/chrome/browser/ui/views/first_run_search_engine_view.cc index 7112f4b..991d699 100644 --- a/chrome/browser/ui/views/first_run_search_engine_view.cc +++ b/chrome/browser/ui/views/first_run_search_engine_view.cc @@ -58,10 +58,8 @@ void ShowFirstRunDialog(Profile* profile, // If the default search is managed via policy, we don't ask the user to // choose. TemplateURLService* model = TemplateURLServiceFactory::GetForProfile(profile); - if (FirstRun::SearchEngineSelectorDisallowed() || !model || - model->is_default_search_managed()) { + if (!FirstRun::ShouldShowSearchEngineSelector(model)) return; - } views::Widget* window = views::Widget::CreateWindow( new FirstRunSearchEngineView( |