Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 106 ComponentInstaller* installer; | 106 ComponentInstaller* installer; |
| 107 ComponentObserver* observer; | 107 ComponentObserver* observer; |
| 108 Version version; | 108 Version version; |
| 109 std::string fingerprint; | 109 std::string fingerprint; |
| 110 std::string name; | 110 std::string name; |
| 111 bool allow_background_download; | 111 bool allow_background_download; |
| 112 CrxComponent(); | 112 CrxComponent(); |
| 113 ~CrxComponent(); | 113 ~CrxComponent(); |
| 114 }; | 114 }; |
| 115 | 115 |
| 116 // Convenience structure to use with component listing / enumeration. | 116 struct CrxComponentInfo; |
| 117 struct CrxComponentInfo { | |
| 118 // |id| is currently derived from |CrxComponent.pk_hash|, see rest of the | |
| 119 // class implementation for details. | |
| 120 std::string id; | |
| 121 std::string version; | |
| 122 std::string name; | |
| 123 CrxComponentInfo(); | |
| 124 ~CrxComponentInfo(); | |
| 125 }; | |
| 126 | 117 |
| 127 // The component update service is in charge of installing or upgrading | 118 // The component update service is in charge of installing or upgrading |
| 128 // select parts of chrome. Each part is called a component and managed by | 119 // select parts of chrome. Each part is called a component and managed by |
| 129 // instances of CrxComponent registered using RegisterComponent(). On the | 120 // instances of CrxComponent registered using RegisterComponent(). On the |
| 130 // server, each component is packaged as a CRX which is the same format used | 121 // server, each component is packaged as a CRX which is the same format used |
| 131 // to package extensions. To the update service each component is identified | 122 // to package extensions. To the update service each component is identified |
| 132 // by its public key hash (CrxComponent::pk_hash). If there is an update | 123 // by its public key hash (CrxComponent::pk_hash). If there is an update |
| 133 // available and its version is bigger than (CrxComponent::version), it will | 124 // available and its version is bigger than (CrxComponent::version), it will |
| 134 // be downloaded, verified and unpacked. Then component-specific installer | 125 // be downloaded, verified and unpacked. Then component-specific installer |
| 135 // ComponentInstaller::Install (of CrxComponent::installer) will be called. | 126 // ComponentInstaller::Install (of CrxComponent::installer) will be called. |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 196 // will not be canceled. | 187 // will not be canceled. |
| 197 virtual Status Stop() = 0; | 188 virtual Status Stop() = 0; |
| 198 | 189 |
| 199 // Add component to be checked for updates. You can call this method | 190 // Add component to be checked for updates. You can call this method |
| 200 // before calling Start(). | 191 // before calling Start(). |
| 201 virtual Status RegisterComponent(const CrxComponent& component) = 0; | 192 virtual Status RegisterComponent(const CrxComponent& component) = 0; |
| 202 | 193 |
| 203 // Returns a list of registered components. | 194 // Returns a list of registered components. |
| 204 virtual void GetComponents(std::vector<CrxComponentInfo>* components) = 0; | 195 virtual void GetComponents(std::vector<CrxComponentInfo>* components) = 0; |
| 205 | 196 |
| 197 // Returns current status of a previously registered component. | |
| 198 virtual ComponentUpdateService::Status GetComponentStatus( | |
|
Sorin Jianu
2014/03/26 20:22:36
do we need to fully qualify ComponentUpdateService
Shrikant Kelkar
2014/03/26 21:35:51
Done.
| |
| 199 const std::string& component_id) = 0; | |
| 200 | |
| 206 // Returns a network resource throttle. It means that a component will be | 201 // Returns a network resource throttle. It means that a component will be |
| 207 // downloaded and installed before the resource is unthrottled. This is the | 202 // downloaded and installed before the resource is unthrottled. This is the |
| 208 // only function callable from the IO thread. | 203 // only function callable from the IO thread. |
| 209 virtual content::ResourceThrottle* GetOnDemandResourceThrottle( | 204 virtual content::ResourceThrottle* GetOnDemandResourceThrottle( |
| 210 net::URLRequest* request, const std::string& crx_id) = 0; | 205 net::URLRequest* request, const std::string& crx_id) = 0; |
| 211 | 206 |
| 212 virtual ~ComponentUpdateService() {} | 207 virtual ~ComponentUpdateService() {} |
| 213 | 208 |
| 214 friend class ::ComponentsUI; | 209 friend class ::ComponentsUI; |
| 215 friend class OnDemandTester; | 210 friend class OnDemandTester; |
| 216 | 211 |
| 217 private: | 212 private: |
| 218 // Ask the component updater to do an update check for a previously | 213 // Ask the component updater to do an update check for a previously |
| 219 // registered component, immediately. If an update or check is already | 214 // registered component, immediately. If an update or check is already |
| 220 // in progress, returns |kInProgress|. | 215 // in progress, returns |kInProgress|. |
| 221 // There is no guarantee that the item will actually be updated, | 216 // There is no guarantee that the item will actually be updated, |
| 222 // since an update may not be available. Listeners for the component will | 217 // since an update may not be available. Listeners for the component will |
| 223 // know the outcome of the check. | 218 // know the outcome of the check. |
| 224 virtual Status OnDemandUpdate(const std::string& component_id) = 0; | 219 virtual Status OnDemandUpdate(const std::string& component_id) = 0; |
| 225 }; | 220 }; |
| 226 | 221 |
| 227 // Creates the component updater. You must pass a valid |config| allocated on | 222 // Creates the component updater. You must pass a valid |config| allocated on |
| 228 // the heap which the component updater will own. | 223 // the heap which the component updater will own. |
| 229 ComponentUpdateService* ComponentUpdateServiceFactory( | 224 ComponentUpdateService* ComponentUpdateServiceFactory( |
| 230 ComponentUpdateService::Configurator* config); | 225 ComponentUpdateService::Configurator* config); |
| 231 | 226 |
| 227 // Convenience structure to use with component listing / enumeration. | |
| 228 struct CrxComponentInfo { | |
| 229 // |id| is currently derived from |CrxComponent.pk_hash|, see rest of the | |
| 230 // class implementation for details. | |
| 231 std::string id; | |
| 232 std::string version; | |
| 233 std::string name; | |
| 234 ComponentUpdateService::Status status; | |
| 235 CrxComponentInfo(); | |
| 236 ~CrxComponentInfo(); | |
| 237 }; | |
| 238 | |
| 232 } // namespace component_updater | 239 } // namespace component_updater |
| 233 | 240 |
| 234 #endif // CHROME_BROWSER_COMPONENT_UPDATER_COMPONENT_UPDATER_SERVICE_H_ | 241 #endif // CHROME_BROWSER_COMPONENT_UPDATER_COMPONENT_UPDATER_SERVICE_H_ |
| OLD | NEW |