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_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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <list> | |
| 9 #include <set> | 10 #include <set> |
|
Aaron Boodman
2012/04/09 17:02:14
Is the set include still necessary?
mitchellwrosen
2012/04/13 22:20:18
Nope!
| |
| 10 #include <stack> | 11 #include <stack> |
| 11 #include <string> | 12 #include <string> |
| 12 | 13 |
| 13 #include "base/compiler_specific.h" | 14 #include "base/compiler_specific.h" |
| 14 #include "base/file_path.h" | 15 #include "base/file_path.h" |
| 15 #include "base/gtest_prod_util.h" | 16 #include "base/gtest_prod_util.h" |
| 16 #include "base/memory/scoped_ptr.h" | 17 #include "base/memory/scoped_ptr.h" |
| 17 #include "base/memory/weak_ptr.h" | 18 #include "base/memory/weak_ptr.h" |
| 18 #include "base/time.h" | 19 #include "base/time.h" |
| 19 #include "base/timer.h" | 20 #include "base/timer.h" |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 106 | 107 |
| 107 // Sets the timer to call TimerFired after roughly |target_delay| from now. | 108 // Sets the timer to call TimerFired after roughly |target_delay| from now. |
| 108 // To help spread load evenly on servers, this method adds some random | 109 // To help spread load evenly on servers, this method adds some random |
| 109 // jitter. It also saves the scheduled time so it can be reloaded on | 110 // jitter. It also saves the scheduled time so it can be reloaded on |
| 110 // browser restart. | 111 // browser restart. |
| 111 void ScheduleNextCheck(const base::TimeDelta& target_delay); | 112 void ScheduleNextCheck(const base::TimeDelta& target_delay); |
| 112 | 113 |
| 113 // Add fetch records for extensions that are installed to the downloader, | 114 // Add fetch records for extensions that are installed to the downloader, |
| 114 // ignoring |pending_ids| so the extension isn't fetched again. | 115 // ignoring |pending_ids| so the extension isn't fetched again. |
| 115 void AddToDownloader(const ExtensionSet* extensions, | 116 void AddToDownloader(const ExtensionSet* extensions, |
| 116 const std::set<std::string>& pending_ids); | 117 const std::list<std::string>& pending_ids); |
| 117 | 118 |
| 118 // BaseTimer::ReceiverMethod callback. | 119 // BaseTimer::ReceiverMethod callback. |
| 119 void TimerFired(); | 120 void TimerFired(); |
| 120 | 121 |
| 121 // Posted by CheckSoon(). | 122 // Posted by CheckSoon(). |
| 122 void DoCheckSoon(); | 123 void DoCheckSoon(); |
| 123 | 124 |
| 124 // Implenentation of ExtensionDownloaderDelegate. | 125 // Implenentation of ExtensionDownloaderDelegate. |
| 125 virtual void OnExtensionDownloadFailed(const std::string& id, | 126 virtual void OnExtensionDownloadFailed(const std::string& id, |
| 126 Error error, | 127 Error error, |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 177 base::OneShotTimer<ExtensionUpdater> timer_; | 178 base::OneShotTimer<ExtensionUpdater> timer_; |
| 178 int frequency_seconds_; | 179 int frequency_seconds_; |
| 179 bool will_check_soon_; | 180 bool will_check_soon_; |
| 180 | 181 |
| 181 ExtensionPrefs* extension_prefs_; | 182 ExtensionPrefs* extension_prefs_; |
| 182 PrefService* prefs_; | 183 PrefService* prefs_; |
| 183 Profile* profile_; | 184 Profile* profile_; |
| 184 bool blacklist_checks_enabled_; | 185 bool blacklist_checks_enabled_; |
| 185 | 186 |
| 186 // The ids of extensions that have in-progress update checks. | 187 // The ids of extensions that have in-progress update checks. |
| 187 std::set<std::string> in_progress_ids_; | 188 std::list<std::string> in_progress_ids_; |
| 188 | 189 |
| 189 // Observes CRX installs we initiate. | 190 // Observes CRX installs we initiate. |
| 190 content::NotificationRegistrar registrar_; | 191 content::NotificationRegistrar registrar_; |
| 191 | 192 |
| 192 // True when a CrxInstaller is doing an install. Used in MaybeUpdateCrxFile() | 193 // True when a CrxInstaller is doing an install. Used in MaybeUpdateCrxFile() |
| 193 // to keep more than one install from running at once. | 194 // to keep more than one install from running at once. |
| 194 bool crx_install_is_running_; | 195 bool crx_install_is_running_; |
| 195 | 196 |
| 196 // Fetched CRX files waiting to be installed. | 197 // Fetched CRX files waiting to be installed. |
| 197 std::stack<FetchedCRXFile> fetched_crx_files_; | 198 std::stack<FetchedCRXFile> fetched_crx_files_; |
| 198 | 199 |
| 199 DISALLOW_COPY_AND_ASSIGN(ExtensionUpdater); | 200 DISALLOW_COPY_AND_ASSIGN(ExtensionUpdater); |
| 200 }; | 201 }; |
| 201 | 202 |
| 202 } // namespace extensions | 203 } // namespace extensions |
| 203 | 204 |
| 204 #endif // CHROME_BROWSER_EXTENSIONS_UPDATER_EXTENSION_UPDATER_H_ | 205 #endif // CHROME_BROWSER_EXTENSIONS_UPDATER_EXTENSION_UPDATER_H_ |
| OLD | NEW |