| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/prefs/session_startup_pref.h" | 5 #include "chrome/browser/prefs/session_startup_pref.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
| 10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 #if defined(OS_MACOSX) | 249 #if defined(OS_MACOSX) |
| 250 DCHECK(prefs); | 250 DCHECK(prefs); |
| 251 if (!restore_utils::IsWindowRestoreEnabled()) | 251 if (!restore_utils::IsWindowRestoreEnabled()) |
| 252 return; | 252 return; |
| 253 // The default startup pref used to be LAST, now it is DEFAULT. Don't change | 253 // The default startup pref used to be LAST, now it is DEFAULT. Don't change |
| 254 // the setting for existing profiles (even if the user has never changed it), | 254 // the setting for existing profiles (even if the user has never changed it), |
| 255 // but make new profiles default to DEFAULT. | 255 // but make new profiles default to DEFAULT. |
| 256 bool old_profile_version = | 256 bool old_profile_version = |
| 257 !prefs->FindPreference( | 257 !prefs->FindPreference( |
| 258 prefs::kProfileCreatedByVersion)->IsDefaultValue() && | 258 prefs::kProfileCreatedByVersion)->IsDefaultValue() && |
| 259 base::Version(prefs->GetString(prefs::kProfileCreatedByVersion)). | 259 Version(prefs->GetString(prefs::kProfileCreatedByVersion)).IsOlderThan( |
| 260 IsOlderThan("21.0.1180.0"); | 260 "21.0.1180.0"); |
| 261 if (old_profile_version && TypeIsDefault(prefs)) | 261 if (old_profile_version && TypeIsDefault(prefs)) |
| 262 prefs->SetInteger(prefs::kRestoreOnStartup, kPrefValueLast); | 262 prefs->SetInteger(prefs::kRestoreOnStartup, kPrefValueLast); |
| 263 #endif | 263 #endif |
| 264 } | 264 } |
| 265 | 265 |
| 266 // static | 266 // static |
| 267 bool SessionStartupPref::TypeIsManaged(PrefService* prefs) { | 267 bool SessionStartupPref::TypeIsManaged(PrefService* prefs) { |
| 268 DCHECK(prefs); | 268 DCHECK(prefs); |
| 269 const PrefService::Preference* pref_restore = | 269 const PrefService::Preference* pref_restore = |
| 270 prefs->FindPreference(prefs::kRestoreOnStartup); | 270 prefs->FindPreference(prefs::kRestoreOnStartup); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 296 case kPrefValueLast: return SessionStartupPref::LAST; | 296 case kPrefValueLast: return SessionStartupPref::LAST; |
| 297 case kPrefValueURLs: return SessionStartupPref::URLS; | 297 case kPrefValueURLs: return SessionStartupPref::URLS; |
| 298 case kPrefValueHomePage: return SessionStartupPref::HOMEPAGE; | 298 case kPrefValueHomePage: return SessionStartupPref::HOMEPAGE; |
| 299 default: return SessionStartupPref::DEFAULT; | 299 default: return SessionStartupPref::DEFAULT; |
| 300 } | 300 } |
| 301 } | 301 } |
| 302 | 302 |
| 303 SessionStartupPref::SessionStartupPref(Type type) : type(type) {} | 303 SessionStartupPref::SessionStartupPref(Type type) : type(type) {} |
| 304 | 304 |
| 305 SessionStartupPref::~SessionStartupPref() {} | 305 SessionStartupPref::~SessionStartupPref() {} |
| OLD | NEW |