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

Side by Side Diff: chrome/browser/policy/configuration_policy_handler_chromeos.cc

Issue 9960077: Modify the base::JSONReader interface to take a set of options rather than a boolean flag. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments Created 8 years, 8 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 "chrome/browser/policy/configuration_policy_handler_chromeos.h" 5 #include "chrome/browser/policy/configuration_policy_handler_chromeos.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/json/json_reader.h" 9 #include "base/json/json_reader.h"
10 #include "base/json/json_writer.h" 10 #include "base/json/json_writer.h"
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 policies->Set(policy_name(), entry->level, entry->scope, sanitized_config); 67 policies->Set(policy_name(), entry->level, entry->scope, sanitized_config);
68 } 68 }
69 69
70 // static 70 // static
71 Value* NetworkConfigurationPolicyHandler::SanitizeNetworkConfig( 71 Value* NetworkConfigurationPolicyHandler::SanitizeNetworkConfig(
72 const Value* config) { 72 const Value* config) {
73 std::string json_string; 73 std::string json_string;
74 if (!config->GetAsString(&json_string)) 74 if (!config->GetAsString(&json_string))
75 return NULL; 75 return NULL;
76 76
77 scoped_ptr<Value> json_value(base::JSONReader::Read(json_string, true)); 77 scoped_ptr<Value> json_value(
78 base::JSONReader::Read(json_string, base::JSON_ALLOW_TRAILING_COMMAS));
78 if (!json_value.get() || !json_value->IsType(base::Value::TYPE_DICTIONARY)) 79 if (!json_value.get() || !json_value->IsType(base::Value::TYPE_DICTIONARY))
79 return NULL; 80 return NULL;
80 81
81 DictionaryValue* config_dict = 82 DictionaryValue* config_dict =
82 static_cast<DictionaryValue*>(json_value.get()); 83 static_cast<DictionaryValue*>(json_value.get());
83 84
84 // Strip any sensitive information from the JSON dictionary. 85 // Strip any sensitive information from the JSON dictionary.
85 base::ListValue* config_list = NULL; 86 base::ListValue* config_list = NULL;
86 if (config_dict->GetList("NetworkConfigurations", &config_list)) { 87 if (config_dict->GetList("NetworkConfigurations", &config_list)) {
87 for (base::ListValue::const_iterator network_entry = config_list->begin(); 88 for (base::ListValue::const_iterator network_entry = config_list->begin();
(...skipping 30 matching lines...) Expand all
118 119
119 for (size_t i = 0; i < arraysize(kFilteredSettings); ++i) { 120 for (size_t i = 0; i < arraysize(kFilteredSettings); ++i) {
120 if (network_dict->Remove(kFilteredSettings[i], NULL)) { 121 if (network_dict->Remove(kFilteredSettings[i], NULL)) {
121 network_dict->Set(kFilteredSettings[i], 122 network_dict->Set(kFilteredSettings[i],
122 Value::CreateStringValue(kPlaceholder)); 123 Value::CreateStringValue(kPlaceholder));
123 } 124 }
124 } 125 }
125 } 126 }
126 127
127 } // namespace policy 128 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698