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

Side by Side Diff: chrome/browser/chromeos/version_loader.h

Issue 7108019: Change Chrome OS version numbers to Platform versions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Updated header for 2011 Created 9 years, 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 GetVersionCallback* callback,
57 VersionFormat format); 57 VersionFormat format);
58 58
59 Handle GetFirmware(CancelableRequestConsumerBase* consumer, 59 Handle GetFirmware(CancelableRequestConsumerBase* consumer,
60 GetFirmwareCallback* callback); 60 GetFirmwareCallback* callback);
61 61
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
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
66 void EnablePlatformVersions(bool enable);
67
62 static const char kFullVersionPrefix[]; 68 static const char kFullVersionPrefix[];
63 static const char kVersionPrefix[]; 69 static const char kVersionPrefix[];
64 static const char kFirmwarePrefix[]; 70 static const char kFirmwarePrefix[];
65 71
66 private: 72 private:
67 FRIEND_TEST_ALL_PREFIXES(VersionLoaderTest, ParseFullVersion); 73 FRIEND_TEST_ALL_PREFIXES(VersionLoaderTest, ParseFullVersion);
68 FRIEND_TEST_ALL_PREFIXES(VersionLoaderTest, ParseVersion); 74 FRIEND_TEST_ALL_PREFIXES(VersionLoaderTest, ParseVersion);
69 FRIEND_TEST_ALL_PREFIXES(VersionLoaderTest, ParseFirmware); 75 FRIEND_TEST_ALL_PREFIXES(VersionLoaderTest, ParseFirmware);
70 76
71 // VersionLoader calls into the Backend on the file thread to load 77 // VersionLoader calls into the Backend on the file thread to load
72 // and extract the version. 78 // and extract the version.
73 class Backend : public base::RefCountedThreadSafe<Backend> { 79 class Backend : public base::RefCountedThreadSafe<Backend> {
74 public: 80 public:
75 Backend() {} 81 Backend() : parse_as_platform_(false) {}
76 82
77 // Calls ParseVersion to get the version # and notifies request. 83 // Calls ParseVersion to get the version # and notifies request.
78 // This is invoked on the file thread. 84 // This is invoked on the file thread.
79 // If |full_version| is true then extra info is passed in version string. 85 // If |full_version| is true then extra info is passed in version string.
80 void GetVersion(scoped_refptr<GetVersionRequest> request, 86 void GetVersion(scoped_refptr<GetVersionRequest> request,
81 VersionFormat format); 87 VersionFormat format);
82 88
83 // Calls ParseFirmware to get the firmware # and notifies request. 89 // Calls ParseFirmware to get the firmware # and notifies request.
84 // This is invoked on the file thread. 90 // This is invoked on the file thread.
85 void GetFirmware(scoped_refptr<GetFirmwareRequest> request); 91 void GetFirmware(scoped_refptr<GetFirmwareRequest> request);
86 92
93 void set_parse_as_platform(bool value) { parse_as_platform_ = value; }
94
87 private: 95 private:
88 friend class base::RefCountedThreadSafe<Backend>; 96 friend class base::RefCountedThreadSafe<Backend>;
89 97
98 bool parse_as_platform_;
99
90 ~Backend() {} 100 ~Backend() {}
91 101
92 DISALLOW_COPY_AND_ASSIGN(Backend); 102 DISALLOW_COPY_AND_ASSIGN(Backend);
93 }; 103 };
94 104
95 // Extracts the version from the file. 105 // Extracts the version from the file.
96 // |prefix| specifies what key defines version data. 106 // |prefix| specifies what key defines version data.
97 static std::string ParseVersion(const std::string& contents, 107 static std::string ParseVersion(const std::string& contents,
98 const std::string& prefix); 108 const std::string& prefix);
99 109
100 // Extracts the firmware from the file. 110 // Extracts the firmware from the file.
101 static std::string ParseFirmware(const std::string& contents); 111 static std::string ParseFirmware(const std::string& contents);
102 112
103 scoped_refptr<Backend> backend_; 113 scoped_refptr<Backend> backend_;
104 114
105 DISALLOW_COPY_AND_ASSIGN(VersionLoader); 115 DISALLOW_COPY_AND_ASSIGN(VersionLoader);
106 }; 116 };
107 117
108 } // namespace chromeos 118 } // namespace chromeos
109 119
110 #endif // CHROME_BROWSER_CHROMEOS_VERSION_LOADER_H_ 120 #endif // CHROME_BROWSER_CHROMEOS_VERSION_LOADER_H_
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/background_view.cc ('k') | chrome/browser/chromeos/version_loader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698