Chromium Code Reviews| 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 net { | 14 namespace net { |
| 15 class URLRequestContextGetter; | 15 class URLRequestContextGetter; |
| 16 } | 16 } |
| 17 | 17 |
| 18 namespace base { | 18 namespace base { |
| 19 class DictionaryValue; | 19 class DictionaryValue; |
| 20 class FilePath; | 20 class FilePath; |
| 21 } | 21 } |
| 22 | 22 |
| 23 class ComponentInstaller; | |
|
cpu_(ooo_6.6-7.5)
2013/07/03 22:34:34
needed?
Sorin Jianu
2013/07/03 23:35:13
No. Removed.
| |
| 23 class ComponentPatcher; | 24 class ComponentPatcher; |
| 24 | 25 |
| 25 // Component specific installers must derive from this class and implement | 26 // Component specific installers must derive from this class and implement |
| 26 // OnUpdateError() and Install(). A valid instance of this class must be | 27 // OnUpdateError() and Install(). A valid instance of this class must be |
| 27 // given to ComponentUpdateService::RegisterComponent(). | 28 // given to ComponentUpdateService::RegisterComponent(). |
| 28 class ComponentInstaller { | 29 class ComponentInstaller { |
| 29 public : | 30 public : |
| 30 // Called by the component updater on the UI thread when there was a | 31 // Called by the component updater on the UI thread when there was a |
| 31 // problem unpacking or verifying the component. |error| is a non-zero | 32 // problem unpacking or verifying the component. |error| is a non-zero |
| 32 // value which is only meaningful to the component updater. | 33 // value which is only meaningful to the component updater. |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 84 public: | 85 public: |
| 85 enum Status { | 86 enum Status { |
| 86 kOk, | 87 kOk, |
| 87 kReplaced, | 88 kReplaced, |
| 88 kInProgress, | 89 kInProgress, |
| 89 kError | 90 kError |
| 90 }; | 91 }; |
| 91 // Controls the component updater behavior. | 92 // Controls the component updater behavior. |
| 92 class Configurator { | 93 class Configurator { |
| 93 public: | 94 public: |
| 94 enum Events { | |
| 95 kManifestCheck, | |
| 96 kComponentUpdated, | |
| 97 kManifestError, | |
| 98 kNetworkError, | |
| 99 kUnpackError, | |
| 100 kInstallerError | |
| 101 }; | |
| 102 | |
| 103 virtual ~Configurator() {} | 95 virtual ~Configurator() {} |
| 104 // Delay in seconds from calling Start() to the first update check. | 96 // Delay in seconds from calling Start() to the first update check. |
| 105 virtual int InitialDelay() = 0; | 97 virtual int InitialDelay() = 0; |
| 106 // Delay in seconds to every subsequent update check. 0 means don't check. | 98 // Delay in seconds to every subsequent update check. 0 means don't check. |
| 107 virtual int NextCheckDelay() = 0; | 99 virtual int NextCheckDelay() = 0; |
| 108 // Delay in seconds from each task step. Used to smooth out CPU/IO usage. | 100 // Delay in seconds from each task step. Used to smooth out CPU/IO usage. |
| 109 virtual int StepDelay() = 0; | 101 virtual int StepDelay() = 0; |
| 110 // Minimum delta time in seconds before checking again the same component. | 102 // Minimum delta time in seconds before checking again the same component. |
| 111 virtual int MinimumReCheckWait() = 0; | 103 virtual int MinimumReCheckWait() = 0; |
| 112 // Minimum delta time in seconds before an on-demand check is allowed | 104 // Minimum delta time in seconds before an on-demand check is allowed |
| 113 // for the same component. | 105 // for the same component. |
| 114 virtual int OnDemandDelay() = 0; | 106 virtual int OnDemandDelay() = 0; |
| 115 // The url that is going to be used update checks over Omaha protocol. | 107 // The url that is going to be used update checks over Omaha protocol. |
| 116 virtual GURL UpdateUrl() = 0; | 108 virtual GURL UpdateUrl() = 0; |
| 109 // The url where the completion pings are sent. Invalid if and only if | |
| 110 // pings are disabled. | |
| 111 virtual GURL PingUrl() = 0; | |
| 117 // Parameters added to each url request. It can be null if none are needed. | 112 // Parameters added to each url request. It can be null if none are needed. |
| 118 virtual const char* ExtraRequestParams() = 0; | 113 virtual const char* ExtraRequestParams() = 0; |
| 119 // How big each update request can be. Don't go above 2000. | 114 // How big each update request can be. Don't go above 2000. |
| 120 virtual size_t UrlSizeLimit() = 0; | 115 virtual size_t UrlSizeLimit() = 0; |
| 121 // The source of contexts for all the url requests. | 116 // The source of contexts for all the url requests. |
| 122 virtual net::URLRequestContextGetter* RequestContext() = 0; | 117 virtual net::URLRequestContextGetter* RequestContext() = 0; |
| 123 // True means that all ops are performed in this process. | 118 // True means that all ops are performed in this process. |
| 124 virtual bool InProcess() = 0; | 119 virtual bool InProcess() = 0; |
| 125 // The component updater will call this function when an interesting event | |
| 126 // happens. It should be used mostly as a place to add application specific | |
| 127 // logging or telemetry. |extra| is |event| dependent. | |
| 128 virtual void OnEvent(Events event, int extra) = 0; | |
| 129 // Creates a new ComponentPatcher in a platform-specific way. This is useful | 120 // Creates a new ComponentPatcher in a platform-specific way. This is useful |
| 130 // for dependency injection. | 121 // for dependency injection. |
| 131 virtual ComponentPatcher* CreateComponentPatcher() = 0; | 122 virtual ComponentPatcher* CreateComponentPatcher() = 0; |
| 132 // True means that this client can handle delta updates. | 123 // True means that this client can handle delta updates. |
| 133 virtual bool DeltasEnabled() const = 0; | 124 virtual bool DeltasEnabled() const = 0; |
| 134 }; | 125 }; |
| 135 | 126 |
| 136 // Start doing update checks and installing new versions of registered | 127 // Start doing update checks and installing new versions of registered |
| 137 // components after Configurator::InitialDelay() seconds. | 128 // components after Configurator::InitialDelay() seconds. |
| 138 virtual Status Start() = 0; | 129 virtual Status Start() = 0; |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 158 | 149 |
| 159 virtual ~ComponentUpdateService() {} | 150 virtual ~ComponentUpdateService() {} |
| 160 }; | 151 }; |
| 161 | 152 |
| 162 // Creates the component updater. You must pass a valid |config| allocated on | 153 // Creates the component updater. You must pass a valid |config| allocated on |
| 163 // the heap which the component updater will own. | 154 // the heap which the component updater will own. |
| 164 ComponentUpdateService* ComponentUpdateServiceFactory( | 155 ComponentUpdateService* ComponentUpdateServiceFactory( |
| 165 ComponentUpdateService::Configurator* config); | 156 ComponentUpdateService::Configurator* config); |
| 166 | 157 |
| 167 #endif // CHROME_BROWSER_COMPONENT_UPDATER_COMPONENT_UPDATER_SERVICE_H_ | 158 #endif // CHROME_BROWSER_COMPONENT_UPDATER_COMPONENT_UPDATER_SERVICE_H_ |
| OLD | NEW |