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

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

Issue 8505033: Allow JSONWriter and JSONValueSerializer to omit binary values when instructed to do so. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix chrome\browser\policy\configuration_policy_handler_chromeos.cc Created 9 years, 1 month 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
« no previous file with comments | « chrome/browser/browser_about_handler.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 network_entry != config_list->end(); 86 network_entry != config_list->end();
87 ++network_entry) { 87 ++network_entry) {
88 if ((*network_entry) && 88 if ((*network_entry) &&
89 (*network_entry)->IsType(base::Value::TYPE_DICTIONARY)) { 89 (*network_entry)->IsType(base::Value::TYPE_DICTIONARY)) {
90 StripSensitiveValues(static_cast<DictionaryValue*>(*network_entry)); 90 StripSensitiveValues(static_cast<DictionaryValue*>(*network_entry));
91 } 91 }
92 } 92 }
93 } 93 }
94 94
95 // Convert back to a string, pretty printing the contents. 95 // Convert back to a string, pretty printing the contents.
96 base::JSONWriter::WriteWithOptionalEscape(config_dict, true, false, 96 base::JSONWriter::WriteWithOptions(config_dict, true,
97 &json_string); 97 base::JSONWriter::OPTIONS_DO_NOT_ESCAPE,
98 &json_string);
98 return Value::CreateStringValue(json_string); 99 return Value::CreateStringValue(json_string);
99 } 100 }
100 101
101 // static 102 // static
102 void NetworkConfigurationPolicyHandler::StripSensitiveValues( 103 void NetworkConfigurationPolicyHandler::StripSensitiveValues(
103 DictionaryValue* network_dict) { 104 DictionaryValue* network_dict) {
104 // List of settings we filter from the network dictionary. 105 // List of settings we filter from the network dictionary.
105 static const char* kFilteredSettings[] = { 106 static const char* kFilteredSettings[] = {
106 "WiFi.Passphrase", 107 "WiFi.Passphrase",
107 "IPsec.EAP.Password", 108 "IPsec.EAP.Password",
108 "IPsec.EAP.Password", 109 "IPsec.EAP.Password",
109 "IPsec.XAUTH.Password", 110 "IPsec.XAUTH.Password",
110 "L2TP.Password", 111 "L2TP.Password",
111 }; 112 };
112 // Placeholder to insert in place of the filtered setting. 113 // Placeholder to insert in place of the filtered setting.
113 static const char kPlaceholder[] = "********"; 114 static const char kPlaceholder[] = "********";
114 115
115 for (size_t i = 0; i < arraysize(kFilteredSettings); ++i) { 116 for (size_t i = 0; i < arraysize(kFilteredSettings); ++i) {
116 if (network_dict->Remove(kFilteredSettings[i], NULL)) { 117 if (network_dict->Remove(kFilteredSettings[i], NULL)) {
117 network_dict->Set(kFilteredSettings[i], 118 network_dict->Set(kFilteredSettings[i],
118 Value::CreateStringValue(kPlaceholder)); 119 Value::CreateStringValue(kPlaceholder));
119 } 120 }
120 } 121 }
121 } 122 }
122 123
123 } // namespace policy 124 } // namespace policy
OLDNEW
« no previous file with comments | « chrome/browser/browser_about_handler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698