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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 CrxUpdateItem; |
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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 | 190 |
200 // Stop doing update checks. In-flight requests and pending installations | 191 // Stop doing update checks. In-flight requests and pending installations |
201 // will not be canceled. | 192 // will not be canceled. |
202 virtual Status Stop() = 0; | 193 virtual Status Stop() = 0; |
203 | 194 |
204 // Add component to be checked for updates. You can call this method | 195 // Add component to be checked for updates. You can call this method |
205 // before calling Start(). | 196 // before calling Start(). |
206 virtual Status RegisterComponent(const CrxComponent& component) = 0; | 197 virtual Status RegisterComponent(const CrxComponent& component) = 0; |
207 | 198 |
208 // Returns a list of registered components. | 199 // Returns a list of registered components. |
209 virtual void GetComponents(std::vector<CrxComponentInfo>* components) = 0; | 200 virtual std::vector<std::string> GetComponentIDs() const = 0; |
| 201 |
| 202 // Returns details about registered component. |
| 203 // Note: Object returned here is owned by this class, in simple words |
| 204 // don't try to free this object. |
| 205 virtual CrxUpdateItem* GetComponentDetails( |
| 206 const std::string& component_id) const = 0; |
210 | 207 |
211 // Returns an interface for on-demand updates. On-demand updates are | 208 // Returns an interface for on-demand updates. On-demand updates are |
212 // proactively triggered outside the normal component update service schedule. | 209 // proactively triggered outside the normal component update service schedule. |
213 virtual OnDemandUpdater& GetOnDemandUpdater() = 0; | 210 virtual OnDemandUpdater& GetOnDemandUpdater() = 0; |
214 | 211 |
215 virtual ~ComponentUpdateService() {} | 212 virtual ~ComponentUpdateService() {} |
216 | 213 |
217 private: | 214 private: |
218 friend class ::ComponentsUI; | 215 friend class ::ComponentsUI; |
219 }; | 216 }; |
(...skipping 22 matching lines...) Expand all Loading... |
242 // service notifications to get an indication about the outcome of the | 239 // service notifications to get an indication about the outcome of the |
243 // on-demand update. | 240 // on-demand update. |
244 virtual ComponentUpdateService::Status OnDemandUpdate( | 241 virtual ComponentUpdateService::Status OnDemandUpdate( |
245 const std::string& component_id) = 0; | 242 const std::string& component_id) = 0; |
246 }; | 243 }; |
247 | 244 |
248 // Creates the component updater. You must pass a valid |config| allocated on | 245 // Creates the component updater. You must pass a valid |config| allocated on |
249 // the heap which the component updater will own. | 246 // the heap which the component updater will own. |
250 ComponentUpdateService* ComponentUpdateServiceFactory( | 247 ComponentUpdateService* ComponentUpdateServiceFactory( |
251 ComponentUpdateService::Configurator* config); | 248 ComponentUpdateService::Configurator* config); |
252 | |
253 } // namespace component_updater | 249 } // namespace component_updater |
254 | 250 |
255 #endif // CHROME_BROWSER_COMPONENT_UPDATER_COMPONENT_UPDATER_SERVICE_H_ | 251 #endif // CHROME_BROWSER_COMPONENT_UPDATER_COMPONENT_UPDATER_SERVICE_H_ |
OLD | NEW |