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

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

Issue 7522025: Turn on session restore by default for mac on Lion (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: JS nits and comment correction Created 9 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 side-by-side diff with in-line comments
Download patch
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 59e262f99e99a142b0b5976fc3019e25e77b0cb1..34176a9f865623694f1b0082a7630e525be9bd33 100644
--- a/chrome/browser/prefs/session_startup_pref.cc
+++ b/chrome/browser/prefs/session_startup_pref.cc
@@ -15,6 +15,10 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/common/pref_names.h"
+#ifdef OS_MACOSX
+#include "chrome/browser/ui/cocoa/window_restore_utils.h"
+#endif
+
namespace {
// For historical reasons the enum and value registered in the prefs don't line
@@ -41,6 +45,12 @@ SessionStartupPref::Type PrefValueToType(int pref_value) {
}
}
+bool TypeIsDefaultValue(PrefService* prefs) {
+ const PrefService::Preference* pref_restore =
+ prefs->FindPreference(prefs::kRestoreOnStartup);
+ return pref_restore->IsDefaultValue();
+}
+
} // namespace
// static
@@ -96,6 +106,17 @@ SessionStartupPref SessionStartupPref::GetStartupPref(PrefService* prefs) {
SessionStartupPref pref(
PrefValueToType(prefs->GetInteger(prefs::kRestoreOnStartup)));
+#ifdef OS_MACOSX
+ if (TypeIsDefaultValue(prefs)) {
+ // |DEFAULT| really means "Don't restore". The actual default value could
+ // change, so explicitly set both.
+ if (restore_utils::IsWindowRestoreEnabled())
+ pref.type = SessionStartupPref::LAST;
+ else
+ pref.type = SessionStartupPref::DEFAULT;
+ }
+#endif
+
// Always load the urls, even if the pref type isn't URLS. This way the
// preferences panels can show the user their last choice.
const ListValue* url_pref_list = prefs->GetList(
« no previous file with comments | « no previous file | chrome/browser/resources/options/browser_options.html » ('j') | chrome/browser/ui/cocoa/window_restore_utils.mm » ('J')

Powered by Google App Engine
This is Rietveld 408576698