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

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

Issue 390233003: Decrement CreateDoubleValue count (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 }
85 break; 85 break;
86 } 86 }
87 case base::Value::TYPE_DOUBLE: { 87 case base::Value::TYPE_DOUBLE: {
88 // Doubles may be string-encoded or integer-encoded. 88 // Doubles may be string-encoded or integer-encoded.
89 double double_value = 0; 89 double double_value = 0;
90 if (value.GetAsInteger(&int_value)) { 90 if (value.GetAsInteger(&int_value)) {
91 return scoped_ptr<base::Value>( 91 return scoped_ptr<base::Value>(
92 base::Value::CreateDoubleValue(int_value)); 92 new base::FundamentalValue(int_value));
battre 2014/07/16 07:37:12 Do you want to cast to double here? Otherwise you
bartfab (slow) 2014/07/16 09:07:55 Yes, you definitely want to cast. Otherwise, the p
battre 2014/07/16 09:53:20 Maybe that is an indication that going for an over
Evan Stade 2014/07/16 22:15:25 Equally, I think it's an indication that this code
93 } else if (value.GetAsString(&string_value) && 93 } else if (value.GetAsString(&string_value) &&
94 base::StringToDouble(string_value, &double_value)) { 94 base::StringToDouble(string_value, &double_value)) {
95 return scoped_ptr<base::Value>( 95 return scoped_ptr<base::Value>(
96 base::Value::CreateDoubleValue(double_value)); 96 new base::FundamentalValue(double_value));
97 } 97 }
98 break; 98 break;
99 } 99 }
100 case base::Value::TYPE_LIST: { 100 case base::Value::TYPE_LIST: {
101 // Lists are encoded as subkeys with numbered value in the registry. 101 // Lists are encoded as subkeys with numbered value in the registry.
102 const base::DictionaryValue* dict = NULL; 102 const base::DictionaryValue* dict = NULL;
103 if (value.GetAsDictionary(&dict)) { 103 if (value.GetAsDictionary(&dict)) {
104 scoped_ptr<base::ListValue> result(new base::ListValue()); 104 scoped_ptr<base::ListValue> result(new base::ListValue());
105 for (int i = 1; ; ++i) { 105 for (int i = 1; ; ++i) {
106 const base::Value* entry = NULL; 106 const base::Value* entry = NULL;
(...skipping 237 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

Powered by Google App Engine
This is Rietveld 408576698