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 #include "chrome/browser/extensions/updater/extension_updater.h" | 5 #include "chrome/browser/extensions/updater/extension_updater.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 | 207 |
208 ExtensionUpdater::ExtensionUpdater( | 208 ExtensionUpdater::ExtensionUpdater( |
209 ExtensionServiceInterface* service, | 209 ExtensionServiceInterface* service, |
210 ExtensionPrefs* extension_prefs, | 210 ExtensionPrefs* extension_prefs, |
211 PrefService* prefs, | 211 PrefService* prefs, |
212 Profile* profile, | 212 Profile* profile, |
213 int frequency_seconds, | 213 int frequency_seconds, |
214 ExtensionCache* cache, | 214 ExtensionCache* cache, |
215 const ExtensionDownloader::Factory& downloader_factory) | 215 const ExtensionDownloader::Factory& downloader_factory) |
216 : alive_(false), | 216 : alive_(false), |
217 weak_ptr_factory_(this), | |
218 service_(service), | 217 service_(service), |
219 downloader_factory_(downloader_factory), | 218 downloader_factory_(downloader_factory), |
220 frequency_seconds_(frequency_seconds), | 219 frequency_seconds_(frequency_seconds), |
221 will_check_soon_(false), | 220 will_check_soon_(false), |
222 extension_prefs_(extension_prefs), | 221 extension_prefs_(extension_prefs), |
223 prefs_(prefs), | 222 prefs_(prefs), |
224 profile_(profile), | 223 profile_(profile), |
225 next_request_id_(0), | 224 next_request_id_(0), |
226 extension_registry_observer_(this), | 225 extension_registry_observer_(this), |
227 crx_install_is_running_(false), | 226 crx_install_is_running_(false), |
228 extension_cache_(cache) { | 227 extension_cache_(cache), |
| 228 weak_ptr_factory_(this) { |
229 DCHECK_GE(frequency_seconds_, 5); | 229 DCHECK_GE(frequency_seconds_, 5); |
230 DCHECK_LE(frequency_seconds_, kMaxUpdateFrequencySeconds); | 230 DCHECK_LE(frequency_seconds_, kMaxUpdateFrequencySeconds); |
231 #if defined(NDEBUG) | 231 #if defined(NDEBUG) |
232 // In Release mode we enforce that update checks don't happen too often. | 232 // In Release mode we enforce that update checks don't happen too often. |
233 frequency_seconds_ = std::max(frequency_seconds_, kMinUpdateFrequencySeconds); | 233 frequency_seconds_ = std::max(frequency_seconds_, kMinUpdateFrequencySeconds); |
234 #endif | 234 #endif |
235 frequency_seconds_ = std::min(frequency_seconds_, kMaxUpdateFrequencySeconds); | 235 frequency_seconds_ = std::min(frequency_seconds_, kMaxUpdateFrequencySeconds); |
236 | 236 |
237 extension_registry_observer_.Add(ExtensionRegistry::Get(profile)); | 237 extension_registry_observer_.Add(ExtensionRegistry::Get(profile)); |
238 } | 238 } |
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
743 const InProgressCheck& request = requests_in_progress_[request_id]; | 743 const InProgressCheck& request = requests_in_progress_[request_id]; |
744 if (request.in_progress_ids_.empty()) { | 744 if (request.in_progress_ids_.empty()) { |
745 VLOG(2) << "Finished update check " << request_id; | 745 VLOG(2) << "Finished update check " << request_id; |
746 if (!request.callback.is_null()) | 746 if (!request.callback.is_null()) |
747 request.callback.Run(); | 747 request.callback.Run(); |
748 requests_in_progress_.erase(request_id); | 748 requests_in_progress_.erase(request_id); |
749 } | 749 } |
750 } | 750 } |
751 | 751 |
752 } // namespace extensions | 752 } // namespace extensions |
OLD | NEW |