| 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/values.h" | 9 #include "base/values.h" |
| 10 #include "base/version.h" | 10 #include "base/version.h" |
| 11 #include "chrome/browser/net/url_fixer_upper.h" | 11 #include "chrome/browser/net/url_fixer_upper.h" |
| 12 #include "chrome/browser/prefs/pref_registry_syncable.h" |
| 12 #include "chrome/browser/prefs/pref_service.h" | 13 #include "chrome/browser/prefs/pref_service.h" |
| 13 #include "chrome/browser/prefs/scoped_user_pref_update.h" | 14 #include "chrome/browser/prefs/scoped_user_pref_update.h" |
| 14 #include "chrome/browser/profiles/profile.h" | 15 #include "chrome/browser/profiles/profile.h" |
| 15 #include "chrome/common/pref_names.h" | 16 #include "chrome/common/pref_names.h" |
| 16 | 17 |
| 17 #if defined(OS_MACOSX) | 18 #if defined(OS_MACOSX) |
| 18 #include "chrome/browser/ui/cocoa/window_restore_utils.h" | 19 #include "chrome/browser/ui/cocoa/window_restore_utils.h" |
| 19 #endif | 20 #endif |
| 20 | 21 |
| 21 namespace { | 22 namespace { |
| (...skipping 24 matching lines...) Expand all Loading... |
| 46 if (url_list->GetString(i, &url_text)) { | 47 if (url_list->GetString(i, &url_text)) { |
| 47 GURL fixed_url = URLFixerUpper::FixupURL(url_text, ""); | 48 GURL fixed_url = URLFixerUpper::FixupURL(url_text, ""); |
| 48 pref->urls.push_back(fixed_url); | 49 pref->urls.push_back(fixed_url); |
| 49 } | 50 } |
| 50 } | 51 } |
| 51 } | 52 } |
| 52 | 53 |
| 53 } // namespace | 54 } // namespace |
| 54 | 55 |
| 55 // static | 56 // static |
| 56 void SessionStartupPref::RegisterUserPrefs(PrefServiceSyncable* prefs) { | 57 void SessionStartupPref::RegisterUserPrefs(PrefRegistrySyncable* registry) { |
| 57 prefs->RegisterIntegerPref(prefs::kRestoreOnStartup, | 58 registry->RegisterIntegerPref(prefs::kRestoreOnStartup, |
| 58 TypeToPrefValue(GetDefaultStartupType()), | 59 TypeToPrefValue(GetDefaultStartupType()), |
| 59 PrefServiceSyncable::SYNCABLE_PREF); | 60 PrefRegistrySyncable::SYNCABLE_PREF); |
| 60 prefs->RegisterListPref(prefs::kURLsToRestoreOnStartup, | 61 registry->RegisterListPref(prefs::kURLsToRestoreOnStartup, |
| 61 PrefServiceSyncable::SYNCABLE_PREF); | 62 PrefRegistrySyncable::SYNCABLE_PREF); |
| 62 prefs->RegisterBooleanPref(prefs::kRestoreOnStartupMigrated, | 63 registry->RegisterBooleanPref(prefs::kRestoreOnStartupMigrated, |
| 63 false, | 64 false, |
| 64 PrefServiceSyncable::UNSYNCABLE_PREF); | 65 PrefRegistrySyncable::UNSYNCABLE_PREF); |
| 65 } | 66 } |
| 66 | 67 |
| 67 // static | 68 // static |
| 68 SessionStartupPref::Type SessionStartupPref::GetDefaultStartupType() { | 69 SessionStartupPref::Type SessionStartupPref::GetDefaultStartupType() { |
| 69 #if defined(OS_CHROMEOS) | 70 #if defined(OS_CHROMEOS) |
| 70 return SessionStartupPref::LAST; | 71 return SessionStartupPref::LAST; |
| 71 #else | 72 #else |
| 72 return SessionStartupPref::DEFAULT; | 73 return SessionStartupPref::DEFAULT; |
| 73 #endif | 74 #endif |
| 74 } | 75 } |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 case kPrefValueLast: return SessionStartupPref::LAST; | 226 case kPrefValueLast: return SessionStartupPref::LAST; |
| 226 case kPrefValueURLs: return SessionStartupPref::URLS; | 227 case kPrefValueURLs: return SessionStartupPref::URLS; |
| 227 case kPrefValueHomePage: return SessionStartupPref::HOMEPAGE; | 228 case kPrefValueHomePage: return SessionStartupPref::HOMEPAGE; |
| 228 default: return SessionStartupPref::DEFAULT; | 229 default: return SessionStartupPref::DEFAULT; |
| 229 } | 230 } |
| 230 } | 231 } |
| 231 | 232 |
| 232 SessionStartupPref::SessionStartupPref(Type type) : type(type) {} | 233 SessionStartupPref::SessionStartupPref(Type type) : type(type) {} |
| 233 | 234 |
| 234 SessionStartupPref::~SessionStartupPref() {} | 235 SessionStartupPref::~SessionStartupPref() {} |
| OLD | NEW |