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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 | 112 |
113 // Starts an update check right now, instead of waiting for the next | 113 // Starts an update check right now, instead of waiting for the next |
114 // regularly scheduled check or a pending check from CheckSoon(). | 114 // regularly scheduled check or a pending check from CheckSoon(). |
115 void CheckNow(const CheckParams& params); | 115 void CheckNow(const CheckParams& params); |
116 | 116 |
117 // Returns true iff CheckSoon() has been called but the update check | 117 // Returns true iff CheckSoon() has been called but the update check |
118 // hasn't been performed yet. This is used mostly by tests; calling | 118 // hasn't been performed yet. This is used mostly by tests; calling |
119 // code should just call CheckSoon(). | 119 // code should just call CheckSoon(). |
120 bool WillCheckSoon() const; | 120 bool WillCheckSoon() const; |
121 | 121 |
122 // Changes the params that are used for the automatic periodic update checks, | |
123 // as well as for explicit calls to CheckSoon. | |
124 void set_default_check_params(const CheckParams& params) { | |
125 default_params_ = params; | |
126 } | |
127 | |
128 // Overrides the extension cache with |extension_cache| for testing. | 122 // Overrides the extension cache with |extension_cache| for testing. |
129 void SetExtensionCacheForTesting(ExtensionCache* extension_cache); | 123 void SetExtensionCacheForTesting(ExtensionCache* extension_cache); |
130 | 124 |
131 // Stop the timer to prevent scheduled updates for testing. | 125 // Stop the timer to prevent scheduled updates for testing. |
132 void StopTimerForTesting(); | 126 void StopTimerForTesting(); |
133 | 127 |
134 private: | 128 private: |
135 friend class ExtensionUpdaterTest; | 129 friend class ExtensionUpdaterTest; |
136 friend class ExtensionUpdaterFileHandler; | 130 friend class ExtensionUpdaterFileHandler; |
137 | 131 |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 extension_registry_observer_; | 258 extension_registry_observer_; |
265 | 259 |
266 // True when a CrxInstaller is doing an install. Used in MaybeUpdateCrxFile() | 260 // True when a CrxInstaller is doing an install. Used in MaybeUpdateCrxFile() |
267 // to keep more than one install from running at once. | 261 // to keep more than one install from running at once. |
268 bool crx_install_is_running_; | 262 bool crx_install_is_running_; |
269 | 263 |
270 // Fetched CRX files waiting to be installed. | 264 // Fetched CRX files waiting to be installed. |
271 std::stack<FetchedCRXFile> fetched_crx_files_; | 265 std::stack<FetchedCRXFile> fetched_crx_files_; |
272 FetchedCRXFile current_crx_file_; | 266 FetchedCRXFile current_crx_file_; |
273 | 267 |
274 CheckParams default_params_; | |
275 | |
276 ExtensionCache* extension_cache_; | 268 ExtensionCache* extension_cache_; |
277 | 269 |
278 // Keeps track of when an extension tried to update itself, so we can throttle | 270 // Keeps track of when an extension tried to update itself, so we can throttle |
279 // checks to prevent too many requests from being made. | 271 // checks to prevent too many requests from being made. |
280 std::map<std::string, ThrottleInfo> throttle_info_; | 272 std::map<std::string, ThrottleInfo> throttle_info_; |
281 | 273 |
282 base::WeakPtrFactory<ExtensionUpdater> weak_ptr_factory_; | 274 base::WeakPtrFactory<ExtensionUpdater> weak_ptr_factory_; |
283 | 275 |
284 DISALLOW_COPY_AND_ASSIGN(ExtensionUpdater); | 276 DISALLOW_COPY_AND_ASSIGN(ExtensionUpdater); |
285 }; | 277 }; |
286 | 278 |
287 } // namespace extensions | 279 } // namespace extensions |
288 | 280 |
289 #endif // CHROME_BROWSER_EXTENSIONS_UPDATER_EXTENSION_UPDATER_H_ | 281 #endif // CHROME_BROWSER_EXTENSIONS_UPDATER_EXTENSION_UPDATER_H_ |
OLD | NEW |