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

Unified Diff: base/sys_info_posix.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_posix.cc
===================================================================
--- base/sys_info_posix.cc (revision 2544)
+++ base/sys_info_posix.cc (working copy)
@@ -8,6 +8,7 @@
#include <errno.h>
#include <string.h>
#include <sys/statvfs.h>
+#include <sys/utsname.h>
#include <unistd.h>
#if defined(OS_MACOSX)
@@ -70,4 +71,60 @@
return static_cast<int64>(stats.f_bavail) * stats.f_frsize;
}
+// static
+bool SysInfo::HasEnvironmentVariable(const char* var) {
+ return getenv(var) != NULL;
+}
+
+// static
+std::wstring SysInfo::GetEnvironmentVariable(const char* var) {
+ char* value = getenv(var);
+ if (!value) {
+ return L"";
+ } else {
+ return UTF8ToWide(value);
+ }
+}
+
+// static
+std::string SysInfo::OperatingSystemName() {
+ utsname info;
+ if (uname(&info) < 0) {
+ NOTREACHED();
+ return "";
+ }
+ return std::string(info.sysname);
+}
+
+// static
+std::string SysInfo::OperatingSystemVersion() {
+ utsname info;
+ if (uname(&info) < 0) {
+ NOTREACHED();
+ return "";
+ }
+ return std::string(info.release);
+}
+
+// static
+std::string SysInfo::CPUArchitecture() {
+ utsname info;
+ if (uname(&info) < 0) {
+ NOTREACHED();
+ return "";
+ }
+ return std::string(info.machine);
+}
+
+// static
+void SysInfo::GetPrimaryDisplayDimensions(int* width, int* height) {
+ NOTIMPLEMENTED();
+}
+
+// static
+int SysInfo::DisplayCount() {
+ NOTIMPLEMENTED();
+ return 1;
+}
+
} // namespace base

Powered by Google App Engine
This is Rietveld 408576698