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

Unified Diff: chrome/browser/prefs/session_startup_pref.cc

Issue 10581013: Make the default startup pref to be NTP also on Mac. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: oops Created 8 years, 6 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.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/prefs/session_startup_pref.cc
diff --git a/chrome/browser/prefs/session_startup_pref.cc b/chrome/browser/prefs/session_startup_pref.cc
index d63767dd691698df4aac0ffa0b4edb04ad4ee6dc..bbe96c9e5b725b9044b9d6767d89dfeb3e957cbd 100644
--- a/chrome/browser/prefs/session_startup_pref.cc
+++ b/chrome/browser/prefs/session_startup_pref.cc
@@ -7,6 +7,7 @@
#include <string>
#include "base/values.h"
+#include "base/version.h"
#include "chrome/browser/net/url_fixer_upper.h"
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/prefs/scoped_user_pref_update.h"
@@ -72,18 +73,10 @@ void SessionStartupPref::RegisterUserPrefs(PrefService* prefs) {
// static
SessionStartupPref::Type SessionStartupPref::GetDefaultStartupType() {
#if defined(OS_CHROMEOS)
- SessionStartupPref::Type type = SessionStartupPref::LAST;
+ return SessionStartupPref::LAST;
#else
- SessionStartupPref::Type type = SessionStartupPref::DEFAULT;
+ return SessionStartupPref::DEFAULT;
#endif
-
-#if defined(OS_MACOSX)
- // Use Lion's system preference, if it is set.
- if (restore_utils::IsWindowRestoreEnabled())
- type = SessionStartupPref::LAST;
-#endif
-
- return type;
}
// static
@@ -129,6 +122,11 @@ SessionStartupPref SessionStartupPref::GetStartupPref(PrefService* prefs) {
MigrateIfNecessary(prefs);
+#if defined(OS_MACOSX)
+ if (restore_utils::IsWindowRestoreEnabled())
+ MigrateMacDefaultPrefIfNecessary(prefs);
+#endif
+
SessionStartupPref pref(
PrefValueToType(prefs->GetInteger(prefs::kRestoreOnStartup)));
@@ -189,6 +187,18 @@ void SessionStartupPref::MigrateIfNecessary(PrefService* prefs) {
}
// static
+void SessionStartupPref::MigrateMacDefaultPrefIfNecessary(PrefService* prefs) {
+ DCHECK(prefs);
+ // The default startup pref used to be LAST, now it is DEFAULT. Don't change
+ // the setting for existing profiles (even if the user has never changed it),
+ // but make new profiles default to DEFAULT.
+ bool old_profile_version = Version(prefs->GetString(
+ prefs::kProfileCreatedByVersion)).IsOlderThan("21.0.1180.0");
+ if (old_profile_version && TypeIsDefault(prefs))
+ prefs->SetInteger(prefs::kRestoreOnStartup, kPrefValueLast);
Joao da Silva 2012/06/19 15:23:00 kPrevValueLast might not be the right value here,
marja 2012/06/19 15:24:48 This code only gets executed if restore_utils::IsW
+}
+
+// static
bool SessionStartupPref::TypeIsManaged(PrefService* prefs) {
DCHECK(prefs);
const PrefService::Preference* pref_restore =
« no previous file with comments | « chrome/browser/prefs/session_startup_pref.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698