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

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

Issue 12054003: Add an API to component_updater that asks to do an update check "now". (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: move commandline check Created 7 years, 10 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
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
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 // During the normal operation of the component updater some specific 80 // During the normal operation of the component updater some specific
81 // notifications are fired, like COMPONENT_UPDATER_STARTED and 81 // notifications are fired, like COMPONENT_UPDATER_STARTED and
82 // COMPONENT_UPDATE_FOUND. See notification_type.h for more details. 82 // COMPONENT_UPDATE_FOUND. See notification_type.h for more details.
83 // 83 //
84 // All methods are safe to call ONLY from chrome's UI thread. 84 // All methods are safe to call ONLY from chrome's UI thread.
85 class ComponentUpdateService { 85 class ComponentUpdateService {
86 public: 86 public:
87 enum Status { 87 enum Status {
88 kOk, 88 kOk,
89 kReplaced, 89 kReplaced,
90 kInProgress,
90 kError 91 kError
91 }; 92 };
92 // Controls the component updater behavior. 93 // Controls the component updater behavior.
93 class Configurator { 94 class Configurator {
94 public: 95 public:
95 enum Events { 96 enum Events {
96 kManifestCheck, 97 kManifestCheck,
97 kComponentUpdated, 98 kComponentUpdated,
98 kManifestError, 99 kManifestError,
99 kNetworkError, 100 kNetworkError,
100 kUnpackError, 101 kUnpackError,
101 kInstallerError 102 kInstallerError
102 }; 103 };
103 104
104 virtual ~Configurator() {} 105 virtual ~Configurator() {}
105 // Delay in seconds from calling Start() to the first update check. 106 // Delay in seconds from calling Start() to the first update check.
106 virtual int InitialDelay() = 0; 107 virtual int InitialDelay() = 0;
107 // Delay in seconds to every subsequent update check. 0 means don't check. 108 // Delay in seconds to every subsequent update check. 0 means don't check.
108 virtual int NextCheckDelay() = 0; 109 virtual int NextCheckDelay() = 0;
109 // Delay in seconds from each task step. Used to smooth out CPU/IO usage. 110 // Delay in seconds from each task step. Used to smooth out CPU/IO usage.
110 virtual int StepDelay() = 0; 111 virtual int StepDelay() = 0;
111 // Minimun delta time in seconds before checking again the same component. 112 // Minimum delta time in seconds before checking again the same component.
112 virtual int MinimumReCheckWait() = 0; 113 virtual int MinimumReCheckWait() = 0;
114 // Minimum delta time in seconds before an on-demand check is allowed
115 // for the same component.
116 virtual int OnDemandDelay() = 0;
113 // The url that is going to be used update checks over Omaha protocol. 117 // The url that is going to be used update checks over Omaha protocol.
114 virtual GURL UpdateUrl(CrxComponent::UrlSource source) = 0; 118 virtual GURL UpdateUrl(CrxComponent::UrlSource source) = 0;
115 // Parameters added to each url request. It can be null if none are needed. 119 // Parameters added to each url request. It can be null if none are needed.
116 virtual const char* ExtraRequestParams() = 0; 120 virtual const char* ExtraRequestParams() = 0;
117 // How big each update request can be. Don't go above 2000. 121 // How big each update request can be. Don't go above 2000.
118 virtual size_t UrlSizeLimit() = 0; 122 virtual size_t UrlSizeLimit() = 0;
119 // The source of contexts for all the url requests. 123 // The source of contexts for all the url requests.
120 virtual net::URLRequestContextGetter* RequestContext() = 0; 124 virtual net::URLRequestContextGetter* RequestContext() = 0;
121 // True means that all ops are performed in this process. 125 // True means that all ops are performed in this process.
122 virtual bool InProcess() = 0; 126 virtual bool InProcess() = 0;
123 // The component updater will call this function when an interesting event 127 // The component updater will call this function when an interesting event
124 // happens. It should be used mostly as a place to add application specific 128 // happens. It should be used mostly as a place to add application specific
125 // logging or telemetry. |extra| is |event| dependent. 129 // logging or telemetry. |extra| is |event| dependent.
126 virtual void OnEvent(Events event, int extra) = 0; 130 virtual void OnEvent(Events event, int extra) = 0;
127 }; 131 };
128 132
129 // Start doing update checks and installing new versions of registered 133 // Start doing update checks and installing new versions of registered
130 // components after Configurator::InitialDelay() seconds. 134 // components after Configurator::InitialDelay() seconds.
131 virtual Status Start() = 0; 135 virtual Status Start() = 0;
132 136
133 // Stop doing update checks. In-flight requests and pending installations 137 // Stop doing update checks. In-flight requests and pending installations
134 // will not be canceled. 138 // will not be canceled.
135 virtual Status Stop() = 0; 139 virtual Status Stop() = 0;
136 140
137 // Add component to be checked for updates. You can call this method 141 // Add component to be checked for updates. You can call this method
138 // before calling Start(). 142 // before calling Start().
139 virtual Status RegisterComponent(const CrxComponent& component) = 0; 143 virtual Status RegisterComponent(const CrxComponent& component) = 0;
140 144
145 // Ask the component updater to do an update check for a previously
146 // registered component, soon. If an update or check is already in progress,
147 // returns |kInProgress|. The same component cannot be checked repeatedly
148 // in a short interval either (returns |kError| if so).
149 // There is no guarantee that the item will actually be updated,
150 // since another item may be chosen to be updated. Since there is
151 // no time guarantee, there is no notification if the item is not updated.
152 // However, the ComponentInstaller should know if an update succeeded
153 // via the Install() hook.
154 virtual Status CheckForUpdateSoon(const CrxComponent& component) = 0;
155
141 virtual ~ComponentUpdateService() {} 156 virtual ~ComponentUpdateService() {}
142 }; 157 };
143 158
144 // Creates the component updater. You must pass a valid |config| allocated on 159 // Creates the component updater. You must pass a valid |config| allocated on
145 // the heap which the component updater will own. 160 // the heap which the component updater will own.
146 ComponentUpdateService* ComponentUpdateServiceFactory( 161 ComponentUpdateService* ComponentUpdateServiceFactory(
147 ComponentUpdateService::Configurator* config); 162 ComponentUpdateService::Configurator* config);
148 163
149 #endif // CHROME_BROWSER_COMPONENT_UPDATER_COMPONENT_UPDATER_SERVICE_H_ 164 #endif // CHROME_BROWSER_COMPONENT_UPDATER_COMPONENT_UPDATER_SERVICE_H_
150
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698