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

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

Issue 9590002: JSONWriter cleanup: integrate pretty print into write options. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix merge conflict 7. Created 8 years, 9 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.h" 5 #include "chrome/browser/policy/configuration_policy_handler.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/file_path.h" 9 #include "base/file_path.h"
10 #include "base/json/json_writer.h" 10 #include "base/json/json_writer.h"
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 PolicyMap* policies) const { 157 PolicyMap* policies) const {
158 // jstemplate can't render DictionaryValues/objects. Convert those values to 158 // jstemplate can't render DictionaryValues/objects. Convert those values to
159 // a string representation. 159 // a string representation.
160 for (PolicyMap::const_iterator it = policies->begin(); 160 for (PolicyMap::const_iterator it = policies->begin();
161 it != policies->end(); ++it) { 161 it != policies->end(); ++it) {
162 const PolicyMap::Entry& entry = it->second; 162 const PolicyMap::Entry& entry = it->second;
163 DictionaryValue* value; 163 DictionaryValue* value;
164 if (entry.value->GetAsDictionary(&value)) { 164 if (entry.value->GetAsDictionary(&value)) {
165 std::string json_string; 165 std::string json_string;
166 base::JSONWriter::WriteWithOptions( 166 base::JSONWriter::WriteWithOptions(
167 value, true, base::JSONWriter::OPTIONS_DO_NOT_ESCAPE, &json_string); 167 value,
168 base::JSONWriter::OPTIONS_DO_NOT_ESCAPE |
169 base::JSONWriter::OPTIONS_PRETTY_PRINT,
170 &json_string);
168 StringValue* string_value = Value::CreateStringValue(json_string); 171 StringValue* string_value = Value::CreateStringValue(json_string);
169 policies->Set(it->first, entry.level, entry.scope, string_value); 172 policies->Set(it->first, entry.level, entry.scope, string_value);
170 } 173 }
171 } 174 }
172 } 175 }
173 176
174 177
175 // TypeCheckingPolicyHandler implementation ------------------------------------ 178 // TypeCheckingPolicyHandler implementation ------------------------------------
176 179
177 TypeCheckingPolicyHandler::TypeCheckingPolicyHandler( 180 TypeCheckingPolicyHandler::TypeCheckingPolicyHandler(
(...skipping 837 matching lines...) Expand 10 before | Expand all | Expand 10 after
1015 errors->AddError(key::kClearSiteDataOnExit, 1018 errors->AddError(key::kClearSiteDataOnExit,
1016 IDS_POLICY_OVERRIDDEN, 1019 IDS_POLICY_OVERRIDDEN,
1017 key::kRestoreOnStartup); 1020 key::kRestoreOnStartup);
1018 } 1021 }
1019 } 1022 }
1020 } 1023 }
1021 return true; 1024 return true;
1022 } 1025 }
1023 1026
1024 } // namespace policy 1027 } // namespace policy
OLDNEW
« no previous file with comments | « chrome/browser/net/net_log_logger.cc ('k') | chrome/browser/policy/configuration_policy_handler_chromeos.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698