OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/first_run/first_run.h" | 5 #include "chrome/browser/first_run/first_run.h" |
6 | 6 |
7 #import "base/scoped_nsobject.h" | 7 #import "base/scoped_nsobject.h" |
8 #import "chrome/app/breakpad_mac.h" | 8 #import "chrome/app/breakpad_mac.h" |
9 #import "chrome/browser/cocoa/first_run_dialog.h" | 9 #import "chrome/browser/cocoa/first_run_dialog.h" |
10 #import "chrome/browser/cocoa/search_engine_dialog_controller.h" | 10 #import "chrome/browser/cocoa/search_engine_dialog_controller.h" |
11 #include "chrome/browser/prefs/pref_service.h" | 11 #include "chrome/browser/prefs/pref_service.h" |
| 12 #include "chrome/browser/profile.h" |
| 13 #include "chrome/browser/search_engines/template_url_model.h" |
12 #include "chrome/browser/shell_integration.h" | 14 #include "chrome/browser/shell_integration.h" |
13 #include "chrome/common/pref_names.h" | 15 #include "chrome/common/pref_names.h" |
14 #include "chrome/installer/util/google_update_constants.h" | 16 #include "chrome/installer/util/google_update_constants.h" |
15 #include "chrome/installer/util/google_update_settings.h" | 17 #include "chrome/installer/util/google_update_settings.h" |
16 | 18 |
17 namespace { | 19 namespace { |
18 | 20 |
19 // Show the search engine selection dialog. | 21 // Show the search engine selection dialog. |
20 void ShowSearchEngineSelectionDialog(Profile* profile, | 22 void ShowSearchEngineSelectionDialog(Profile* profile, |
21 bool randomize_search_engine_experiment) { | 23 bool randomize_search_engine_experiment) { |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 DCHECK(success); | 66 DCHECK(success); |
65 } | 67 } |
66 } | 68 } |
67 #else // GOOGLE_CHROME_BUILD | 69 #else // GOOGLE_CHROME_BUILD |
68 // We don't show the dialog in Chromium. | 70 // We don't show the dialog in Chromium. |
69 #endif // GOOGLE_CHROME_BUILD | 71 #endif // GOOGLE_CHROME_BUILD |
70 | 72 |
71 FirstRun::CreateSentinel(); | 73 FirstRun::CreateSentinel(); |
72 | 74 |
73 // Set preference to show first run bubble and welcome page. | 75 // Set preference to show first run bubble and welcome page. |
74 FirstRun::SetShowFirstRunBubblePref(true); | 76 // Don't display the minimal bubble if there is no default search provider. |
| 77 TemplateURLModel* search_engines_model = profile->GetTemplateURLModel(); |
| 78 if (search_engines_model && |
| 79 search_engines_model->GetDefaultSearchProvider()) { |
| 80 FirstRun::SetShowFirstRunBubblePref(true); |
| 81 } |
75 FirstRun::SetShowWelcomePagePref(); | 82 FirstRun::SetShowWelcomePagePref(); |
76 } | 83 } |
77 | 84 |
78 } // namespace | 85 } // namespace |
79 | 86 |
80 // static | 87 // static |
81 void FirstRun::ShowFirstRunDialog(Profile* profile, | 88 void FirstRun::ShowFirstRunDialog(Profile* profile, |
82 bool randomize_search_engine_experiment) { | 89 bool randomize_search_engine_experiment) { |
83 ShowSearchEngineSelectionDialog(profile, | 90 // If the default search is not managed via policy, ask the user to |
84 randomize_search_engine_experiment); | 91 // choose a default. |
| 92 TemplateURLModel* model = profile->GetTemplateURLModel(); |
| 93 if (model && !model->is_default_search_managed()) { |
| 94 ShowSearchEngineSelectionDialog(profile, |
| 95 randomize_search_engine_experiment); |
| 96 } |
85 ShowFirstRun(profile); | 97 ShowFirstRun(profile); |
86 } | 98 } |
87 | 99 |
88 bool FirstRun::ImportBookmarks(const FilePath& import_bookmarks_path) { | 100 bool FirstRun::ImportBookmarks(const FilePath& import_bookmarks_path) { |
89 // http://crbug.com/48880 | 101 // http://crbug.com/48880 |
90 return false; | 102 return false; |
91 } | 103 } |
92 | 104 |
93 // static | 105 // static |
94 bool FirstRun::IsOrganic() { | 106 bool FirstRun::IsOrganic() { |
95 // We treat all installs as organic. | 107 // We treat all installs as organic. |
96 return true; | 108 return true; |
97 } | 109 } |
98 | 110 |
99 // static | 111 // static |
100 void FirstRun::PlatformSetup() { | 112 void FirstRun::PlatformSetup() { |
101 // Things that Windows does here (creating a desktop icon, for example) are | 113 // Things that Windows does here (creating a desktop icon, for example) are |
102 // not needed. | 114 // not needed. |
103 } | 115 } |
OLD | NEW |