summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/first_run/first_run.cc6
-rw-r--r--chrome/browser/first_run/first_run.h8
-rw-r--r--chrome/browser/ui/cocoa/first_run_dialog.mm3
-rw-r--r--chrome/browser/ui/gtk/first_run_dialog.cc4
-rw-r--r--chrome/browser/ui/views/first_run_search_engine_view.cc4
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(