| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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> |
| 8 |
| 7 #include "app/app_paths.h" | 9 #include "app/app_paths.h" |
| 8 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| 9 #include "base/file_version_info.h" | 11 #include "base/file_version_info.h" |
| 10 #include "base/json/json_reader.h" | 12 #include "base/json/json_reader.h" |
| 11 #include "base/string_util.h" | 13 #include "base/string_util.h" |
| 12 #include "base/utf_string_conversions.h" | 14 #include "base/utf_string_conversions.h" |
| 13 #include "base/sys_info.h" | 15 #include "base/sys_info.h" |
| 14 #include "base/path_service.h" | 16 #include "base/path_service.h" |
| 15 #include "chrome/app/chrome_version_info.h" | |
| 16 #include "chrome/browser/diagnostics/diagnostics_test.h" | 17 #include "chrome/browser/diagnostics/diagnostics_test.h" |
| 17 #include "chrome/browser/platform_util.h" | 18 #include "chrome/browser/platform_util.h" |
| 18 #include "chrome/common/chrome_paths.h" | 19 #include "chrome/common/chrome_paths.h" |
| 20 #include "chrome/common/chrome_version_info.h" |
| 19 #include "chrome/common/json_value_serializer.h" | 21 #include "chrome/common/json_value_serializer.h" |
| 20 | 22 |
| 21 #if defined(OS_WIN) | 23 #if defined(OS_WIN) |
| 22 #include "base/win_util.h" | 24 #include "base/win_util.h" |
| 23 #include "chrome/installer/util/install_util.h" | 25 #include "chrome/installer/util/install_util.h" |
| 24 #endif | 26 #endif |
| 25 | 27 |
| 26 // Reconnaissance diagnostics. These are the first and most critical | 28 // Reconnaissance diagnostics. These are the first and most critical |
| 27 // diagnostic tests. Here we check for the existence of critical files. | 29 // diagnostic tests. Here we check for the existence of critical files. |
| 28 // TODO(cpu): Define if it makes sense to localize strings. | 30 // TODO(cpu): Define if it makes sense to localize strings. |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 | 110 |
| 109 // Check the version of Chrome. | 111 // Check the version of Chrome. |
| 110 class VersionTest : public DiagnosticTest { | 112 class VersionTest : public DiagnosticTest { |
| 111 public: | 113 public: |
| 112 VersionTest() : DiagnosticTest(ASCIIToUTF16("Browser Version")) {} | 114 VersionTest() : DiagnosticTest(ASCIIToUTF16("Browser Version")) {} |
| 113 | 115 |
| 114 virtual int GetId() { return 0; } | 116 virtual int GetId() { return 0; } |
| 115 | 117 |
| 116 virtual bool ExecuteImpl(DiagnosticsModel::Observer* observer) { | 118 virtual bool ExecuteImpl(DiagnosticsModel::Observer* observer) { |
| 117 scoped_ptr<FileVersionInfo> version_info( | 119 scoped_ptr<FileVersionInfo> version_info( |
| 118 chrome_app::GetChromeVersionInfo()); | 120 chrome::GetChromeVersionInfo()); |
| 119 if (!version_info.get()) { | 121 if (!version_info.get()) { |
| 120 RecordFailure(ASCIIToUTF16("No Version")); | 122 RecordFailure(ASCIIToUTF16("No Version")); |
| 121 return true; | 123 return true; |
| 122 } | 124 } |
| 123 string16 current_version = WideToUTF16(version_info->file_version()); | 125 string16 current_version = WideToUTF16(version_info->file_version()); |
| 124 if (current_version.empty()) { | 126 if (current_version.empty()) { |
| 125 RecordFailure(ASCIIToUTF16("Empty Version")); | 127 RecordFailure(ASCIIToUTF16("Empty Version")); |
| 126 return true; | 128 return true; |
| 127 } | 129 } |
| 128 string16 version_modifier = platform_util::GetVersionStringModifier(); | 130 string16 version_modifier = platform_util::GetVersionStringModifier(); |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 355 path = path.Append(chrome::kBookmarksFileName); | 357 path = path.Append(chrome::kBookmarksFileName); |
| 356 return new JSONTest(path, ASCIIToUTF16("BookMarks JSON"), 2 * kOneMeg); | 358 return new JSONTest(path, ASCIIToUTF16("BookMarks JSON"), 2 * kOneMeg); |
| 357 } | 359 } |
| 358 | 360 |
| 359 DiagnosticTest* MakeLocalStateTest() { | 361 DiagnosticTest* MakeLocalStateTest() { |
| 360 FilePath path; | 362 FilePath path; |
| 361 PathService::Get(chrome::DIR_USER_DATA, &path); | 363 PathService::Get(chrome::DIR_USER_DATA, &path); |
| 362 path = path.Append(chrome::kLocalStateFilename); | 364 path = path.Append(chrome::kLocalStateFilename); |
| 363 return new JSONTest(path, ASCIIToUTF16("Local State JSON"), 50 * kOneKilo); | 365 return new JSONTest(path, ASCIIToUTF16("Local State JSON"), 50 * kOneKilo); |
| 364 } | 366 } |
| OLD | NEW |