| 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/diagnostics/recon_diagnostics.h" | 5 #include "chrome/browser/diagnostics/recon_diagnostics.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
| 10 #include "base/json/json_reader.h" | 10 #include "base/json/json_reader.h" |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 return true; | 203 return true; |
| 204 } | 204 } |
| 205 // Being small enough, we can process it in-memory. | 205 // Being small enough, we can process it in-memory. |
| 206 std::string json_data; | 206 std::string json_data; |
| 207 if (!base::ReadFileToString(path_, &json_data)) { | 207 if (!base::ReadFileToString(path_, &json_data)) { |
| 208 RecordFailure(DIAG_RECON_UNABLE_TO_OPEN_FILE, | 208 RecordFailure(DIAG_RECON_UNABLE_TO_OPEN_FILE, |
| 209 "Could not open file. Possibly locked by another process"); | 209 "Could not open file. Possibly locked by another process"); |
| 210 return true; | 210 return true; |
| 211 } | 211 } |
| 212 | 212 |
| 213 JSONStringValueSerializer json(json_data); | 213 JSONStringValueDeserializer json(json_data); |
| 214 int error_code = base::JSONReader::JSON_NO_ERROR; | 214 int error_code = base::JSONReader::JSON_NO_ERROR; |
| 215 std::string error_message; | 215 std::string error_message; |
| 216 scoped_ptr<base::Value> json_root( | 216 scoped_ptr<base::Value> json_root( |
| 217 json.Deserialize(&error_code, &error_message)); | 217 json.Deserialize(&error_code, &error_message)); |
| 218 if (base::JSONReader::JSON_NO_ERROR != error_code) { | 218 if (base::JSONReader::JSON_NO_ERROR != error_code) { |
| 219 if (error_message.empty()) { | 219 if (error_message.empty()) { |
| 220 error_message = "Parse error " + base::IntToString(error_code); | 220 error_message = "Parse error " + base::IntToString(error_code); |
| 221 } | 221 } |
| 222 RecordFailure(DIAG_RECON_PARSE_ERROR, error_message); | 222 RecordFailure(DIAG_RECON_PARSE_ERROR, error_message); |
| 223 return true; | 223 return true; |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 428 | 428 |
| 429 DiagnosticsTest* MakeResourcesFileTest() { | 429 DiagnosticsTest* MakeResourcesFileTest() { |
| 430 return new PathTest(kPathsToTest[2]); | 430 return new PathTest(kPathsToTest[2]); |
| 431 } | 431 } |
| 432 | 432 |
| 433 DiagnosticsTest* MakeUserDirTest() { return new PathTest(kPathsToTest[3]); } | 433 DiagnosticsTest* MakeUserDirTest() { return new PathTest(kPathsToTest[3]); } |
| 434 | 434 |
| 435 DiagnosticsTest* MakeVersionTest() { return new VersionTest(); } | 435 DiagnosticsTest* MakeVersionTest() { return new VersionTest(); } |
| 436 | 436 |
| 437 } // namespace diagnostics | 437 } // namespace diagnostics |
| OLD | NEW |