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

Unified Diff: base/sys_info.h

Issue 23588009: Parse /etc/lsb-release only once on ChromeOS (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 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
« no previous file with comments | « no previous file | base/sys_info_chromeos.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/sys_info.h
diff --git a/base/sys_info.h b/base/sys_info.h
index 38462ed11105c655bd3797ec4485bb59ee69dc0e..564832d131f9a56cd4dfafa0be46f4bdb72f11fd 100644
--- a/base/sys_info.h
+++ b/base/sys_info.h
@@ -5,11 +5,13 @@
#ifndef BASE_SYS_INFO_H_
#define BASE_SYS_INFO_H_
+#include <map>
#include <string>
#include "base/base_export.h"
#include "base/basictypes.h"
#include "base/files/file_path.h"
+#include "base/time/time.h"
#include "build/build_config.h"
namespace base {
@@ -78,19 +80,25 @@ class BASE_EXPORT SysInfo {
#endif // defined(OS_POSIX) && !defined(OS_MACOSX)
#if defined(OS_CHROMEOS)
- // Returns the name of the version entry we wish to look up in the
- // Linux Standard Base release information file.
- static std::string GetLinuxStandardBaseVersionKey();
-
- // Parses /etc/lsb-release to get version information for Google Chrome OS.
- // Declared here so it can be exposed for unit testing.
- static void ParseLsbRelease(const std::string& lsb_release,
- int32* major_version,
- int32* minor_version,
- int32* bugfix_version);
-
- // Returns the path to the lsb-release file.
- static FilePath GetLsbReleaseFilePath();
+ typedef std::map<std::string, std::string> LsbReleaseMap;
+
+ // Returns the contents of /etc/lsb-release as a map.
+ static const LsbReleaseMap& GetLsbReleaseMap();
+
+ // If |key| is present in the LsbReleaseMap, sets |value| and returns true.
+ static bool GetLsbReleaseValue(const std::string& key, std::string* value);
+
+ // Convenience function for GetLsbReleaseValue("CHROMEOS_RELEASE_BOARD",...).
+ // Returns "unknown" if CHROMEOS_RELEASE_BOARD is not set.
+ static std::string GetLsbReleaseBoard();
+
+ // Returns the creation time of /etc/lsb-release. (Used to get the date and
+ // time of the Chrome OS build).
+ static Time GetLsbReleaseTime();
+
+ // Test method to force re-parsing of lsb-release.
+ static void SetChromeOSVersionInfoForTest(const std::string& lsb_release,
+ const Time& lsb_release_time);
#endif // defined(OS_CHROMEOS)
#if defined(OS_ANDROID)
« no previous file with comments | « no previous file | base/sys_info_chromeos.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698