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

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: Nit addressed. 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..7c914a7292a3ac7e639f0d72faa22e132ea4db41 100644
--- a/chrome/browser/ui/startup/startup_browser_creator.cc
+++ b/chrome/browser/ui/startup/startup_browser_creator.cc
@@ -14,6 +14,7 @@
#include "base/environment.h"
#include "base/file_path.h"
#include "base/lazy_instance.h"
+#include "base/logging.h"
#include "base/memory/scoped_ptr.h"
#include "base/metrics/histogram.h"
#include "base/path_service.h"
@@ -230,10 +231,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) ||
@@ -241,8 +248,7 @@ SessionStartupPref StartupBrowserCreator::GetSessionStartupPref(
pref.type = SessionStartupPref::LAST;
}
if (pref.type == SessionStartupPref::LAST &&
- IncognitoModePrefs::ShouldLaunchIncognito(command_line,
- profile->GetPrefs())) {
+ IncognitoModePrefs::ShouldLaunchIncognito(command_line, prefs)) {
// We don't store session information when incognito. If the user has
// chosen to restore last session and launched incognito, fallback to
// default launch behavior.
« 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