Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(158)

Side by Side Diff: base/prefs/pref_member.cc

Issue 16797003: Make base use the proper Value namespace (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: iwarnings fixed Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "base/prefs/pref_member.h" 5 #include "base/prefs/pref_member.h"
6 6
7 #include "base/bind_helpers.h" 7 #include "base/bind_helpers.h"
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/location.h" 9 #include "base/location.h"
10 #include "base/prefs/pref_service.h" 10 #include "base/prefs/pref_service.h"
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 void PrefMemberBase::Internal::MoveToThread( 128 void PrefMemberBase::Internal::MoveToThread(
129 const scoped_refptr<MessageLoopProxy>& message_loop) { 129 const scoped_refptr<MessageLoopProxy>& message_loop) {
130 CheckOnCorrectThread(); 130 CheckOnCorrectThread();
131 thread_loop_ = message_loop; 131 thread_loop_ = message_loop;
132 } 132 }
133 133
134 bool PrefMemberVectorStringUpdate(const base::Value& value, 134 bool PrefMemberVectorStringUpdate(const base::Value& value,
135 std::vector<std::string>* string_vector) { 135 std::vector<std::string>* string_vector) {
136 if (!value.IsType(base::Value::TYPE_LIST)) 136 if (!value.IsType(base::Value::TYPE_LIST))
137 return false; 137 return false;
138 const ListValue* list = static_cast<const ListValue*>(&value); 138 const base::ListValue* list = static_cast<const base::ListValue*>(&value);
139 139
140 std::vector<std::string> local_vector; 140 std::vector<std::string> local_vector;
141 for (ListValue::const_iterator it = list->begin(); it != list->end(); ++it) { 141 for (base::ListValue::const_iterator it = list->begin();
142 it != list->end(); ++it) {
142 std::string string_value; 143 std::string string_value;
143 if (!(*it)->GetAsString(&string_value)) 144 if (!(*it)->GetAsString(&string_value))
144 return false; 145 return false;
145 146
146 local_vector.push_back(string_value); 147 local_vector.push_back(string_value);
147 } 148 }
148 149
149 string_vector->swap(local_vector); 150 string_vector->swap(local_vector);
150 return true; 151 return true;
151 } 152 }
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 template <> 206 template <>
206 bool PrefMember<base::FilePath>::Internal::UpdateValueInternal( 207 bool PrefMember<base::FilePath>::Internal::UpdateValueInternal(
207 const base::Value& value) 208 const base::Value& value)
208 const { 209 const {
209 return base::GetValueAsFilePath(value, &value_); 210 return base::GetValueAsFilePath(value, &value_);
210 } 211 }
211 212
212 template <> 213 template <>
213 void PrefMember<std::vector<std::string> >::UpdatePref( 214 void PrefMember<std::vector<std::string> >::UpdatePref(
214 const std::vector<std::string>& value) { 215 const std::vector<std::string>& value) {
215 ListValue list_value; 216 base::ListValue list_value;
216 list_value.AppendStrings(value); 217 list_value.AppendStrings(value);
217 prefs()->Set(pref_name().c_str(), list_value); 218 prefs()->Set(pref_name().c_str(), list_value);
218 } 219 }
219 220
220 template <> 221 template <>
221 bool PrefMember<std::vector<std::string> >::Internal::UpdateValueInternal( 222 bool PrefMember<std::vector<std::string> >::Internal::UpdateValueInternal(
222 const base::Value& value) const { 223 const base::Value& value) const {
223 return subtle::PrefMemberVectorStringUpdate(value, &value_); 224 return subtle::PrefMemberVectorStringUpdate(value, &value_);
224 } 225 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698