| 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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 static const char* strings[] = { | 116 static const char* strings[] = { |
| 117 "null", | 117 "null", |
| 118 "boolean", | 118 "boolean", |
| 119 "integer", | 119 "integer", |
| 120 "double", | 120 "double", |
| 121 "string", | 121 "string", |
| 122 "binary", | 122 "binary", |
| 123 "dictionary", | 123 "dictionary", |
| 124 "list" | 124 "list" |
| 125 }; | 125 }; |
| 126 DCHECK(static_cast<size_t>(type) < arraysize(strings)); | 126 CHECK(static_cast<size_t>(type) < arraysize(strings)); |
| 127 return std::string(strings[type]); | 127 return std::string(strings[type]); |
| 128 } | 128 } |
| 129 | 129 |
| 130 // Utility function that returns a JSON representation of the given |dict| as | 130 // Utility function that returns a JSON representation of the given |dict| as |
| 131 // a StringValue. The caller owns the returned object. | 131 // a StringValue. The caller owns the returned object. |
| 132 base::StringValue* DictionaryToJSONString(const base::DictionaryValue* dict) { | 132 base::StringValue* DictionaryToJSONString(const base::DictionaryValue* dict) { |
| 133 std::string json_string; | 133 std::string json_string; |
| 134 base::JSONWriter::WriteWithOptions( | 134 base::JSONWriter::WriteWithOptions( |
| 135 dict, | 135 dict, |
| 136 base::JSONWriter::OPTIONS_DO_NOT_ESCAPE | | 136 base::JSONWriter::OPTIONS_DO_NOT_ESCAPE | |
| (...skipping 1317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1454 errors->AddError(policy_name(), | 1454 errors->AddError(policy_name(), |
| 1455 IDS_POLICY_OUT_OF_RANGE_ERROR, | 1455 IDS_POLICY_OUT_OF_RANGE_ERROR, |
| 1456 base::IntToString(restore_value)); | 1456 base::IntToString(restore_value)); |
| 1457 } | 1457 } |
| 1458 } | 1458 } |
| 1459 } | 1459 } |
| 1460 return true; | 1460 return true; |
| 1461 } | 1461 } |
| 1462 | 1462 |
| 1463 } // namespace policy | 1463 } // namespace policy |
| OLD | NEW |