summaryrefslogtreecommitdiffstats
path: root/chrome/browser/first_run
diff options
context:
space:
mode:
authorjeanluc@google.com <jeanluc@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-19 06:19:48 +0000
committerjeanluc@google.com <jeanluc@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-19 06:19:48 +0000
commit32cba2b85543286544bf1a613fa7819e295a36a4 (patch)
tree4623f33a2acf2b816e187e24fc2362c302353530 /chrome/browser/first_run
parentf6e7b6d78a6729ab7cc8c3258d3aeb8f73210cdc (diff)
downloadchromium_src-32cba2b85543286544bf1a613fa7819e295a36a4.zip
chromium_src-32cba2b85543286544bf1a613fa7819e295a36a4.tar.gz
chromium_src-32cba2b85543286544bf1a613fa7819e295a36a4.tar.bz2
If default search is managed, we should not asked the user to choose it at First Run. Make sure the minimum bubble is not showed if there is no default search.
This is a re-issue of CL 3565013 without the extraneous change to search_engine_list_model.mm, to be done in a forthcoming CL> BUG=49306 TEST=Set a managed default search provider. Clear your Chromium user data directory (~/Library/Chromium, ~/.config/chromium, %localappdata%\Chromium) and the "First Run" file found next to the executable. Start Chrome. It should not ask you to choose a default search provider. Disable the default search provider via policy. Make sure the minimal bubble is not shown. Redo these tests for the GOOGLE_CHROME_BUILD to make sure that we still ask about usage stats. Review URL: http://codereview.chromium.org/3847006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@63024 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/first_run')
-rw-r--r--chrome/browser/first_run/first_run.cc14
-rw-r--r--chrome/browser/first_run/first_run_mac.mm18
-rw-r--r--chrome/browser/first_run/first_run_win.cc7
3 files changed, 32 insertions, 7 deletions
diff --git a/chrome/browser/first_run/first_run.cc b/chrome/browser/first_run/first_run.cc
index 596419f..663c52d 100644
--- a/chrome/browser/first_run/first_run.cc
+++ b/chrome/browser/first_run/first_run.cc
@@ -22,6 +22,7 @@
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/process_singleton.h"
#include "chrome/browser/profile_manager.h"
+#include "chrome/browser/search_engines/template_url_model.h"
#include "chrome/browser/shell_integration.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/chrome_switches.h"
@@ -564,7 +565,7 @@ void FirstRun::AutoImport(
UserMetrics::RecordAction(UserMetricsAction("FirstRunDef_Accept"));
// Launch the search engine dialog only if build is organic, and user has not
- // already set search preferences.
+ // already set preferences.
if (IsOrganic() && !local_state_file_exists) {
// The home page string may be set in the preferences, but the user should
// initially use Chrome with the NTP as home page in organic builds.
@@ -575,9 +576,14 @@ void FirstRun::AutoImport(
if (make_chrome_default)
ShellIntegration::SetAsDefaultBrowser();
- FirstRun::SetShowFirstRunBubblePref(true);
- // Set the first run bubble to minimal.
- FirstRun::SetMinimalFirstRunBubblePref();
+ // Don't display the minimal bubble if there is no default search provider.
+ TemplateURLModel* search_engines_model = profile->GetTemplateURLModel();
+ if (search_engines_model &&
+ search_engines_model->GetDefaultSearchProvider()) {
+ FirstRun::SetShowFirstRunBubblePref(true);
+ // Set the first run bubble to minimal.
+ FirstRun::SetMinimalFirstRunBubblePref();
+ }
FirstRun::SetShowWelcomePagePref();
FirstRun::SetPersonalDataManagerFirstRunPref();
diff --git a/chrome/browser/first_run/first_run_mac.mm b/chrome/browser/first_run/first_run_mac.mm
index 3159e9d..b297d15 100644
--- a/chrome/browser/first_run/first_run_mac.mm
+++ b/chrome/browser/first_run/first_run_mac.mm
@@ -9,6 +9,8 @@
#import "chrome/browser/cocoa/first_run_dialog.h"
#import "chrome/browser/cocoa/search_engine_dialog_controller.h"
#include "chrome/browser/prefs/pref_service.h"
+#include "chrome/browser/profile.h"
+#include "chrome/browser/search_engines/template_url_model.h"
#include "chrome/browser/shell_integration.h"
#include "chrome/common/pref_names.h"
#include "chrome/installer/util/google_update_constants.h"
@@ -71,7 +73,12 @@ void ShowFirstRun(Profile* profile) {
FirstRun::CreateSentinel();
// Set preference to show first run bubble and welcome page.
- FirstRun::SetShowFirstRunBubblePref(true);
+ // Don't display the minimal bubble if there is no default search provider.
+ TemplateURLModel* search_engines_model = profile->GetTemplateURLModel();
+ if (search_engines_model &&
+ search_engines_model->GetDefaultSearchProvider()) {
+ FirstRun::SetShowFirstRunBubblePref(true);
+ }
FirstRun::SetShowWelcomePagePref();
}
@@ -80,8 +87,13 @@ void ShowFirstRun(Profile* profile) {
// static
void FirstRun::ShowFirstRunDialog(Profile* profile,
bool randomize_search_engine_experiment) {
- ShowSearchEngineSelectionDialog(profile,
- randomize_search_engine_experiment);
+ // If the default search is not managed via policy, ask the user to
+ // choose a default.
+ TemplateURLModel* model = profile->GetTemplateURLModel();
+ if (model && !model->is_default_search_managed()) {
+ ShowSearchEngineSelectionDialog(profile,
+ randomize_search_engine_experiment);
+ }
ShowFirstRun(profile);
}
diff --git a/chrome/browser/first_run/first_run_win.cc b/chrome/browser/first_run/first_run_win.cc
index 4f9175d..a7f7a3c 100644
--- a/chrome/browser/first_run/first_run_win.cc
+++ b/chrome/browser/first_run/first_run_win.cc
@@ -31,6 +31,7 @@
#include "chrome/browser/metrics/user_metrics.h"
#include "chrome/browser/process_singleton.h"
#include "chrome/browser/profile.h"
+#include "chrome/browser/search_engines/template_url_model.h"
#include "chrome/browser/views/first_run_search_engine_view.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/notification_service.h"
@@ -453,6 +454,12 @@ bool FirstRun::IsOrganic() {
// static
void FirstRun::ShowFirstRunDialog(Profile* profile,
bool randomize_search_engine_experiment) {
+ // If the default search is managed via policy, we don't ask the user to
+ // choose.
+ TemplateURLModel* model = profile->GetTemplateURLModel();
+ if (NULL == model || model->is_default_search_managed())
+ return;
+
views::Window* search_engine_dialog = views::Window::CreateChromeWindow(
NULL,
gfx::Rect(),