| OLD | NEW |
| 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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 static const char* strings[] = { | 114 static const char* strings[] = { |
| 115 "null", | 115 "null", |
| 116 "boolean", | 116 "boolean", |
| 117 "integer", | 117 "integer", |
| 118 "double", | 118 "double", |
| 119 "string", | 119 "string", |
| 120 "binary", | 120 "binary", |
| 121 "dictionary", | 121 "dictionary", |
| 122 "list" | 122 "list" |
| 123 }; | 123 }; |
| 124 DCHECK(static_cast<size_t>(type) < arraysize(strings)); | 124 CHECK(static_cast<size_t>(type) < arraysize(strings)); |
| 125 return std::string(strings[type]); | 125 return std::string(strings[type]); |
| 126 } | 126 } |
| 127 | 127 |
| 128 // Utility function that returns a JSON representation of the given |dict| as | 128 // Utility function that returns a JSON representation of the given |dict| as |
| 129 // a StringValue. The caller owns the returned object. | 129 // a StringValue. The caller owns the returned object. |
| 130 base::StringValue* DictionaryToJSONString(const base::DictionaryValue* dict) { | 130 base::StringValue* DictionaryToJSONString(const base::DictionaryValue* dict) { |
| 131 std::string json_string; | 131 std::string json_string; |
| 132 base::JSONWriter::WriteWithOptions( | 132 base::JSONWriter::WriteWithOptions( |
| 133 dict, | 133 dict, |
| 134 base::JSONWriter::OPTIONS_DO_NOT_ESCAPE | | 134 base::JSONWriter::OPTIONS_DO_NOT_ESCAPE | |
| (...skipping 1226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1361 errors->AddError(policy_name(), | 1361 errors->AddError(policy_name(), |
| 1362 IDS_POLICY_OUT_OF_RANGE_ERROR, | 1362 IDS_POLICY_OUT_OF_RANGE_ERROR, |
| 1363 base::IntToString(restore_value)); | 1363 base::IntToString(restore_value)); |
| 1364 } | 1364 } |
| 1365 } | 1365 } |
| 1366 } | 1366 } |
| 1367 return true; | 1367 return true; |
| 1368 } | 1368 } |
| 1369 | 1369 |
| 1370 } // namespace policy | 1370 } // namespace policy |
| OLD | NEW |