Chromium Code Reviews| 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( |