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