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

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

Issue 399433005: Extirpate CreateBooleanValue. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: s/boolean/bool Created 6 years, 5 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
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()).Pass(); 66 return make_scoped_ptr(base::Value::CreateNullValue()).Pass();
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 scoped_ptr<base::Value>( 73 return scoped_ptr<base::Value>(
74 base::Value::CreateBooleanValue(int_value != 0)); 74 new base::FundamentalValue(int_value != 0));
75 } 75 }
76 break; 76 break;
77 } 77 }
78 case base::Value::TYPE_INTEGER: { 78 case base::Value::TYPE_INTEGER: {
79 // Integers may be string-encoded. 79 // Integers may be string-encoded.
80 if (value.GetAsString(&string_value) && 80 if (value.GetAsString(&string_value) &&
81 base::StringToInt(string_value, &int_value)) { 81 base::StringToInt(string_value, &int_value)) {
82 return scoped_ptr<base::Value>( 82 return scoped_ptr<base::Value>(
83 base::Value::CreateIntegerValue(int_value)); 83 base::Value::CreateIntegerValue(int_value));
84 } 84 }
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 return result.PassAs<base::Value>(); 344 return result.PassAs<base::Value>();
345 } 345 }
346 default: 346 default:
347 LOG(WARNING) << "Can't convert registry key to schema type " << type; 347 LOG(WARNING) << "Can't convert registry key to schema type " << type;
348 } 348 }
349 349
350 return scoped_ptr<base::Value>(); 350 return scoped_ptr<base::Value>();
351 } 351 }
352 352
353 } // namespace policy 353 } // namespace policy
OLDNEW
« no previous file with comments | « components/policy/core/common/mac_util.cc ('k') | components/policy/tools/generate_policy_source.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698