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

Unified Diff: base/sys_info_win.cc

Issue 4079: Porting refactoring changes:... (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 12 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: base/sys_info_win.cc
===================================================================
--- base/sys_info_win.cc (revision 2544)
+++ base/sys_info_win.cc (working copy)
@@ -7,6 +7,8 @@
#include <windows.h>
#include "base/logging.h"
+#include "base/scoped_ptr.h"
+#include "base/string_util.h"
namespace base {
@@ -44,4 +46,60 @@
return rv;
}
+// static
+bool SysInfo::HasEnvironmentVariable(const char* var) {
+ std::wstring wide_var = ASCIIToWide(std::string(var));
+ return GetEnvironmentVariable(wide_var.c_str(), NULL, 0) != 0;
+}
+
+// static
+std::wstring SysInfo::GetEnvironmentVariable(const char* var) {
Mark Mentovai 2008/09/29 22:20:05 There's a problem here. On Windows, the platform
+ std::wstring wide_var = ASCIIToWide(std::string(var));
+ DWORD value_length = GetEnvironmentVariable(wide_var.c_str(), NULL, 0);
+ if (value_length == 0) {
+ return L"";
+ }
+ scoped_array<wchar_t> value(new wchar_t[value_length]);
+ GetEnvironmentVariable(wide_var.c_str(), value.get(), value_length);
+ return std::wstring(value);
Mark Mentovai 2008/09/29 22:20:05 Changed this to value.get().
+}
+
+// static
+std::string SysInfo::OperatingSystemName() {
+ return "Windows NT";
+}
+
+// static
+std::string SysInfo::OperatingSystemVersion() {
+ OSVERSIONINFO info = {0};
+ info.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
+ GetVersionEx(&info);
+
+ return StringPrintf("%lu.%lu", info.dwMajorVersion, info.dwMinorVersion);
+}
+
+// TODO: Implement OperatingSystemVersionComplete, which would include
+// patchlevel/service pack number. See chrome/browser/views/bug_report_view.cc,
+// BugReportView::SetOSVersion.
+
+// static
+std::string SysInfo::CPUArchitecture() {
+ // TODO: Make this vary when we support any other architectures.
+ return "x86";
+}
+
+// static
+void SysInfo::GetPrimaryDisplayDimensions(int* width, int* height) {
+ if (width)
+ *width = GetSystemMetrics(SM_CXSCREEN);
+
+ if (height)
+ *height = GetSystemMetrics(SM_CYSCREEN);
+}
+
+// static
+int SysInfo::DisplayCount() {
+ return GetSystemMetrics(SM_CMONITORS);
+}
+
} // namespace base

Powered by Google App Engine
This is Rietveld 408576698