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

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

Issue 25713007: Component updater on-demand logic with ResourceThrottle (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: xxx Created 7 years, 1 month 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
« no previous file with comments | « no previous file | chrome/browser/component_updater/component_updater_service.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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;
21 } 26 }
22 27
23 class ComponentPatcher; 28 class ComponentPatcher;
24 29
25 // Component specific installers must derive from this class and implement 30 // Component specific installers must derive from this class and implement
26 // OnUpdateError() and Install(). A valid instance of this class must be 31 // OnUpdateError() and Install(). A valid instance of this class must be
27 // given to ComponentUpdateService::RegisterComponent(). 32 // given to ComponentUpdateService::RegisterComponent().
28 class ComponentInstaller { 33 class ComponentInstaller {
29 public : 34 public :
30 // Called by the component updater on the UI thread when there was a 35 // 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
181 // will not be canceled. 186 // will not be canceled.
182 virtual Status Stop() = 0; 187 virtual Status Stop() = 0;
183 188
184 // Add component to be checked for updates. You can call this method 189 // Add component to be checked for updates. You can call this method
185 // before calling Start(). 190 // before calling Start().
186 virtual Status RegisterComponent(const CrxComponent& component) = 0; 191 virtual Status RegisterComponent(const CrxComponent& component) = 0;
187 192
188 // Returns a list of registered components. 193 // Returns a list of registered components.
189 virtual void GetComponents(std::vector<CrxComponentInfo>* components) = 0; 194 virtual void GetComponents(std::vector<CrxComponentInfo>* components) = 0;
190 195
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
191 virtual ~ComponentUpdateService() {} 202 virtual ~ComponentUpdateService() {}
192 203
193 // TODO(waffles): Remove PNaCl as a friend once an alternative on-demand 204 // TODO(waffles): Remove PNaCl as a friend once an alternative on-demand
194 // trigger is available. 205 // trigger is available.
195 friend class ComponentsUI; 206 friend class ComponentsUI;
196 friend class PnaclComponentInstaller; 207 friend class PnaclComponentInstaller;
197 friend class OnDemandTester; 208 friend class OnDemandTester;
198 209
199 private: 210 private:
200 // Ask the component updater to do an update check for a previously 211 // Ask the component updater to do an update check for a previously
201 // registered component, immediately. If an update or check is already 212 // registered component, immediately. If an update or check is already
202 // in progress, returns |kInProgress|. 213 // in progress, returns |kInProgress|.
203 // There is no guarantee that the item will actually be updated, 214 // There is no guarantee that the item will actually be updated,
204 // since an update may not be available. Listeners for the component will 215 // since an update may not be available. Listeners for the component will
205 // know the outcome of the check. 216 // know the outcome of the check.
206 virtual Status OnDemandUpdate(const std::string& component_id) = 0; 217 virtual Status OnDemandUpdate(const std::string& component_id) = 0;
207 }; 218 };
208 219
209 // Creates the component updater. You must pass a valid |config| allocated on 220 // Creates the component updater. You must pass a valid |config| allocated on
210 // the heap which the component updater will own. 221 // the heap which the component updater will own.
211 ComponentUpdateService* ComponentUpdateServiceFactory( 222 ComponentUpdateService* ComponentUpdateServiceFactory(
212 ComponentUpdateService::Configurator* config); 223 ComponentUpdateService::Configurator* config);
213 224
214 #endif // CHROME_BROWSER_COMPONENT_UPDATER_COMPONENT_UPDATER_SERVICE_H_ 225 #endif // CHROME_BROWSER_COMPONENT_UPDATER_COMPONENT_UPDATER_SERVICE_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/component_updater/component_updater_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698