Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1340)

Side by Side Diff: chrome/browser/diagnostics/recon_diagnostics.cc

Issue 3823002: Move windows version-related stuff out of base/win_util and into base/win/win... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 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> 7 #include <string>
8 8
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/json/json_reader.h" 10 #include "base/json/json_reader.h"
11 #include "base/string_util.h" 11 #include "base/string_util.h"
12 #include "base/string_number_conversions.h" 12 #include "base/string_number_conversions.h"
13 #include "base/utf_string_conversions.h" 13 #include "base/utf_string_conversions.h"
14 #include "base/sys_info.h" 14 #include "base/sys_info.h"
15 #include "base/path_service.h" 15 #include "base/path_service.h"
16 #include "chrome/browser/diagnostics/diagnostics_test.h" 16 #include "chrome/browser/diagnostics/diagnostics_test.h"
17 #include "chrome/browser/platform_util.h" 17 #include "chrome/browser/platform_util.h"
18 #include "chrome/common/chrome_paths.h" 18 #include "chrome/common/chrome_paths.h"
19 #include "chrome/common/chrome_version_info.h" 19 #include "chrome/common/chrome_version_info.h"
20 #include "chrome/common/json_value_serializer.h" 20 #include "chrome/common/json_value_serializer.h"
21 21
22 #if defined(OS_WIN) 22 #if defined(OS_WIN)
23 #include "base/win_util.h" 23 #include "base/win/windows_version.h"
24 #include "chrome/installer/util/install_util.h" 24 #include "chrome/installer/util/install_util.h"
25 #endif 25 #endif
26 26
27 // Reconnaissance diagnostics. These are the first and most critical 27 // Reconnaissance diagnostics. These are the first and most critical
28 // diagnostic tests. Here we check for the existence of critical files. 28 // diagnostic tests. Here we check for the existence of critical files.
29 // TODO(cpu): Define if it makes sense to localize strings. 29 // TODO(cpu): Define if it makes sense to localize strings.
30 30
31 // TODO(cpu): There are a few maxium file sizes hardcoded in this file 31 // TODO(cpu): There are a few maxium file sizes hardcoded in this file
32 // that have little or no theoretical or experimental ground. Find a way 32 // that have little or no theoretical or experimental ground. Find a way
33 // to justify them. 33 // to justify them.
34 34
35 namespace { 35 namespace {
36 36
37 class InstallTypeTest; 37 class InstallTypeTest;
38 InstallTypeTest* g_install_type = 0; 38 InstallTypeTest* g_install_type = 0;
39 39
40 // Check that the flavor of the operating system is supported. 40 // Check that the flavor of the operating system is supported.
41 class OperatingSystemTest : public DiagnosticTest { 41 class OperatingSystemTest : public DiagnosticTest {
42 public: 42 public:
43 OperatingSystemTest() : DiagnosticTest(ASCIIToUTF16("Operating System")) {} 43 OperatingSystemTest() : DiagnosticTest(ASCIIToUTF16("Operating System")) {}
44 44
45 virtual int GetId() { return 0; } 45 virtual int GetId() { return 0; }
46 46
47 virtual bool ExecuteImpl(DiagnosticsModel::Observer* observer) { 47 virtual bool ExecuteImpl(DiagnosticsModel::Observer* observer) {
48 int version = 0; 48 int version = 0;
49 int major = 0; 49 int major = 0;
50 int minor = 0; 50 int minor = 0;
51 #if defined(OS_WIN) 51 #if defined(OS_WIN)
52 version = win_util::GetWinVersion(); 52 version = base::win::GetVersion();
53 if (version < win_util::WINVERSION_XP) { 53 if (version < base::win::VERSION_XP) {
54 RecordFailure(ASCIIToUTF16("Windows 2000 or earlier")); 54 RecordFailure(ASCIIToUTF16("Windows 2000 or earlier"));
55 return false; 55 return false;
56 } 56 }
57 win_util::GetServicePackLevel(&major, &minor); 57 base::win::GetServicePackLevel(&major, &minor);
58 if ((version == win_util::WINVERSION_XP) && (major < 2)) { 58 if ((version == base::win::VERSION_XP) && (major < 2)) {
59 RecordFailure(ASCIIToUTF16("XP Service Pack 1 or earlier")); 59 RecordFailure(ASCIIToUTF16("XP Service Pack 1 or earlier"));
60 return false; 60 return false;
61 } 61 }
62 #else 62 #else
63 // TODO(port): define the OS criteria for linux and mac. 63 // TODO(port): define the OS criteria for linux and mac.
64 #endif // defined(OS_WIN) 64 #endif // defined(OS_WIN)
65 RecordSuccess(ASCIIToUTF16(StringPrintf("%s %s (%d [%d:%d])", 65 RecordSuccess(ASCIIToUTF16(StringPrintf("%s %s (%d [%d:%d])",
66 base::SysInfo::OperatingSystemName().c_str(), 66 base::SysInfo::OperatingSystemName().c_str(),
67 base::SysInfo::OperatingSystemVersion().c_str(), 67 base::SysInfo::OperatingSystemVersion().c_str(),
68 version, major, minor))); 68 version, major, minor)));
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 path = path.Append(chrome::kBookmarksFileName); 351 path = path.Append(chrome::kBookmarksFileName);
352 return new JSONTest(path, ASCIIToUTF16("BookMarks JSON"), 2 * kOneMeg); 352 return new JSONTest(path, ASCIIToUTF16("BookMarks JSON"), 2 * kOneMeg);
353 } 353 }
354 354
355 DiagnosticTest* MakeLocalStateTest() { 355 DiagnosticTest* MakeLocalStateTest() {
356 FilePath path; 356 FilePath path;
357 PathService::Get(chrome::DIR_USER_DATA, &path); 357 PathService::Get(chrome::DIR_USER_DATA, &path);
358 path = path.Append(chrome::kLocalStateFilename); 358 path = path.Append(chrome::kLocalStateFilename);
359 return new JSONTest(path, ASCIIToUTF16("Local State JSON"), 50 * kOneKilo); 359 return new JSONTest(path, ASCIIToUTF16("Local State JSON"), 50 * kOneKilo);
360 } 360 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698