summaryrefslogtreecommitdiffstats
path: root/chrome/browser/chromeos/version_loader.h
diff options
context:
space:
mode:
authorchocobo@chromium.org <chocobo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-25 22:02:59 +0000
committerchocobo@chromium.org <chocobo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-25 22:02:59 +0000
commitb74943e7c1ce20e1d9482b1d7d42e4947bf4ef23 (patch)
tree5798cbd8a4b222a9989399f2c2dcf1168da8c40e /chrome/browser/chromeos/version_loader.h
parentadc01537fd169b0a15101a300fb660a526d6e791 (diff)
downloadchromium_src-b74943e7c1ce20e1d9482b1d7d42e4947bf4ef23.zip
chromium_src-b74943e7c1ce20e1d9482b1d7d42e4947bf4ef23.tar.gz
chromium_src-b74943e7c1ce20e1d9482b1d7d42e4947bf4ef23.tar.bz2
Show ChromeOS bios firmware in about dialog.
BUG=chromium-os:13692 TEST=version_loader_unittest. load about dialog and verify that the bios firmware is shown right away and also when you click "More info". Review URL: http://codereview.chromium.org/6883142 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@82932 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/chromeos/version_loader.h')
-rw-r--r--chrome/browser/chromeos/version_loader.h19
1 files changed, 18 insertions, 1 deletions
diff --git a/chrome/browser/chromeos/version_loader.h b/chrome/browser/chromeos/version_loader.h
index 948f91f..e3ea990 100644
--- a/chrome/browser/chromeos/version_loader.h
+++ b/chrome/browser/chromeos/version_loader.h
@@ -28,6 +28,9 @@ namespace chromeos {
// void OnGetChromeOSVersion(chromeos::VersionLoader::Handle,
// std::string version);
// . When you want the version invoke: loader.GetVersion(&consumer, callback);
+//
+// This class also provides the ability to load the bios firmware using
+// loader.GetFirmware(&consumer, callback);
class VersionLoader : public CancelableRequestProvider {
public:
VersionLoader();
@@ -40,9 +43,11 @@ class VersionLoader : public CancelableRequestProvider {
// Signature
typedef Callback2<Handle, std::string>::Type GetVersionCallback;
-
typedef CancelableRequest<GetVersionCallback> GetVersionRequest;
+ typedef Callback2<Handle, std::string>::Type GetFirmwareCallback;
+ typedef CancelableRequest<GetFirmwareCallback> GetFirmwareRequest;
+
// Asynchronously requests the version.
// If |full_version| is true version string with extra info is extracted,
// otherwise it's in short format x.x.xx.x.
@@ -50,12 +55,17 @@ class VersionLoader : public CancelableRequestProvider {
GetVersionCallback* callback,
VersionFormat format);
+ Handle GetFirmware(CancelableRequestConsumerBase* consumer,
+ GetFirmwareCallback* callback);
+
static const char kFullVersionPrefix[];
static const char kVersionPrefix[];
+ static const char kFirmwarePrefix[];
private:
FRIEND_TEST_ALL_PREFIXES(VersionLoaderTest, ParseFullVersion);
FRIEND_TEST_ALL_PREFIXES(VersionLoaderTest, ParseVersion);
+ FRIEND_TEST_ALL_PREFIXES(VersionLoaderTest, ParseFirmware);
// VersionLoader calls into the Backend on the file thread to load
// and extract the version.
@@ -69,6 +79,10 @@ class VersionLoader : public CancelableRequestProvider {
void GetVersion(scoped_refptr<GetVersionRequest> request,
VersionFormat format);
+ // Calls ParseFirmware to get the firmware # and notifies request.
+ // This is invoked on the file thread.
+ void GetFirmware(scoped_refptr<GetFirmwareRequest> request);
+
private:
friend class base::RefCountedThreadSafe<Backend>;
@@ -82,6 +96,9 @@ class VersionLoader : public CancelableRequestProvider {
static std::string ParseVersion(const std::string& contents,
const std::string& prefix);
+ // Extracts the firmware from the file.
+ static std::string ParseFirmware(const std::string& contents);
+
scoped_refptr<Backend> backend_;
DISALLOW_COPY_AND_ASSIGN(VersionLoader);