| OLD | NEW |
| 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 <cstdio> | 5 #include <cstdio> |
| 6 #include <iostream> | 6 #include <iostream> |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 " %i File couldn't be read or is not a valid JSON dictionary.\n" | 76 " %i File couldn't be read or is not a valid JSON dictionary.\n" |
| 77 " %i Some command line arguments are wrong.\n", | 77 " %i Some command line arguments are wrong.\n", |
| 78 kStatusValid, | 78 kStatusValid, |
| 79 kStatusWarnings, | 79 kStatusWarnings, |
| 80 kStatusInvalid, | 80 kStatusInvalid, |
| 81 kStatusJsonError, | 81 kStatusJsonError, |
| 82 kStatusArgumentError); | 82 kStatusArgumentError); |
| 83 } | 83 } |
| 84 | 84 |
| 85 scoped_ptr<base::DictionaryValue> ReadDictionary(std::string filename) { | 85 scoped_ptr<base::DictionaryValue> ReadDictionary(std::string filename) { |
| 86 FilePath path(filename); | 86 base::FilePath path(filename); |
| 87 JSONFileValueSerializer serializer(path); | 87 JSONFileValueSerializer serializer(path); |
| 88 serializer.set_allow_trailing_comma(true); | 88 serializer.set_allow_trailing_comma(true); |
| 89 | 89 |
| 90 base::DictionaryValue* dict = NULL; | 90 base::DictionaryValue* dict = NULL; |
| 91 | 91 |
| 92 std::string json_error; | 92 std::string json_error; |
| 93 base::Value* value = serializer.Deserialize(NULL, &json_error); | 93 base::Value* value = serializer.Deserialize(NULL, &json_error); |
| 94 if (!value) { | 94 if (!value) { |
| 95 LOG(ERROR) << "Couldn't json-deserialize file '" << filename | 95 LOG(ERROR) << "Couldn't json-deserialize file '" << filename |
| 96 << "': " << json_error; | 96 << "': " << json_error; |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 case chromeos::onc::Validator::VALID: | 154 case chromeos::onc::Validator::VALID: |
| 155 return kStatusValid; | 155 return kStatusValid; |
| 156 case chromeos::onc::Validator::VALID_WITH_WARNINGS: | 156 case chromeos::onc::Validator::VALID_WITH_WARNINGS: |
| 157 return kStatusWarnings; | 157 return kStatusWarnings; |
| 158 case chromeos::onc::Validator::INVALID: | 158 case chromeos::onc::Validator::INVALID: |
| 159 return kStatusInvalid; | 159 return kStatusInvalid; |
| 160 default: | 160 default: |
| 161 CHECK(false); | 161 CHECK(false); |
| 162 } | 162 } |
| 163 } | 163 } |
| OLD | NEW |