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

Unified Diff: chrome/browser/ui/startup/startup_browser_creator.cc

Issue 10417032: Disable sync promo when RestoreOnStartupURLs policy is used (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: CL rewritten to address the actual underlying issue. Created 8 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/prefs/session_startup_pref.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/startup/startup_browser_creator.cc
diff --git a/chrome/browser/ui/startup/startup_browser_creator.cc b/chrome/browser/ui/startup/startup_browser_creator.cc
index 14369090569c3caaec8898563d78ef620565a143..d88b342dafd08ac45c68e6e102ada73eb6a47740 100644
--- a/chrome/browser/ui/startup/startup_browser_creator.cc
+++ b/chrome/browser/ui/startup/startup_browser_creator.cc
@@ -230,10 +230,16 @@ bool StartupBrowserCreator::WasRestarted() {
SessionStartupPref StartupBrowserCreator::GetSessionStartupPref(
const CommandLine& command_line,
Profile* profile) {
- SessionStartupPref pref = SessionStartupPref::GetStartupPref(profile);
-
- // Session restore should be avoided on the first run.
- if (first_run::IsChromeFirstRun())
+ DCHECK(profile);
+ PrefService *prefs = profile->GetPrefs();
+ SessionStartupPref pref = SessionStartupPref::GetStartupPref(prefs);
+
+ // The pref has an OS-dependent default value. For the first run only, this
+ // default is overridden with SessionStartupPref::DEFAULT so that first run
+ // behavior (sync promo, welcome page) is consistently invoked.
+ // This applies only if the pref is still at its default and has not been
+ // set by the user, managed prefs or policy.
+ if (first_run::IsChromeFirstRun() && SessionStartupPref::TypeIsDefault(prefs))
pref.type = SessionStartupPref::DEFAULT;
if (command_line.HasSwitch(switches::kRestoreLastSession) ||
« no previous file with comments | « chrome/browser/prefs/session_startup_pref.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698