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 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 } | 174 } |
175 } | 175 } |
176 | 176 |
177 } // namespace | 177 } // namespace |
178 | 178 |
179 namespace chrome { | 179 namespace chrome { |
180 | 180 |
181 void ShowDefaultBrowserPrompt(Profile* profile) { | 181 void ShowDefaultBrowserPrompt(Profile* profile) { |
182 // We do not check if we are the default browser if: | 182 // We do not check if we are the default browser if: |
183 // - the user said "don't ask me again" on the infobar earlier. | 183 // - the user said "don't ask me again" on the infobar earlier. |
184 // - this is the first launch after the first run flow. | |
185 // - There is a policy in control of this setting. | 184 // - There is a policy in control of this setting. |
186 if (!profile->GetPrefs()->GetBoolean(prefs::kCheckDefaultBrowser) || | 185 if (!profile->GetPrefs()->GetBoolean(prefs::kCheckDefaultBrowser)) |
187 first_run::IsChromeFirstRun()) { | |
188 return; | 186 return; |
189 } | 187 |
190 if (g_browser_process->local_state()->IsManagedPreference( | 188 if (g_browser_process->local_state()->IsManagedPreference( |
191 prefs::kDefaultBrowserSettingEnabled)) { | 189 prefs::kDefaultBrowserSettingEnabled)) { |
192 if (g_browser_process->local_state()->GetBoolean( | 190 if (g_browser_process->local_state()->GetBoolean( |
193 prefs::kDefaultBrowserSettingEnabled)) { | 191 prefs::kDefaultBrowserSettingEnabled)) { |
194 BrowserThread::PostTask( | 192 BrowserThread::PostTask( |
195 BrowserThread::FILE, FROM_HERE, | 193 BrowserThread::FILE, FROM_HERE, |
196 base::Bind( | 194 base::Bind( |
197 base::IgnoreResult(&ShellIntegration::SetAsDefaultBrowser))); | 195 base::IgnoreResult(&ShellIntegration::SetAsDefaultBrowser))); |
198 } else { | 196 } else { |
199 // TODO(pastarmovj): We can't really do anything meaningful here yet but | 197 // TODO(pastarmovj): We can't really do anything meaningful here yet but |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 bool interactive_flow = ShellIntegration::CanSetAsDefaultBrowser() == | 230 bool interactive_flow = ShellIntegration::CanSetAsDefaultBrowser() == |
233 ShellIntegration::SET_DEFAULT_INTERACTIVE; | 231 ShellIntegration::SET_DEFAULT_INTERACTIVE; |
234 infobar_helper->AddInfoBar( | 232 infobar_helper->AddInfoBar( |
235 new DefaultBrowserInfoBarDelegate(infobar_helper, | 233 new DefaultBrowserInfoBarDelegate(infobar_helper, |
236 tab->profile()->GetPrefs(), | 234 tab->profile()->GetPrefs(), |
237 interactive_flow)); | 235 interactive_flow)); |
238 } | 236 } |
239 | 237 |
240 } // namespace internal | 238 } // namespace internal |
241 } // namespace chrome | 239 } // namespace chrome |
OLD | NEW |