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 |
11 #include "base/version.h" | 11 #include "base/version.h" |
12 #include "url/gurl.h" | 12 #include "url/gurl.h" |
13 | 13 |
| 14 class ComponentsUI; |
| 15 |
14 namespace base { | 16 namespace base { |
15 class DictionaryValue; | 17 class DictionaryValue; |
16 class FilePath; | 18 class FilePath; |
17 } | 19 } |
18 | 20 |
19 namespace net { | 21 namespace net { |
20 class URLRequestContextGetter; | 22 class URLRequestContextGetter; |
21 class URLRequest; | 23 class URLRequest; |
22 } | 24 } |
23 | 25 |
24 namespace component_updater { | 26 namespace component_updater { |
25 class OnDemandTester; | 27 class OnDemandTester; |
26 } | 28 } |
27 | 29 |
28 namespace content { | 30 namespace content { |
29 class ResourceThrottle; | 31 class ResourceThrottle; |
30 } | 32 } |
31 | 33 |
| 34 namespace component_updater { |
| 35 |
32 class ComponentPatcher; | 36 class ComponentPatcher; |
33 | 37 |
34 // Component specific installers must derive from this class and implement | 38 // Component specific installers must derive from this class and implement |
35 // OnUpdateError() and Install(). A valid instance of this class must be | 39 // OnUpdateError() and Install(). A valid instance of this class must be |
36 // given to ComponentUpdateService::RegisterComponent(). | 40 // given to ComponentUpdateService::RegisterComponent(). |
37 class ComponentInstaller { | 41 class ComponentInstaller { |
38 public : | 42 public : |
39 // Called by the component updater on the UI thread when there was a | 43 // Called by the component updater on the UI thread when there was a |
40 // problem unpacking or verifying the component. |error| is a non-zero | 44 // problem unpacking or verifying the component. |error| is a non-zero |
41 // value which is only meaningful to the component updater. | 45 // value which is only meaningful to the component updater. |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 virtual void GetComponents(std::vector<CrxComponentInfo>* components) = 0; | 202 virtual void GetComponents(std::vector<CrxComponentInfo>* components) = 0; |
199 | 203 |
200 // Returns a network resource throttle. It means that a component will be | 204 // Returns a network resource throttle. It means that a component will be |
201 // downloaded and installed before the resource is unthrottled. This is the | 205 // downloaded and installed before the resource is unthrottled. This is the |
202 // only function callable from the IO thread. | 206 // only function callable from the IO thread. |
203 virtual content::ResourceThrottle* GetOnDemandResourceThrottle( | 207 virtual content::ResourceThrottle* GetOnDemandResourceThrottle( |
204 net::URLRequest* request, const std::string& crx_id) = 0; | 208 net::URLRequest* request, const std::string& crx_id) = 0; |
205 | 209 |
206 virtual ~ComponentUpdateService() {} | 210 virtual ~ComponentUpdateService() {} |
207 | 211 |
208 friend class ComponentsUI; | 212 friend class ::ComponentsUI; |
209 friend class component_updater::OnDemandTester; | 213 friend class OnDemandTester; |
210 | 214 |
211 private: | 215 private: |
212 // Ask the component updater to do an update check for a previously | 216 // Ask the component updater to do an update check for a previously |
213 // registered component, immediately. If an update or check is already | 217 // registered component, immediately. If an update or check is already |
214 // in progress, returns |kInProgress|. | 218 // in progress, returns |kInProgress|. |
215 // There is no guarantee that the item will actually be updated, | 219 // There is no guarantee that the item will actually be updated, |
216 // since an update may not be available. Listeners for the component will | 220 // since an update may not be available. Listeners for the component will |
217 // know the outcome of the check. | 221 // know the outcome of the check. |
218 virtual Status OnDemandUpdate(const std::string& component_id) = 0; | 222 virtual Status OnDemandUpdate(const std::string& component_id) = 0; |
219 }; | 223 }; |
220 | 224 |
221 // Creates the component updater. You must pass a valid |config| allocated on | 225 // Creates the component updater. You must pass a valid |config| allocated on |
222 // the heap which the component updater will own. | 226 // the heap which the component updater will own. |
223 ComponentUpdateService* ComponentUpdateServiceFactory( | 227 ComponentUpdateService* ComponentUpdateServiceFactory( |
224 ComponentUpdateService::Configurator* config); | 228 ComponentUpdateService::Configurator* config); |
225 | 229 |
| 230 } // namespace component_updater |
| 231 |
226 #endif // CHROME_BROWSER_COMPONENT_UPDATER_COMPONENT_UPDATER_SERVICE_H_ | 232 #endif // CHROME_BROWSER_COMPONENT_UPDATER_COMPONENT_UPDATER_SERVICE_H_ |
OLD | NEW |