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

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

Issue 313373004: Eliminate the cooldown for direct calls to on-demand updates in CUS. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 months 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 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/gtest_prod_util.h"
11 #include "base/version.h" 12 #include "base/version.h"
12 #include "url/gurl.h" 13 #include "url/gurl.h"
13 14
14 class ComponentsUI; 15 class ComponentsUI;
15 16
16 namespace base { 17 namespace base {
17 class DictionaryValue; 18 class DictionaryValue;
18 class FilePath; 19 class FilePath;
19 } 20 }
20 21
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 // will not be canceled. 193 // will not be canceled.
193 virtual Status Stop() = 0; 194 virtual Status Stop() = 0;
194 195
195 // Add component to be checked for updates. You can call this method 196 // Add component to be checked for updates. You can call this method
196 // before calling Start(). 197 // before calling Start().
197 virtual Status RegisterComponent(const CrxComponent& component) = 0; 198 virtual Status RegisterComponent(const CrxComponent& component) = 0;
198 199
199 // Returns a list of registered components. 200 // Returns a list of registered components.
200 virtual std::vector<std::string> GetComponentIDs() const = 0; 201 virtual std::vector<std::string> GetComponentIDs() const = 0;
201 202
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;
207
208 // Returns an interface for on-demand updates. On-demand updates are 203 // Returns an interface for on-demand updates. On-demand updates are
209 // proactively triggered outside the normal component update service schedule. 204 // proactively triggered outside the normal component update service schedule.
210 virtual OnDemandUpdater& GetOnDemandUpdater() = 0; 205 virtual OnDemandUpdater& GetOnDemandUpdater() = 0;
211 206
212 virtual ~ComponentUpdateService() {} 207 virtual ~ComponentUpdateService() {}
213 208
214 private: 209 private:
210 // Returns details about registered component. The object returned is owned
211 // by this class. TODO(sorin): replace with a WeakPtr.
212 virtual CrxUpdateItem* GetComponentDetails(
213 const std::string& component_id) const = 0;
214
215 friend class ::ComponentsUI; 215 friend class ::ComponentsUI;
216 FRIEND_TEST_ALL_PREFIXES(ComponentUpdaterTest, ResourceThrottleLiveNoUpdate);
216 }; 217 };
217 218
218 typedef ComponentUpdateService::Observer ServiceObserver; 219 typedef ComponentUpdateService::Observer ServiceObserver;
219 220
220 class OnDemandUpdater { 221 class OnDemandUpdater {
221 public: 222 public:
222 virtual ~OnDemandUpdater() {} 223 virtual ~OnDemandUpdater() {}
223 224
224 // Returns a network resource throttle. It means that a component will be 225 // Returns a network resource throttle. It means that a component will be
225 // downloaded and installed before the resource is unthrottled. This function 226 // downloaded and installed before the resource is unthrottled. This function
226 // can be called from the IO thread. 227 // can be called from the IO thread. The function implements a cooldown
228 // interval of 30 minutes. That means it will ineffective to call the
229 // function before the cooldown interval has passed. This behavior is intended
230 // to be defensive against programming bugs, usually triggered by web fetches,
231 // where the on-demand functionality is invoked too often.
227 virtual content::ResourceThrottle* GetOnDemandResourceThrottle( 232 virtual content::ResourceThrottle* GetOnDemandResourceThrottle(
228 net::URLRequest* request, 233 net::URLRequest* request,
229 const std::string& crx_id) = 0; 234 const std::string& crx_id) = 0;
230 235
231 private: 236 private:
232 friend class OnDemandTester; 237 friend class OnDemandTester;
233 friend class ::ComponentsUI; 238 friend class ::ComponentsUI;
234 239
235 // Triggers an update check for a component. |component_id| is a value 240 // Triggers an update check for a component. |component_id| is a value
236 // returned by GetCrxComponentID(). If an update for this component is already 241 // returned by GetCrxComponentID(). If an update for this component is already
237 // in progress, the function returns |kInProgress|. If an update is available, 242 // in progress, the function returns |kInProgress|. If an update is available,
238 // the update will be applied. The caller can subscribe to component update 243 // the update will be applied. The caller can subscribe to component update
239 // service notifications to get an indication about the outcome of the 244 // service notifications to get an indication about the outcome of the
240 // on-demand update. 245 // on-demand update. The function does not implement any cooldown interval.
241 virtual ComponentUpdateService::Status OnDemandUpdate( 246 virtual ComponentUpdateService::Status OnDemandUpdate(
242 const std::string& component_id) = 0; 247 const std::string& component_id) = 0;
243 }; 248 };
244 249
245 // Creates the component updater. You must pass a valid |config| allocated on 250 // Creates the component updater. You must pass a valid |config| allocated on
246 // the heap which the component updater will own. 251 // the heap which the component updater will own.
247 ComponentUpdateService* ComponentUpdateServiceFactory( 252 ComponentUpdateService* ComponentUpdateServiceFactory(
248 ComponentUpdateService::Configurator* config); 253 ComponentUpdateService::Configurator* config);
249 } // namespace component_updater 254 } // namespace component_updater
250 255
251 #endif // CHROME_BROWSER_COMPONENT_UPDATER_COMPONENT_UPDATER_SERVICE_H_ 256 #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