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/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 | 179 |
180 // static | 180 // static |
181 void SessionStartupPref::MigrateMacDefaultPrefIfNecessary(PrefService* prefs) { | 181 void SessionStartupPref::MigrateMacDefaultPrefIfNecessary(PrefService* prefs) { |
182 #if defined(OS_MACOSX) | 182 #if defined(OS_MACOSX) |
183 DCHECK(prefs); | 183 DCHECK(prefs); |
184 if (!restore_utils::IsWindowRestoreEnabled()) | 184 if (!restore_utils::IsWindowRestoreEnabled()) |
185 return; | 185 return; |
186 // The default startup pref used to be LAST, now it is DEFAULT. Don't change | 186 // The default startup pref used to be LAST, now it is DEFAULT. Don't change |
187 // the setting for existing profiles (even if the user has never changed it), | 187 // the setting for existing profiles (even if the user has never changed it), |
188 // but make new profiles default to DEFAULT. | 188 // but make new profiles default to DEFAULT. |
189 bool old_profile_version = Version(prefs->GetString( | 189 bool old_profile_version = |
190 prefs::kProfileCreatedByVersion)).IsOlderThan("21.0.1180.0"); | 190 !prefs->FindPreference( |
| 191 prefs::kProfileCreatedByVersion)->IsDefaultValue() && |
| 192 Version(prefs->GetString(prefs::kProfileCreatedByVersion)).IsOlderThan( |
| 193 "21.0.1180.0"); |
191 if (old_profile_version && TypeIsDefault(prefs)) | 194 if (old_profile_version && TypeIsDefault(prefs)) |
192 prefs->SetInteger(prefs::kRestoreOnStartup, kPrefValueLast); | 195 prefs->SetInteger(prefs::kRestoreOnStartup, kPrefValueLast); |
193 #endif | 196 #endif |
194 } | 197 } |
195 | 198 |
196 // static | 199 // static |
197 bool SessionStartupPref::TypeIsManaged(PrefService* prefs) { | 200 bool SessionStartupPref::TypeIsManaged(PrefService* prefs) { |
198 DCHECK(prefs); | 201 DCHECK(prefs); |
199 const PrefService::Preference* pref_restore = | 202 const PrefService::Preference* pref_restore = |
200 prefs->FindPreference(prefs::kRestoreOnStartup); | 203 prefs->FindPreference(prefs::kRestoreOnStartup); |
(...skipping 25 matching lines...) Expand all Loading... |
226 case kPrefValueLast: return SessionStartupPref::LAST; | 229 case kPrefValueLast: return SessionStartupPref::LAST; |
227 case kPrefValueURLs: return SessionStartupPref::URLS; | 230 case kPrefValueURLs: return SessionStartupPref::URLS; |
228 case kPrefValueHomePage: return SessionStartupPref::HOMEPAGE; | 231 case kPrefValueHomePage: return SessionStartupPref::HOMEPAGE; |
229 default: return SessionStartupPref::DEFAULT; | 232 default: return SessionStartupPref::DEFAULT; |
230 } | 233 } |
231 } | 234 } |
232 | 235 |
233 SessionStartupPref::SessionStartupPref(Type type) : type(type) {} | 236 SessionStartupPref::SessionStartupPref(Type type) : type(type) {} |
234 | 237 |
235 SessionStartupPref::~SessionStartupPref() {} | 238 SessionStartupPref::~SessionStartupPref() {} |
OLD | NEW |