OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/ui/startup/default_browser_prompt.h" | 5 #include "chrome/browser/ui/startup/default_browser_prompt.h" |
6 | 6 |
7 #include "base/memory/weak_ptr.h" | 7 #include "base/memory/weak_ptr.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 } // namespace | 178 } // namespace |
179 | 179 |
180 namespace chrome { | 180 namespace chrome { |
181 | 181 |
182 void ShowDefaultBrowserPrompt(Profile* profile) { | 182 void ShowDefaultBrowserPrompt(Profile* profile) { |
183 // We do not check if we are the default browser if: | 183 // We do not check if we are the default browser if: |
184 // - the user said "don't ask me again" on the infobar earlier. | 184 // - the user said "don't ask me again" on the infobar earlier. |
185 // - this is the first launch after the first run flow. | 185 // - this is the first launch after the first run flow. |
186 // - There is a policy in control of this setting. | 186 // - There is a policy in control of this setting. |
187 if (!profile->GetPrefs()->GetBoolean(prefs::kCheckDefaultBrowser) || | 187 if (!profile->GetPrefs()->GetBoolean(prefs::kCheckDefaultBrowser) || |
188 first_run::IsChromeFirstRun()) { | 188 (first_run::IsChromeFirstRun() && |
| 189 !profile->GetPrefs()->GetBoolean( |
| 190 prefs::kCheckDefaultBrowserOnFirstRun))) { |
189 return; | 191 return; |
190 } | 192 } |
191 if (g_browser_process->local_state()->IsManagedPreference( | 193 if (g_browser_process->local_state()->IsManagedPreference( |
192 prefs::kDefaultBrowserSettingEnabled)) { | 194 prefs::kDefaultBrowserSettingEnabled)) { |
193 if (g_browser_process->local_state()->GetBoolean( | 195 if (g_browser_process->local_state()->GetBoolean( |
194 prefs::kDefaultBrowserSettingEnabled)) { | 196 prefs::kDefaultBrowserSettingEnabled)) { |
195 BrowserThread::PostTask( | 197 BrowserThread::PostTask( |
196 BrowserThread::FILE, FROM_HERE, | 198 BrowserThread::FILE, FROM_HERE, |
197 base::Bind( | 199 base::Bind( |
198 base::IgnoreResult(&ShellIntegration::SetAsDefaultBrowser))); | 200 base::IgnoreResult(&ShellIntegration::SetAsDefaultBrowser))); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 bool interactive_flow = ShellIntegration::CanSetAsDefaultBrowser() == | 235 bool interactive_flow = ShellIntegration::CanSetAsDefaultBrowser() == |
234 ShellIntegration::SET_DEFAULT_INTERACTIVE; | 236 ShellIntegration::SET_DEFAULT_INTERACTIVE; |
235 infobar_helper->AddInfoBar( | 237 infobar_helper->AddInfoBar( |
236 new DefaultBrowserInfoBarDelegate(infobar_helper, | 238 new DefaultBrowserInfoBarDelegate(infobar_helper, |
237 tab->profile()->GetPrefs(), | 239 tab->profile()->GetPrefs(), |
238 interactive_flow)); | 240 interactive_flow)); |
239 } | 241 } |
240 | 242 |
241 } // namespace internal | 243 } // namespace internal |
242 } // namespace chrome | 244 } // namespace chrome |
OLD | NEW |