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_EXTENSIONS_UPDATER_EXTENSION_UPDATER_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_UPDATER_EXTENSION_UPDATER_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_UPDATER_EXTENSION_UPDATER_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_UPDATER_EXTENSION_UPDATER_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 #include <map> | 9 #include <map> |
10 #include <set> | 10 #include <set> |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
150 ~InProgressCheck(); | 150 ~InProgressCheck(); |
151 | 151 |
152 bool install_immediately; | 152 bool install_immediately; |
153 FinishedCallback callback; | 153 FinishedCallback callback; |
154 // The ids of extensions that have in-progress update checks. | 154 // The ids of extensions that have in-progress update checks. |
155 std::list<std::string> in_progress_ids_; | 155 std::list<std::string> in_progress_ids_; |
156 }; | 156 }; |
157 | 157 |
158 struct ThrottleInfo; | 158 struct ThrottleInfo; |
159 | 159 |
160 // Callback used to continue CheckNow after determining which extensions | |
161 // should be force-updated. | |
162 void OnForcedUpdatesDetermined(const CheckParams& params, | |
163 const std::set<std::string>& forced_updates); | |
164 | |
160 // Ensure that we have a valid ExtensionDownloader instance referenced by | 165 // Ensure that we have a valid ExtensionDownloader instance referenced by |
161 // |downloader|. | 166 // |downloader|. |
162 void EnsureDownloaderCreated(); | 167 void EnsureDownloaderCreated(); |
163 | 168 |
164 // Computes when to schedule the first update check. | 169 // Computes when to schedule the first update check. |
165 base::TimeDelta DetermineFirstCheckDelay(); | 170 base::TimeDelta DetermineFirstCheckDelay(); |
166 | 171 |
167 // Sets the timer to call TimerFired after roughly |target_delay| from now. | 172 // Sets the timer to call TimerFired after roughly |target_delay| from now. |
168 // To help spread load evenly on servers, this method adds some random | 173 // To help spread load evenly on servers, this method adds some random |
169 // jitter. It also saves the scheduled time so it can be reloaded on | 174 // jitter. It also saves the scheduled time so it can be reloaded on |
(...skipping 11 matching lines...) Expand all Loading... | |
181 | 186 |
182 // Posted by CheckSoon(). | 187 // Posted by CheckSoon(). |
183 void DoCheckSoon(); | 188 void DoCheckSoon(); |
184 | 189 |
185 // Implementation of ExtensionDownloaderDelegate. | 190 // Implementation of ExtensionDownloaderDelegate. |
186 virtual void OnExtensionDownloadFailed( | 191 virtual void OnExtensionDownloadFailed( |
187 const std::string& id, | 192 const std::string& id, |
188 Error error, | 193 Error error, |
189 const PingResult& ping, | 194 const PingResult& ping, |
190 const std::set<int>& request_ids) OVERRIDE; | 195 const std::set<int>& request_ids) OVERRIDE; |
191 | |
192 virtual void OnExtensionDownloadFinished( | 196 virtual void OnExtensionDownloadFinished( |
193 const std::string& id, | 197 const std::string& id, |
194 const base::FilePath& path, | 198 const base::FilePath& path, |
195 bool file_ownership_passed, | 199 bool file_ownership_passed, |
196 const GURL& download_url, | 200 const GURL& download_url, |
197 const std::string& version, | 201 const std::string& version, |
198 const PingResult& ping, | 202 const PingResult& ping, |
199 const std::set<int>& request_id) OVERRIDE; | 203 const std::set<int>& request_id) OVERRIDE; |
200 | |
201 // Implementation of ExtensionRegistryObserver. | |
202 virtual void OnExtensionWillBeInstalled( | |
203 content::BrowserContext* browser_context, | |
204 const Extension* extension, | |
205 bool is_update, | |
206 bool from_ephemeral, | |
207 const std::string& old_name) OVERRIDE; | |
208 | |
209 virtual bool GetPingDataForExtension( | 204 virtual bool GetPingDataForExtension( |
210 const std::string& id, | 205 const std::string& id, |
211 ManifestFetchData::PingData* ping_data) OVERRIDE; | 206 ManifestFetchData::PingData* ping_data) OVERRIDE; |
212 | |
213 virtual std::string GetUpdateUrlData(const std::string& id) OVERRIDE; | 207 virtual std::string GetUpdateUrlData(const std::string& id) OVERRIDE; |
214 | |
215 virtual bool IsExtensionPending(const std::string& id) OVERRIDE; | 208 virtual bool IsExtensionPending(const std::string& id) OVERRIDE; |
216 | |
217 virtual bool GetExtensionExistingVersion(const std::string& id, | 209 virtual bool GetExtensionExistingVersion(const std::string& id, |
218 std::string* version) OVERRIDE; | 210 std::string* version) OVERRIDE; |
211 virtual bool ShouldForceUpdate(const std::string& extension_id, | |
212 std::string* source) OVERRIDE; | |
219 | 213 |
220 void UpdatePingData(const std::string& id, const PingResult& ping_result); | 214 void UpdatePingData(const std::string& id, const PingResult& ping_result); |
221 | 215 |
222 // Starts installing a crx file that has been fetched but not installed yet. | 216 // Starts installing a crx file that has been fetched but not installed yet. |
223 void MaybeInstallCRXFile(); | 217 void MaybeInstallCRXFile(); |
224 | 218 |
225 // content::NotificationObserver implementation. | 219 // content::NotificationObserver implementation. |
226 virtual void Observe(int type, | 220 virtual void Observe(int type, |
227 const content::NotificationSource& source, | 221 const content::NotificationSource& source, |
228 const content::NotificationDetails& details) OVERRIDE; | 222 const content::NotificationDetails& details) OVERRIDE; |
229 | 223 |
224 // Implementation of ExtensionRegistryObserver. | |
225 virtual void OnExtensionWillBeInstalled( | |
226 content::BrowserContext* browser_context, | |
227 const Extension* extension, | |
228 bool is_update, | |
229 bool from_ephemeral, | |
230 const std::string& old_name) OVERRIDE; | |
231 | |
230 // Send a notification that update checks are starting. | 232 // Send a notification that update checks are starting. |
231 void NotifyStarted(); | 233 void NotifyStarted(); |
232 | 234 |
233 // Send a notification if we're finished updating. | 235 // Send a notification if we're finished updating. |
234 void NotifyIfFinished(int request_id); | 236 void NotifyIfFinished(int request_id); |
235 | 237 |
236 void ExtensionCheckFinished(const std::string& extension_id, | 238 void ExtensionCheckFinished(const std::string& extension_id, |
237 const FinishedCallback& callback); | 239 const FinishedCallback& callback); |
238 | 240 |
239 // Whether Start() has been called but not Stop(). | 241 // Whether Start() has been called but not Stop(). |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
277 FetchedCRXFile current_crx_file_; | 279 FetchedCRXFile current_crx_file_; |
278 | 280 |
279 CheckParams default_params_; | 281 CheckParams default_params_; |
280 | 282 |
281 ExtensionCache* extension_cache_; | 283 ExtensionCache* extension_cache_; |
282 | 284 |
283 // Keeps track of when an extension tried to update itself, so we can throttle | 285 // Keeps track of when an extension tried to update itself, so we can throttle |
284 // checks to prevent too many requests from being made. | 286 // checks to prevent too many requests from being made. |
285 std::map<std::string, ThrottleInfo> throttle_info_; | 287 std::map<std::string, ThrottleInfo> throttle_info_; |
286 | 288 |
289 // Keeps track of extensions whose update should be forced during the next | |
290 // update check. | |
Yoyo Zhou
2014/09/04 22:41:26
This comment should indicate that the set is of ex
Ken Rockot(use gerrit already)
2014/09/05 01:41:34
Done.
| |
291 std::set<std::string> forced_updates_; | |
292 | |
287 DISALLOW_COPY_AND_ASSIGN(ExtensionUpdater); | 293 DISALLOW_COPY_AND_ASSIGN(ExtensionUpdater); |
288 }; | 294 }; |
289 | 295 |
290 } // namespace extensions | 296 } // namespace extensions |
291 | 297 |
292 #endif // CHROME_BROWSER_EXTENSIONS_UPDATER_EXTENSION_UPDATER_H_ | 298 #endif // CHROME_BROWSER_EXTENSIONS_UPDATER_EXTENSION_UPDATER_H_ |
OLD | NEW |