Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1047)

Side by Side Diff: chrome/browser/ui/startup/default_browser_prompt.cc

Issue 10702097: Adds browser preferences to configure first-run flow on Windows 8. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed grt@'s remarks. Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, 171 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
172 base::Bind(&chrome::internal::NotifyNotDefaultBrowserCallback)); 172 base::Bind(&chrome::internal::NotifyNotDefaultBrowserCallback));
173 } 173 }
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 bool permit_prompt_on_first_run) {
182 // We do not check if we are the default browser if: 183 // We do not check if we are the default browser if:
183 // - 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.
184 // - this is the first launch after the first run flow. 185 // - this is the first launch after the first run flow.
185 // - There is a policy in control of this setting. 186 // - There is a policy in control of this setting.
186 if (!profile->GetPrefs()->GetBoolean(prefs::kCheckDefaultBrowser) || 187 if (!profile->GetPrefs()->GetBoolean(prefs::kCheckDefaultBrowser) ||
187 first_run::IsChromeFirstRun()) { 188 (first_run::IsChromeFirstRun() && !permit_prompt_on_first_run)) {
188 return; 189 return;
189 } 190 }
190 if (g_browser_process->local_state()->IsManagedPreference( 191 if (g_browser_process->local_state()->IsManagedPreference(
191 prefs::kDefaultBrowserSettingEnabled)) { 192 prefs::kDefaultBrowserSettingEnabled)) {
192 if (g_browser_process->local_state()->GetBoolean( 193 if (g_browser_process->local_state()->GetBoolean(
193 prefs::kDefaultBrowserSettingEnabled)) { 194 prefs::kDefaultBrowserSettingEnabled)) {
194 BrowserThread::PostTask( 195 BrowserThread::PostTask(
195 BrowserThread::FILE, FROM_HERE, 196 BrowserThread::FILE, FROM_HERE,
196 base::Bind( 197 base::Bind(
197 base::IgnoreResult(&ShellIntegration::SetAsDefaultBrowser))); 198 base::IgnoreResult(&ShellIntegration::SetAsDefaultBrowser)));
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 bool interactive_flow = ShellIntegration::CanSetAsDefaultBrowser() == 233 bool interactive_flow = ShellIntegration::CanSetAsDefaultBrowser() ==
233 ShellIntegration::SET_DEFAULT_INTERACTIVE; 234 ShellIntegration::SET_DEFAULT_INTERACTIVE;
234 infobar_helper->AddInfoBar( 235 infobar_helper->AddInfoBar(
235 new DefaultBrowserInfoBarDelegate(infobar_helper, 236 new DefaultBrowserInfoBarDelegate(infobar_helper,
236 tab->profile()->GetPrefs(), 237 tab->profile()->GetPrefs(),
237 interactive_flow)); 238 interactive_flow));
238 } 239 }
239 240
240 } // namespace internal 241 } // namespace internal
241 } // namespace chrome 242 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698