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

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: 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..460465484255779b9b6d30fd28b3c2c6e49a3011 100644
--- a/chrome/browser/prefs/session_startup_pref.cc
+++ b/chrome/browser/prefs/session_startup_pref.cc
@@ -13,6 +13,9 @@
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/prefs/scoped_user_pref_update.h"
#include "chrome/browser/profiles/profile.h"
+#ifdef OS_MACOSX
Robert Sesek 2011/07/28 18:30:22 Break this out to be in its own #include block
dhollowa 2011/07/28 20:05:35 Done.
+#include "chrome/browser/ui/cocoa/window_restore_utils.h"
+#endif
#include "chrome/common/pref_names.h"
namespace {
@@ -41,6 +44,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 +105,15 @@ SessionStartupPref SessionStartupPref::GetStartupPref(PrefService* prefs) {
SessionStartupPref pref(
PrefValueToType(prefs->GetInteger(prefs::kRestoreOnStartup)));
+#ifdef OS_MACOSX
+ if (TypeIsDefaultValue(prefs)) {
+ 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(

Powered by Google App Engine
This is Rietveld 408576698