| 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 <memory> | 10 #include <memory> |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 | 62 |
| 63 // The set of extensions that should be checked for updates. If empty | 63 // The set of extensions that should be checked for updates. If empty |
| 64 // all extensions will be included in the update check. | 64 // all extensions will be included in the update check. |
| 65 std::list<std::string> ids; | 65 std::list<std::string> ids; |
| 66 | 66 |
| 67 // Normally extension updates get installed only when the extension is idle. | 67 // Normally extension updates get installed only when the extension is idle. |
| 68 // Setting this to true causes any updates that are found to be installed | 68 // Setting this to true causes any updates that are found to be installed |
| 69 // right away. | 69 // right away. |
| 70 bool install_immediately; | 70 bool install_immediately; |
| 71 | 71 |
| 72 // An extension update check can be originated by a user or by a timer. |
| 73 // When the value of |foreground_check| is true, the update request was |
| 74 // initiated by a user. |
| 75 bool foreground_check; |
| 76 |
| 72 // Callback to call when the update check is complete. Can be null, if | 77 // Callback to call when the update check is complete. Can be null, if |
| 73 // you're not interested in when this happens. | 78 // you're not interested in when this happens. |
| 74 FinishedCallback callback; | 79 FinishedCallback callback; |
| 75 }; | 80 }; |
| 76 | 81 |
| 77 // Holds a pointer to the passed |service|, using it for querying installed | 82 // Holds a pointer to the passed |service|, using it for querying installed |
| 78 // extensions and installing updated ones. The |frequency_seconds| parameter | 83 // extensions and installing updated ones. The |frequency_seconds| parameter |
| 79 // controls how often update checks are scheduled. | 84 // controls how often update checks are scheduled. |
| 80 ExtensionUpdater(ExtensionServiceInterface* service, | 85 ExtensionUpdater(ExtensionServiceInterface* service, |
| 81 ExtensionPrefs* extension_prefs, | 86 ExtensionPrefs* extension_prefs, |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 // Sets the timer to call TimerFired after roughly |target_delay| from now. | 165 // Sets the timer to call TimerFired after roughly |target_delay| from now. |
| 161 // To help spread load evenly on servers, this method adds some random | 166 // To help spread load evenly on servers, this method adds some random |
| 162 // jitter. It also saves the scheduled time so it can be reloaded on | 167 // jitter. It also saves the scheduled time so it can be reloaded on |
| 163 // browser restart. | 168 // browser restart. |
| 164 void ScheduleNextCheck(const base::TimeDelta& target_delay); | 169 void ScheduleNextCheck(const base::TimeDelta& target_delay); |
| 165 | 170 |
| 166 // Add fetch records for extensions that are installed to the downloader, | 171 // Add fetch records for extensions that are installed to the downloader, |
| 167 // ignoring |pending_ids| so the extension isn't fetched again. | 172 // ignoring |pending_ids| so the extension isn't fetched again. |
| 168 void AddToDownloader(const ExtensionSet* extensions, | 173 void AddToDownloader(const ExtensionSet* extensions, |
| 169 const std::list<std::string>& pending_ids, | 174 const std::list<std::string>& pending_ids, |
| 170 int request_id); | 175 int request_id, |
| 176 bool foreground_check); |
| 171 | 177 |
| 172 // BaseTimer::ReceiverMethod callback. | 178 // BaseTimer::ReceiverMethod callback. |
| 173 void TimerFired(); | 179 void TimerFired(); |
| 174 | 180 |
| 175 // Posted by CheckSoon(). | 181 // Posted by CheckSoon(). |
| 176 void DoCheckSoon(); | 182 void DoCheckSoon(); |
| 177 | 183 |
| 178 // Implementation of ExtensionDownloaderDelegate. | 184 // Implementation of ExtensionDownloaderDelegate. |
| 179 void OnExtensionDownloadFailed(const std::string& id, | 185 void OnExtensionDownloadFailed(const std::string& id, |
| 180 Error error, | 186 Error error, |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 ExtensionCache* extension_cache_; | 257 ExtensionCache* extension_cache_; |
| 252 | 258 |
| 253 base::WeakPtrFactory<ExtensionUpdater> weak_ptr_factory_; | 259 base::WeakPtrFactory<ExtensionUpdater> weak_ptr_factory_; |
| 254 | 260 |
| 255 DISALLOW_COPY_AND_ASSIGN(ExtensionUpdater); | 261 DISALLOW_COPY_AND_ASSIGN(ExtensionUpdater); |
| 256 }; | 262 }; |
| 257 | 263 |
| 258 } // namespace extensions | 264 } // namespace extensions |
| 259 | 265 |
| 260 #endif // CHROME_BROWSER_EXTENSIONS_UPDATER_EXTENSION_UPDATER_H_ | 266 #endif // CHROME_BROWSER_EXTENSIONS_UPDATER_EXTENSION_UPDATER_H_ |
| OLD | NEW |