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

Side by Side Diff: chrome/browser/component_updater/component_updater_service.h

Issue 209313002: Modified components ui to address concern of all the time disabled check update button. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Latest sync Created 6 years, 8 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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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_COMPONENT_UPDATER_COMPONENT_UPDATER_SERVICE_H_ 5 #ifndef CHROME_BROWSER_COMPONENT_UPDATER_COMPONENT_UPDATER_SERVICE_H_
6 #define CHROME_BROWSER_COMPONENT_UPDATER_COMPONENT_UPDATER_SERVICE_H_ 6 #define CHROME_BROWSER_COMPONENT_UPDATER_COMPONENT_UPDATER_SERVICE_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 std::vector<uint8> pk_hash; 71 std::vector<uint8> pk_hash;
72 ComponentInstaller* installer; 72 ComponentInstaller* installer;
73 Version version; 73 Version version;
74 std::string fingerprint; 74 std::string fingerprint;
75 std::string name; 75 std::string name;
76 bool allow_background_download; 76 bool allow_background_download;
77 CrxComponent(); 77 CrxComponent();
78 ~CrxComponent(); 78 ~CrxComponent();
79 }; 79 };
80 80
81 // Convenience structure to use with component listing / enumeration. 81 struct CrxComponentInfo;
82 struct CrxComponentInfo {
83 // |id| is currently derived from |CrxComponent.pk_hash|, see rest of the
84 // class implementation for details.
85 std::string id;
86 std::string version;
87 std::string name;
88 CrxComponentInfo();
89 ~CrxComponentInfo();
90 };
91 82
92 // The component update service is in charge of installing or upgrading 83 // The component update service is in charge of installing or upgrading
93 // select parts of chrome. Each part is called a component and managed by 84 // select parts of chrome. Each part is called a component and managed by
94 // instances of CrxComponent registered using RegisterComponent(). On the 85 // instances of CrxComponent registered using RegisterComponent(). On the
95 // server, each component is packaged as a CRX which is the same format used 86 // server, each component is packaged as a CRX which is the same format used
96 // to package extensions. To the update service each component is identified 87 // to package extensions. To the update service each component is identified
97 // by its public key hash (CrxComponent::pk_hash). If there is an update 88 // by its public key hash (CrxComponent::pk_hash). If there is an update
98 // available and its version is bigger than (CrxComponent::version), it will 89 // available and its version is bigger than (CrxComponent::version), it will
99 // be downloaded, verified and unpacked. Then component-specific installer 90 // be downloaded, verified and unpacked. Then component-specific installer
100 // ComponentInstaller::Install (of CrxComponent::installer) will be called. 91 // ComponentInstaller::Install (of CrxComponent::installer) will be called.
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 // will not be canceled. 194 // will not be canceled.
204 virtual Status Stop() = 0; 195 virtual Status Stop() = 0;
205 196
206 // Add component to be checked for updates. You can call this method 197 // Add component to be checked for updates. You can call this method
207 // before calling Start(). 198 // before calling Start().
208 virtual Status RegisterComponent(const CrxComponent& component) = 0; 199 virtual Status RegisterComponent(const CrxComponent& component) = 0;
209 200
210 // Returns a list of registered components. 201 // Returns a list of registered components.
211 virtual void GetComponents(std::vector<CrxComponentInfo>* components) = 0; 202 virtual void GetComponents(std::vector<CrxComponentInfo>* components) = 0;
212 203
204 // Returns current status of a previously registered component.
205 virtual Status GetComponentStatus(const std::string& component_id) = 0;
206
213 // Returns a network resource throttle. It means that a component will be 207 // Returns a network resource throttle. It means that a component will be
214 // downloaded and installed before the resource is unthrottled. This is the 208 // downloaded and installed before the resource is unthrottled. This is the
215 // only function callable from the IO thread. 209 // only function callable from the IO thread.
216 virtual content::ResourceThrottle* GetOnDemandResourceThrottle( 210 virtual content::ResourceThrottle* GetOnDemandResourceThrottle(
217 net::URLRequest* request, const std::string& crx_id) = 0; 211 net::URLRequest* request, const std::string& crx_id) = 0;
218 212
219 virtual ~ComponentUpdateService() {} 213 virtual ~ComponentUpdateService() {}
220 214
221 friend class ::ComponentsUI; 215 friend class ::ComponentsUI;
222 friend class OnDemandTester; 216 friend class OnDemandTester;
223 217
224 private: 218 private:
225 // Ask the component updater to do an update check for a previously 219 // Ask the component updater to do an update check for a previously
226 // registered component, immediately. If an update or check is already 220 // registered component, immediately. If an update or check is already
227 // in progress, returns |kInProgress|. 221 // in progress, returns |kInProgress|.
228 // There is no guarantee that the item will actually be updated, 222 // There is no guarantee that the item will actually be updated,
229 // since an update may not be available. Listeners for the component will 223 // since an update may not be available. Listeners for the component will
230 // know the outcome of the check. 224 // know the outcome of the check.
231 virtual Status OnDemandUpdate(const std::string& component_id) = 0; 225 virtual Status OnDemandUpdate(const std::string& component_id) = 0;
232 }; 226 };
233 227
234 typedef ComponentUpdateService::Observer ServiceObserver; 228 typedef ComponentUpdateService::Observer ServiceObserver;
235 229
236 // Creates the component updater. You must pass a valid |config| allocated on 230 // Creates the component updater. You must pass a valid |config| allocated on
237 // the heap which the component updater will own. 231 // the heap which the component updater will own.
238 ComponentUpdateService* ComponentUpdateServiceFactory( 232 ComponentUpdateService* ComponentUpdateServiceFactory(
239 ComponentUpdateService::Configurator* config); 233 ComponentUpdateService::Configurator* config);
240 234
235 // Convenience structure to use with component listing / enumeration.
Sorin Jianu 2014/04/28 22:46:11 For the future, as we want to expose more state in
236 struct CrxComponentInfo {
237 // |id| is currently derived from |CrxComponent.pk_hash|, see rest of the
238 // class implementation for details.
239 std::string id;
240 std::string version;
241 std::string name;
242 ComponentUpdateService::Status status;
243 CrxComponentInfo();
244 ~CrxComponentInfo();
Sorin Jianu 2014/04/28 22:46:11 maybe dtor not needed?
245 };
246
241 } // namespace component_updater 247 } // namespace component_updater
242 248
243 #endif // CHROME_BROWSER_COMPONENT_UPDATER_COMPONENT_UPDATER_SERVICE_H_ 249 #endif // CHROME_BROWSER_COMPONENT_UPDATER_COMPONENT_UPDATER_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698