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

Side by Side Diff: components/policy/core/common/registry_dict_win.cc

Issue 108603005: Update uses of Value in chromeos/, cloud_print/, components/, content/ to use the base:: namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 12 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "components/policy/core/common/registry_dict_win.h" 5 #include "components/policy/core/common/registry_dict_win.h"
6 6
7 #include "base/json/json_reader.h" 7 #include "base/json/json_reader.h"
8 #include "base/stl_util.h" 8 #include "base/stl_util.h"
9 #include "base/strings/string_number_conversions.h" 9 #include "base/strings/string_number_conversions.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 int int_value = 0; 63 int int_value = 0;
64 switch (schema.type()) { 64 switch (schema.type()) {
65 case base::Value::TYPE_NULL: { 65 case base::Value::TYPE_NULL: {
66 return make_scoped_ptr(base::Value::CreateNullValue()); 66 return make_scoped_ptr(base::Value::CreateNullValue());
67 } 67 }
68 case base::Value::TYPE_BOOLEAN: { 68 case base::Value::TYPE_BOOLEAN: {
69 // Accept booleans encoded as either string or integer. 69 // Accept booleans encoded as either string or integer.
70 if (value.GetAsInteger(&int_value) || 70 if (value.GetAsInteger(&int_value) ||
71 (value.GetAsString(&string_value) && 71 (value.GetAsString(&string_value) &&
72 base::StringToInt(string_value, &int_value))) { 72 base::StringToInt(string_value, &int_value))) {
73 return make_scoped_ptr(Value::CreateBooleanValue(int_value != 0)); 73 return make_scoped_ptr(base::Value::CreateBooleanValue(int_value != 0));
74 } 74 }
75 break; 75 break;
76 } 76 }
77 case base::Value::TYPE_INTEGER: { 77 case base::Value::TYPE_INTEGER: {
78 // Integers may be string-encoded. 78 // Integers may be string-encoded.
79 if (value.GetAsString(&string_value) && 79 if (value.GetAsString(&string_value) &&
80 base::StringToInt(string_value, &int_value)) { 80 base::StringToInt(string_value, &int_value)) {
81 return make_scoped_ptr(base::Value::CreateIntegerValue(int_value)); 81 return make_scoped_ptr(base::Value::CreateIntegerValue(int_value));
82 } 82 }
83 break; 83 break;
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 return entry != values_.end() ? entry->second : NULL; 191 return entry != values_.end() ? entry->second : NULL;
192 } 192 }
193 193
194 void RegistryDict::SetValue(const std::string& name, 194 void RegistryDict::SetValue(const std::string& name,
195 scoped_ptr<base::Value> dict) { 195 scoped_ptr<base::Value> dict) {
196 if (!dict) { 196 if (!dict) {
197 RemoveValue(name); 197 RemoveValue(name);
198 return; 198 return;
199 } 199 }
200 200
201 Value*& entry = values_[name]; 201 base::Value*& entry = values_[name];
202 delete entry; 202 delete entry;
203 entry = dict.release(); 203 entry = dict.release();
204 } 204 }
205 205
206 scoped_ptr<base::Value> RegistryDict::RemoveValue(const std::string& name) { 206 scoped_ptr<base::Value> RegistryDict::RemoveValue(const std::string& name) {
207 scoped_ptr<base::Value> result; 207 scoped_ptr<base::Value> result;
208 ValueMap::iterator entry = values_.find(name); 208 ValueMap::iterator entry = values_.find(name);
209 if (entry != values_.end()) { 209 if (entry != values_.end()) {
210 result.reset(entry->second); 210 result.reset(entry->second);
211 values_.erase(entry); 211 values_.erase(entry);
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 return result.Pass(); 340 return result.Pass();
341 } 341 }
342 default: 342 default:
343 LOG(WARNING) << "Can't convert registry key to schema type " << type; 343 LOG(WARNING) << "Can't convert registry key to schema type " << type;
344 } 344 }
345 345
346 return scoped_ptr<base::Value>(); 346 return scoped_ptr<base::Value>();
347 } 347 }
348 348
349 } // namespace policy 349 } // namespace policy
OLDNEW
« no previous file with comments | « components/policy/core/common/policy_service.cc ('k') | components/url_matcher/url_matcher_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698