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

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: Fix tests 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') | base/sys_info_chromeos.cc » ('J')
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..0415c727a0b279c49c8d9894c89de455a8f44624 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 a the contents of /etc/lsb-release as a map.
pneubeck (no reviews) 2013/09/24 07:44:51 a the -> the
stevenjb 2013/09/24 17:18:34 Done.
+ 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 ChromeOS build).
Daniel Erat 2013/09/24 15:37:53 nit: s/ChromeOS/Chrome OS/, our product's name is
stevenjb 2013/09/24 17:18:34 Done.
+ static Time GetLsbReleaseTime();
+
+ // Test method to force re-parsing of lsb-release.
+ static void SetChromeOSVersionInfoForTest(const std::string& lsb_release,
+ double lsb_release_time);
Daniel Erat 2013/09/24 15:37:53 it'd be best to make this take a Time instead of a
stevenjb 2013/09/24 17:18:34 Done.
#endif // defined(OS_CHROMEOS)
#if defined(OS_ANDROID)
« no previous file with comments | « no previous file | base/sys_info_chromeos.cc » ('j') | base/sys_info_chromeos.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698