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

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

Issue 7104076: Revert 88440 - Change Chrome OS version numbers to Platform versions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: 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
68 static const char kFullVersionPrefix[]; 62 static const char kFullVersionPrefix[];
69 static const char kVersionPrefix[]; 63 static const char kVersionPrefix[];
70 static const char kFirmwarePrefix[]; 64 static const char kFirmwarePrefix[];
71 65
72 private: 66 private:
73 FRIEND_TEST_ALL_PREFIXES(VersionLoaderTest, ParseFullVersion); 67 FRIEND_TEST_ALL_PREFIXES(VersionLoaderTest, ParseFullVersion);
74 FRIEND_TEST_ALL_PREFIXES(VersionLoaderTest, ParseVersion); 68 FRIEND_TEST_ALL_PREFIXES(VersionLoaderTest, ParseVersion);
75 FRIEND_TEST_ALL_PREFIXES(VersionLoaderTest, ParseFirmware); 69 FRIEND_TEST_ALL_PREFIXES(VersionLoaderTest, ParseFirmware);
76 70
77 // VersionLoader calls into the Backend on the file thread to load 71 // VersionLoader calls into the Backend on the file thread to load
78 // and extract the version. 72 // and extract the version.
79 class Backend : public base::RefCountedThreadSafe<Backend> { 73 class Backend : public base::RefCountedThreadSafe<Backend> {
80 public: 74 public:
81 Backend() : parse_as_platform_(false) {} 75 Backend() {}
82 76
83 // Calls ParseVersion to get the version # and notifies request. 77 // Calls ParseVersion to get the version # and notifies request.
84 // This is invoked on the file thread. 78 // This is invoked on the file thread.
85 // If |full_version| is true then extra info is passed in version string. 79 // If |full_version| is true then extra info is passed in version string.
86 void GetVersion(scoped_refptr<GetVersionRequest> request, 80 void GetVersion(scoped_refptr<GetVersionRequest> request,
87 VersionFormat format); 81 VersionFormat format);
88 82
89 // Calls ParseFirmware to get the firmware # and notifies request. 83 // Calls ParseFirmware to get the firmware # and notifies request.
90 // This is invoked on the file thread. 84 // This is invoked on the file thread.
91 void GetFirmware(scoped_refptr<GetFirmwareRequest> request); 85 void GetFirmware(scoped_refptr<GetFirmwareRequest> request);
92 86
93 void set_parse_as_platform(bool value) { parse_as_platform_ = value; }
94
95 private: 87 private:
96 friend class base::RefCountedThreadSafe<Backend>; 88 friend class base::RefCountedThreadSafe<Backend>;
97 89
98 bool parse_as_platform_;
99
100 ~Backend() {} 90 ~Backend() {}
101 91
102 DISALLOW_COPY_AND_ASSIGN(Backend); 92 DISALLOW_COPY_AND_ASSIGN(Backend);
103 }; 93 };
104 94
105 // Extracts the version from the file. 95 // Extracts the version from the file.
106 // |prefix| specifies what key defines version data. 96 // |prefix| specifies what key defines version data.
107 static std::string ParseVersion(const std::string& contents, 97 static std::string ParseVersion(const std::string& contents,
108 const std::string& prefix); 98 const std::string& prefix);
109 99
110 // Extracts the firmware from the file. 100 // Extracts the firmware from the file.
111 static std::string ParseFirmware(const std::string& contents); 101 static std::string ParseFirmware(const std::string& contents);
112 102
113 scoped_refptr<Backend> backend_; 103 scoped_refptr<Backend> backend_;
114 104
115 DISALLOW_COPY_AND_ASSIGN(VersionLoader); 105 DISALLOW_COPY_AND_ASSIGN(VersionLoader);
116 }; 106 };
117 107
118 } // namespace chromeos 108 } // namespace chromeos
119 109
120 #endif // CHROME_BROWSER_CHROMEOS_VERSION_LOADER_H_ 110 #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