| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_CHROMEOS_VERSION_LOADER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_VERSION_LOADER_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_VERSION_LOADER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_VERSION_LOADER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/callback_old.h" | 11 #include "base/callback.h" |
| 12 #include "base/gtest_prod_util.h" | 12 #include "base/gtest_prod_util.h" |
| 13 #include "content/browser/cancelable_request.h" | 13 #include "content/browser/cancelable_request.h" |
| 14 | 14 |
| 15 class FilePath; | 15 class FilePath; |
| 16 | 16 |
| 17 namespace chromeos { | 17 namespace chromeos { |
| 18 | 18 |
| 19 // ChromeOSVersionLoader loads the version of Chrome OS from the file system. | 19 // ChromeOSVersionLoader loads the version of Chrome OS from the file system. |
| 20 // Loading is done asynchronously on the file thread. Once loaded, | 20 // Loading is done asynchronously on the file thread. Once loaded, |
| 21 // ChromeOSVersionLoader callback to a method of your choice with the version | 21 // ChromeOSVersionLoader callback to a method of your choice with the version |
| (...skipping 14 matching lines...) Expand all Loading... |
| 36 VersionLoader(); | 36 VersionLoader(); |
| 37 virtual ~VersionLoader(); | 37 virtual ~VersionLoader(); |
| 38 | 38 |
| 39 enum VersionFormat { | 39 enum VersionFormat { |
| 40 VERSION_SHORT, | 40 VERSION_SHORT, |
| 41 VERSION_SHORT_WITH_DATE, | 41 VERSION_SHORT_WITH_DATE, |
| 42 VERSION_FULL, | 42 VERSION_FULL, |
| 43 }; | 43 }; |
| 44 | 44 |
| 45 // Signature | 45 // Signature |
| 46 typedef Callback2<Handle, std::string>::Type GetVersionCallback; | 46 typedef base::Callback<void(Handle, std::string)> GetVersionCallback; |
| 47 typedef CancelableRequest<GetVersionCallback> GetVersionRequest; | 47 typedef CancelableRequest<GetVersionCallback> GetVersionRequest; |
| 48 | 48 |
| 49 typedef Callback2<Handle, std::string>::Type GetFirmwareCallback; | 49 typedef base::Callback<void(Handle, std::string)> GetFirmwareCallback; |
| 50 typedef CancelableRequest<GetFirmwareCallback> GetFirmwareRequest; | 50 typedef CancelableRequest<GetFirmwareCallback> GetFirmwareRequest; |
| 51 | 51 |
| 52 // Asynchronously requests the version. | 52 // Asynchronously requests the version. |
| 53 // If |full_version| is true version string with extra info is extracted, | 53 // If |full_version| is true version string with extra info is extracted, |
| 54 // otherwise it's in short format x.x.xx.x. | 54 // otherwise it's in short format x.x.xx.x. |
| 55 Handle GetVersion(CancelableRequestConsumerBase* consumer, | 55 Handle GetVersion(CancelableRequestConsumerBase* consumer, |
| 56 GetVersionCallback* callback, | 56 const GetVersionCallback& callback, |
| 57 VersionFormat format); | 57 VersionFormat format); |
| 58 | 58 |
| 59 Handle GetFirmware(CancelableRequestConsumerBase* consumer, | 59 Handle GetFirmware(CancelableRequestConsumerBase* consumer, |
| 60 GetFirmwareCallback* callback); | 60 const GetFirmwareCallback& callback); |
| 61 | 61 |
| 62 // Parse the version information as a Chrome platfrom, not Chrome OS | 62 // Parse the version information as a Chrome platfrom, not Chrome OS |
| 63 // TODO(rkc): Change this and everywhere it is used once we switch Chrome OS | 63 // TODO(rkc): Change this and everywhere it is used once we switch Chrome OS |
| 64 // over to xx.yyy.zz version numbers instead of 0.xx.yyy.zz | 64 // over to xx.yyy.zz version numbers instead of 0.xx.yyy.zz |
| 65 // Refer to http://code.google.com/p/chromium-os/issues/detail?id=15789 | 65 // Refer to http://code.google.com/p/chromium-os/issues/detail?id=15789 |
| 66 void EnablePlatformVersions(bool enable); | 66 void EnablePlatformVersions(bool enable); |
| 67 | 67 |
| 68 static const char kFullVersionPrefix[]; | 68 static const char kFullVersionPrefix[]; |
| 69 static const char kVersionPrefix[]; | 69 static const char kVersionPrefix[]; |
| 70 static const char kFirmwarePrefix[]; | 70 static const char kFirmwarePrefix[]; |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 static std::string ParseFirmware(const std::string& contents); | 107 static std::string ParseFirmware(const std::string& contents); |
| 108 | 108 |
| 109 scoped_refptr<Backend> backend_; | 109 scoped_refptr<Backend> backend_; |
| 110 | 110 |
| 111 DISALLOW_COPY_AND_ASSIGN(VersionLoader); | 111 DISALLOW_COPY_AND_ASSIGN(VersionLoader); |
| 112 }; | 112 }; |
| 113 | 113 |
| 114 } // namespace chromeos | 114 } // namespace chromeos |
| 115 | 115 |
| 116 #endif // CHROME_BROWSER_CHROMEOS_VERSION_LOADER_H_ | 116 #endif // CHROME_BROWSER_CHROMEOS_VERSION_LOADER_H_ |
| OLD | NEW |