Move functions for controlling Caps Lock to CapsLockDelegate from SystemTrayDelegate.
[chromium-blink-merge.git] / base / sys_info.h
blobaf9f017fce00099589b67a3c74580fe9b4e751d0
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef BASE_SYS_INFO_H_
6 #define BASE_SYS_INFO_H_
8 #include "base/base_export.h"
9 #include "base/basictypes.h"
10 #include "base/file_path.h"
11 #include "base/time.h"
13 #include <string>
15 class FilePath;
17 namespace base {
19 class BASE_EXPORT SysInfo {
20 public:
21 // Return the number of logical processors/cores on the current machine.
22 static int NumberOfProcessors();
24 // Return the number of bytes of physical memory on the current machine.
25 static int64 AmountOfPhysicalMemory();
27 // Return the number of megabytes of physical memory on the current machine.
28 static int AmountOfPhysicalMemoryMB() {
29 return static_cast<int>(AmountOfPhysicalMemory() / 1024 / 1024);
32 // Return the available disk space in bytes on the volume containing |path|,
33 // or -1 on failure.
34 static int64 AmountOfFreeDiskSpace(const FilePath& path);
36 // Returns the name of the host operating system.
37 static std::string OperatingSystemName();
39 // Returns the version of the host operating system.
40 static std::string OperatingSystemVersion();
42 // Retrieves detailed numeric values for the OS version.
43 // TODO(port): Implement a Linux version of this method and enable the
44 // corresponding unit test.
45 // DON'T USE THIS ON THE MAC OR WINDOWS to determine the current OS release
46 // for OS version-specific feature checks and workarounds. If you must use
47 // an OS version check instead of a feature check, use the base::mac::IsOS*
48 // family from base/mac/mac_util.h, or base::win::GetVersion from
49 // base/win/windows_version.h.
50 static void OperatingSystemVersionNumbers(int32* major_version,
51 int32* minor_version,
52 int32* bugfix_version);
54 // Returns the CPU architecture of the system. Exact return value may differ
55 // across platforms.
56 static std::string CPUArchitecture();
58 // Return the smallest amount of memory (in bytes) which the VM system will
59 // allocate.
60 static size_t VMAllocationGranularity();
62 #if defined(OS_POSIX) && !defined(OS_MACOSX)
63 // Returns the maximum SysV shared memory segment size.
64 static size_t MaxSharedMemorySize();
65 #endif // defined(OS_POSIX) && !defined(OS_MACOSX)
67 #if defined(OS_CHROMEOS)
68 // Returns the name of the version entry we wish to look up in the
69 // Linux Standard Base release information file.
70 static std::string GetLinuxStandardBaseVersionKey();
72 // Parses /etc/lsb-release to get version information for Google Chrome OS.
73 // Declared here so it can be exposed for unit testing.
74 static void ParseLsbRelease(const std::string& lsb_release,
75 int32* major_version,
76 int32* minor_version,
77 int32* bugfix_version);
79 // Returns the path to the lsb-release file.
80 static FilePath GetLsbReleaseFilePath();
81 #endif // defined(OS_CHROMEOS)
83 #if defined(OS_ANDROID)
84 // Returns the Android build's codename.
85 static std::string GetAndroidBuildCodename();
87 // Returns the Android build ID.
88 static std::string GetAndroidBuildID();
90 // Returns the device's name.
91 static std::string GetDeviceName();
93 static int DalvikHeapSizeMB();
94 #endif // defined(OS_ANDROID)
97 } // namespace base
99 #endif // BASE_SYS_INFO_H_