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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 if (!SessionStartupPref::URLsAreManaged(prefs)) { | 83 if (!SessionStartupPref::URLsAreManaged(prefs)) { |
84 // Always save the URLs, that way the UI can remain consistent even if the | 84 // Always save the URLs, that way the UI can remain consistent even if the |
85 // user changes the startup type pref. | 85 // user changes the startup type pref. |
86 // Ownership of the ListValue retains with the pref service. | 86 // Ownership of the ListValue retains with the pref service. |
87 ListPrefUpdate update(prefs, prefs::kURLsToRestoreOnStartup); | 87 ListPrefUpdate update(prefs, prefs::kURLsToRestoreOnStartup); |
88 base::ListValue* url_pref_list = update.Get(); | 88 base::ListValue* url_pref_list = update.Get(); |
89 DCHECK(url_pref_list); | 89 DCHECK(url_pref_list); |
90 url_pref_list->Clear(); | 90 url_pref_list->Clear(); |
91 for (size_t i = 0; i < pref.urls.size(); ++i) { | 91 for (size_t i = 0; i < pref.urls.size(); ++i) { |
92 url_pref_list->Set(static_cast<int>(i), | 92 url_pref_list->Set(static_cast<int>(i), |
93 new base::StringValue(pref.urls[i].spec())); | 93 new base::Value(pref.urls[i].spec())); |
94 } | 94 } |
95 } | 95 } |
96 } | 96 } |
97 | 97 |
98 // static | 98 // static |
99 SessionStartupPref SessionStartupPref::GetStartupPref(Profile* profile) { | 99 SessionStartupPref SessionStartupPref::GetStartupPref(Profile* profile) { |
100 DCHECK(profile); | 100 DCHECK(profile); |
101 return GetStartupPref(profile->GetPrefs()); | 101 return GetStartupPref(profile->GetPrefs()); |
102 } | 102 } |
103 | 103 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 default: return SessionStartupPref::DEFAULT; | 152 default: return SessionStartupPref::DEFAULT; |
153 } | 153 } |
154 } | 154 } |
155 | 155 |
156 SessionStartupPref::SessionStartupPref(Type type) : type(type) {} | 156 SessionStartupPref::SessionStartupPref(Type type) : type(type) {} |
157 | 157 |
158 SessionStartupPref::SessionStartupPref(const SessionStartupPref& other) = | 158 SessionStartupPref::SessionStartupPref(const SessionStartupPref& other) = |
159 default; | 159 default; |
160 | 160 |
161 SessionStartupPref::~SessionStartupPref() {} | 161 SessionStartupPref::~SessionStartupPref() {} |
OLD | NEW |