OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 namespace base { | 14 namespace base { |
15 class DictionaryValue; | 15 class DictionaryValue; |
16 class FilePath; | 16 class FilePath; |
17 } | 17 } |
18 | 18 |
19 namespace net { | 19 namespace net { |
20 class URLRequestContextGetter; | 20 class URLRequestContextGetter; |
21 class URLRequest; | |
22 } | |
23 | |
24 namespace content { | |
25 class ResourceThrottle; | |
26 } | 21 } |
27 | 22 |
28 class ComponentPatcher; | 23 class ComponentPatcher; |
29 | 24 |
30 // Component specific installers must derive from this class and implement | 25 // Component specific installers must derive from this class and implement |
31 // OnUpdateError() and Install(). A valid instance of this class must be | 26 // OnUpdateError() and Install(). A valid instance of this class must be |
32 // given to ComponentUpdateService::RegisterComponent(). | 27 // given to ComponentUpdateService::RegisterComponent(). |
33 class ComponentInstaller { | 28 class ComponentInstaller { |
34 public : | 29 public : |
35 // Called by the component updater on the UI thread when there was a | 30 // Called by the component updater on the UI thread when there was a |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 // will not be canceled. | 181 // will not be canceled. |
187 virtual Status Stop() = 0; | 182 virtual Status Stop() = 0; |
188 | 183 |
189 // Add component to be checked for updates. You can call this method | 184 // Add component to be checked for updates. You can call this method |
190 // before calling Start(). | 185 // before calling Start(). |
191 virtual Status RegisterComponent(const CrxComponent& component) = 0; | 186 virtual Status RegisterComponent(const CrxComponent& component) = 0; |
192 | 187 |
193 // Returns a list of registered components. | 188 // Returns a list of registered components. |
194 virtual void GetComponents(std::vector<CrxComponentInfo>* components) = 0; | 189 virtual void GetComponents(std::vector<CrxComponentInfo>* components) = 0; |
195 | 190 |
196 // Returns a network resource throttle. It means that a component will be | |
197 // downloaded and installed before the resource is unthrottled. This is the | |
198 // only function callable from the IO thread. | |
199 virtual content::ResourceThrottle* GetOnDemandResourceThrottle( | |
200 net::URLRequest* request, const std::string& crx_id) = 0; | |
201 | |
202 virtual ~ComponentUpdateService() {} | 191 virtual ~ComponentUpdateService() {} |
203 | 192 |
204 // TODO(waffles): Remove PNaCl as a friend once an alternative on-demand | 193 // TODO(waffles): Remove PNaCl as a friend once an alternative on-demand |
205 // trigger is available. | 194 // trigger is available. |
206 friend class ComponentsUI; | 195 friend class ComponentsUI; |
207 friend class PnaclComponentInstaller; | 196 friend class PnaclComponentInstaller; |
208 friend class OnDemandTester; | 197 friend class OnDemandTester; |
209 | 198 |
210 private: | 199 private: |
211 // Ask the component updater to do an update check for a previously | 200 // Ask the component updater to do an update check for a previously |
212 // registered component, immediately. If an update or check is already | 201 // registered component, immediately. If an update or check is already |
213 // in progress, returns |kInProgress|. | 202 // in progress, returns |kInProgress|. |
214 // There is no guarantee that the item will actually be updated, | 203 // There is no guarantee that the item will actually be updated, |
215 // since an update may not be available. Listeners for the component will | 204 // since an update may not be available. Listeners for the component will |
216 // know the outcome of the check. | 205 // know the outcome of the check. |
217 virtual Status OnDemandUpdate(const std::string& component_id) = 0; | 206 virtual Status OnDemandUpdate(const std::string& component_id) = 0; |
218 }; | 207 }; |
219 | 208 |
220 // Creates the component updater. You must pass a valid |config| allocated on | 209 // Creates the component updater. You must pass a valid |config| allocated on |
221 // the heap which the component updater will own. | 210 // the heap which the component updater will own. |
222 ComponentUpdateService* ComponentUpdateServiceFactory( | 211 ComponentUpdateService* ComponentUpdateServiceFactory( |
223 ComponentUpdateService::Configurator* config); | 212 ComponentUpdateService::Configurator* config); |
224 | 213 |
225 #endif // CHROME_BROWSER_COMPONENT_UPDATER_COMPONENT_UPDATER_SERVICE_H_ | 214 #endif // CHROME_BROWSER_COMPONENT_UPDATER_COMPONENT_UPDATER_SERVICE_H_ |
OLD | NEW |