OLD | NEW |
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 "base/sys_info.h" | 5 #include "base/sys_info.h" |
6 | 6 |
7 #include <windows.h> | 7 #include <windows.h> |
8 | 8 |
9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "base/scoped_ptr.h" | 11 #include "base/scoped_ptr.h" |
12 #include "base/string_util.h" | 12 #include "base/stringprintf.h" |
13 | 13 |
14 namespace base { | 14 namespace base { |
15 | 15 |
16 // static | 16 // static |
17 int SysInfo::NumberOfProcessors() { | 17 int SysInfo::NumberOfProcessors() { |
18 SYSTEM_INFO info; | 18 SYSTEM_INFO info; |
19 GetSystemInfo(&info); | 19 GetSystemInfo(&info); |
20 return static_cast<int>(info.dwNumberOfProcessors); | 20 return static_cast<int>(info.dwNumberOfProcessors); |
21 } | 21 } |
22 | 22 |
(...skipping 28 matching lines...) Expand all Loading... |
51 std::string SysInfo::OperatingSystemName() { | 51 std::string SysInfo::OperatingSystemName() { |
52 return "Windows NT"; | 52 return "Windows NT"; |
53 } | 53 } |
54 | 54 |
55 // static | 55 // static |
56 std::string SysInfo::OperatingSystemVersion() { | 56 std::string SysInfo::OperatingSystemVersion() { |
57 OSVERSIONINFO info = {0}; | 57 OSVERSIONINFO info = {0}; |
58 info.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); | 58 info.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); |
59 GetVersionEx(&info); | 59 GetVersionEx(&info); |
60 | 60 |
61 return StringPrintf("%lu.%lu", info.dwMajorVersion, info.dwMinorVersion); | 61 return base::StringPrintf("%lu.%lu", |
| 62 info.dwMajorVersion, info.dwMinorVersion); |
62 } | 63 } |
63 | 64 |
64 // TODO: Implement OperatingSystemVersionComplete, which would include | 65 // TODO: Implement OperatingSystemVersionComplete, which would include |
65 // patchlevel/service pack number. See chrome/browser/views/bug_report_view.cc, | 66 // patchlevel/service pack number. See chrome/browser/views/bug_report_view.cc, |
66 // BugReportView::SetOSVersion. | 67 // BugReportView::SetOSVersion. |
67 | 68 |
68 // static | 69 // static |
69 std::string SysInfo::CPUArchitecture() { | 70 std::string SysInfo::CPUArchitecture() { |
70 // TODO: Make this vary when we support any other architectures. | 71 // TODO: Make this vary when we support any other architectures. |
71 return "x86"; | 72 return "x86"; |
(...skipping 27 matching lines...) Expand all Loading... |
99 int32 *bugfix_version) { | 100 int32 *bugfix_version) { |
100 OSVERSIONINFO info = {0}; | 101 OSVERSIONINFO info = {0}; |
101 info.dwOSVersionInfoSize = sizeof(info); | 102 info.dwOSVersionInfoSize = sizeof(info); |
102 GetVersionEx(&info); | 103 GetVersionEx(&info); |
103 *major_version = info.dwMajorVersion; | 104 *major_version = info.dwMajorVersion; |
104 *minor_version = info.dwMinorVersion; | 105 *minor_version = info.dwMinorVersion; |
105 *bugfix_version = 0; | 106 *bugfix_version = 0; |
106 } | 107 } |
107 | 108 |
108 } // namespace base | 109 } // namespace base |
OLD | NEW |