Chromium Code Reviews| Index: chrome/browser/component_updater/component_updater_service.h |
| diff --git a/chrome/browser/component_updater/component_updater_service.h b/chrome/browser/component_updater/component_updater_service.h |
| index 6dec6016c6b239a6f139ccab0d623263b7efa6f8..30e4d057a66252329df8ae239308d30279dc5178 100644 |
| --- a/chrome/browser/component_updater/component_updater_service.h |
| +++ b/chrome/browser/component_updater/component_updater_service.h |
| @@ -8,6 +8,7 @@ |
| #include <string> |
| #include <vector> |
| +#include "base/callback_forward.h" |
| #include "base/gtest_prod_util.h" |
| #include "base/memory/ref_counted.h" |
| #include "base/version.h" |
| @@ -167,9 +168,15 @@ class ComponentUpdateService { |
| // Returns a list of registered components. |
| virtual std::vector<std::string> GetComponentIDs() const = 0; |
| - // Returns an interface for on-demand updates. On-demand updates are |
| - // proactively triggered outside the normal component update service schedule. |
| - virtual OnDemandUpdater& GetOnDemandUpdater() = 0; |
| + // |callback| is called on the main thread once the component with |crx_id| |
| + // is downloaded and installed. |callback| may be called synchronously |
| + // if component is already installed. The function implements a cooldown |
| + // interval of 30 minutes. That means it will ineffective to call the |
| + // function before the cooldown interval has passed. This behavior is intended |
| + // to be defensive against programming bugs, usually triggered by web fetches, |
| + // where the on-demand functionality is invoked too often. |
| + virtual void MaybeThrottle(const std::string& crx_id, |
| + const base::Closure& callback) = 0; |
| // Returns a task runner suitable for use by component installers. |
| virtual scoped_refptr<base::SequencedTaskRunner> GetSequencedTaskRunner() = 0; |
| @@ -177,36 +184,14 @@ class ComponentUpdateService { |
| virtual ~ComponentUpdateService() {} |
| private: |
| + friend class OnDemandTester; |
| + friend class ::ComponentsUI; |
| + |
| // Returns details about registered component in the |item| parameter. The |
| // function returns true in case of success and false in case of errors. |
| virtual bool GetComponentDetails(const std::string& component_id, |
| CrxUpdateItem* item) const = 0; |
| - friend class ::ComponentsUI; |
| - FRIEND_TEST_ALL_PREFIXES(ComponentUpdaterTest, ResourceThrottleLiveNoUpdate); |
| -}; |
| - |
| -typedef ComponentUpdateService::Observer ServiceObserver; |
| - |
| -class OnDemandUpdater { |
|
Sorin Jianu
2014/07/31 00:16:01
The idea here is that we want to have a class, whe
tommycli
2014/07/31 18:00:04
Done. Makes sense. I restored this class.
I left
|
| - public: |
| - virtual ~OnDemandUpdater() {} |
| - |
| - // Returns a network resource throttle. It means that a component will be |
| - // downloaded and installed before the resource is unthrottled. This function |
| - // can be called from the IO thread. The function implements a cooldown |
| - // interval of 30 minutes. That means it will ineffective to call the |
| - // function before the cooldown interval has passed. This behavior is intended |
| - // to be defensive against programming bugs, usually triggered by web fetches, |
| - // where the on-demand functionality is invoked too often. |
| - virtual content::ResourceThrottle* GetOnDemandResourceThrottle( |
| - net::URLRequest* request, |
| - const std::string& crx_id) = 0; |
| - |
| - private: |
| - friend class OnDemandTester; |
| - friend class ::ComponentsUI; |
| - |
| // Triggers an update check for a component. |component_id| is a value |
| // returned by GetCrxComponentID(). If an update for this component is already |
| // in progress, the function returns |kInProgress|. If an update is available, |
| @@ -217,6 +202,8 @@ class OnDemandUpdater { |
| const std::string& component_id) = 0; |
| }; |
| +typedef ComponentUpdateService::Observer ServiceObserver; |
| + |
| // Creates the component updater. You must pass a valid |config| allocated on |
| // the heap which the component updater will own. |
| ComponentUpdateService* ComponentUpdateServiceFactory(Configurator* config); |