summaryrefslogtreecommitdiffstats
path: root/chrome/browser/prefs
diff options
context:
space:
mode:
authordhollowa@chromium.org <dhollowa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-07-29 00:54:34 +0000
committerdhollowa@chromium.org <dhollowa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-07-29 00:54:34 +0000
commitbe19abe1e80e4e3593a50efbc961c579465ea05b (patch)
tree5e4db748305dacacb9ab7698a65514a2b09eb3f3 /chrome/browser/prefs
parent1bfecd09376ef163d0eaf5fdcfb73dbb9e31c1bf (diff)
downloadchromium_src-be19abe1e80e4e3593a50efbc961c579465ea05b.zip
chromium_src-be19abe1e80e4e3593a50efbc961c579465ea05b.tar.gz
chromium_src-be19abe1e80e4e3593a50efbc961c579465ea05b.tar.bz2
Turn on session restore by default for mac on Lion
When the user has not explicitly set a preference in Chrome for session restore, the default behavior under Lion becomes sensitive to the System preference for window restore. BUG=75814 TEST=SessionStartupPrefTest.*, and manual testing of WebUI: clean prefs, Launch Chrome, toggle "System Preferences > General > Restore windows..." and observe effect on Chrome preferences "Basics > On Startup". Review URL: http://codereview.chromium.org/7522025 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@94605 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/prefs')
-rw-r--r--chrome/browser/prefs/session_startup_pref.cc21
1 files changed, 21 insertions, 0 deletions
diff --git a/chrome/browser/prefs/session_startup_pref.cc b/chrome/browser/prefs/session_startup_pref.cc
index 59e262f..34176a9 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(