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 27 matching lines...) Expand all Loading... |
38 new_url_pref_list.Append(home_page); | 38 new_url_pref_list.Append(home_page); |
39 prefs->Set(prefs::kURLsToRestoreOnStartup, new_url_pref_list); | 39 prefs->Set(prefs::kURLsToRestoreOnStartup, new_url_pref_list); |
40 } | 40 } |
41 } | 41 } |
42 | 42 |
43 void URLListToPref(const base::ListValue* url_list, SessionStartupPref* pref) { | 43 void URLListToPref(const base::ListValue* url_list, SessionStartupPref* pref) { |
44 pref->urls.clear(); | 44 pref->urls.clear(); |
45 for (size_t i = 0; i < url_list->GetSize(); ++i) { | 45 for (size_t i = 0; i < url_list->GetSize(); ++i) { |
46 std::string url_text; | 46 std::string url_text; |
47 if (url_list->GetString(i, &url_text)) { | 47 if (url_list->GetString(i, &url_text)) { |
48 GURL fixed_url = URLFixerUpper::FixupURL(url_text, ""); | 48 GURL fixed_url = URLFixerUpper::FixupURL(url_text, std::string()); |
49 pref->urls.push_back(fixed_url); | 49 pref->urls.push_back(fixed_url); |
50 } | 50 } |
51 } | 51 } |
52 } | 52 } |
53 | 53 |
54 } // namespace | 54 } // namespace |
55 | 55 |
56 // static | 56 // static |
57 void SessionStartupPref::RegisterUserPrefs(PrefRegistrySyncable* registry) { | 57 void SessionStartupPref::RegisterUserPrefs(PrefRegistrySyncable* registry) { |
58 registry->RegisterIntegerPref(prefs::kRestoreOnStartup, | 58 registry->RegisterIntegerPref(prefs::kRestoreOnStartup, |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 case kPrefValueLast: return SessionStartupPref::LAST; | 229 case kPrefValueLast: return SessionStartupPref::LAST; |
230 case kPrefValueURLs: return SessionStartupPref::URLS; | 230 case kPrefValueURLs: return SessionStartupPref::URLS; |
231 case kPrefValueHomePage: return SessionStartupPref::HOMEPAGE; | 231 case kPrefValueHomePage: return SessionStartupPref::HOMEPAGE; |
232 default: return SessionStartupPref::DEFAULT; | 232 default: return SessionStartupPref::DEFAULT; |
233 } | 233 } |
234 } | 234 } |
235 | 235 |
236 SessionStartupPref::SessionStartupPref(Type type) : type(type) {} | 236 SessionStartupPref::SessionStartupPref(Type type) : type(type) {} |
237 | 237 |
238 SessionStartupPref::~SessionStartupPref() {} | 238 SessionStartupPref::~SessionStartupPref() {} |
OLD | NEW |