| 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 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 return should_expire_; | 163 return should_expire_; |
| 164 } | 164 } |
| 165 | 165 |
| 166 void CheckDefaultBrowserCallback() { | 166 void CheckDefaultBrowserCallback() { |
| 167 if (!ShellIntegration::IsDefaultBrowser()) { | 167 if (!ShellIntegration::IsDefaultBrowser()) { |
| 168 ShellIntegration::DefaultWebClientSetPermission default_change_mode = | 168 ShellIntegration::DefaultWebClientSetPermission default_change_mode = |
| 169 ShellIntegration::CanSetAsDefaultBrowser(); | 169 ShellIntegration::CanSetAsDefaultBrowser(); |
| 170 | 170 |
| 171 if (default_change_mode != ShellIntegration::SET_DEFAULT_NOT_ALLOWED) { | 171 if (default_change_mode != ShellIntegration::SET_DEFAULT_NOT_ALLOWED) { |
| 172 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, | 172 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, |
| 173 base::Bind(&browser::internal::NotifyNotDefaultBrowserCallback)); | 173 base::Bind(&chrome::internal::NotifyNotDefaultBrowserCallback)); |
| 174 } | 174 } |
| 175 } | 175 } |
| 176 } | 176 } |
| 177 | 177 |
| 178 } // namespace | 178 } // namespace |
| 179 | 179 |
| 180 namespace browser { | 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 return; | 189 return; |
| 190 } | 190 } |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 | 232 |
| 233 bool interactive_flow = ShellIntegration::CanSetAsDefaultBrowser() == | 233 bool interactive_flow = ShellIntegration::CanSetAsDefaultBrowser() == |
| 234 ShellIntegration::SET_DEFAULT_INTERACTIVE; | 234 ShellIntegration::SET_DEFAULT_INTERACTIVE; |
| 235 infobar_helper->AddInfoBar( | 235 infobar_helper->AddInfoBar( |
| 236 new DefaultBrowserInfoBarDelegate(infobar_helper, | 236 new DefaultBrowserInfoBarDelegate(infobar_helper, |
| 237 tab->profile()->GetPrefs(), | 237 tab->profile()->GetPrefs(), |
| 238 interactive_flow)); | 238 interactive_flow)); |
| 239 } | 239 } |
| 240 | 240 |
| 241 } // namespace internal | 241 } // namespace internal |
| 242 } // namespace browser | 242 } // namespace chrome |
| OLD | NEW |