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 <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <set> | 10 #include <set> |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 | 262 |
263 // Save the time of next check. | 263 // Save the time of next check. |
264 Time next = Time::Now() + actual_delay; | 264 Time next = Time::Now() + actual_delay; |
265 prefs_->SetInt64(pref_names::kNextUpdateCheck, next.ToInternalValue()); | 265 prefs_->SetInt64(pref_names::kNextUpdateCheck, next.ToInternalValue()); |
266 | 266 |
267 timer_.Start(FROM_HERE, actual_delay, this, &ExtensionUpdater::TimerFired); | 267 timer_.Start(FROM_HERE, actual_delay, this, &ExtensionUpdater::TimerFired); |
268 } | 268 } |
269 | 269 |
270 void ExtensionUpdater::TimerFired() { | 270 void ExtensionUpdater::TimerFired() { |
271 DCHECK(alive_); | 271 DCHECK(alive_); |
272 CheckNow(default_params_); | 272 CheckNow(CheckParams()); |
273 | 273 |
274 // If the user has overridden the update frequency, don't bother reporting | 274 // If the user has overridden the update frequency, don't bother reporting |
275 // this. | 275 // this. |
276 if (frequency_seconds_ == extensions::kDefaultUpdateFrequencySeconds) { | 276 if (frequency_seconds_ == extensions::kDefaultUpdateFrequencySeconds) { |
277 Time last = Time::FromInternalValue(prefs_->GetInt64( | 277 Time last = Time::FromInternalValue(prefs_->GetInt64( |
278 pref_names::kLastUpdateCheck)); | 278 pref_names::kLastUpdateCheck)); |
279 if (last.ToInternalValue() != 0) { | 279 if (last.ToInternalValue() != 0) { |
280 // Use counts rather than time so we can use minutes rather than millis. | 280 // Use counts rather than time so we can use minutes rather than millis. |
281 UMA_HISTOGRAM_CUSTOM_COUNTS("Extensions.UpdateCheckGap", | 281 UMA_HISTOGRAM_CUSTOM_COUNTS("Extensions.UpdateCheckGap", |
282 (Time::Now() - last).InMinutes(), | 282 (Time::Now() - last).InMinutes(), |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
314 ExtensionCache* extension_cache) { | 314 ExtensionCache* extension_cache) { |
315 extension_cache_ = extension_cache; | 315 extension_cache_ = extension_cache; |
316 } | 316 } |
317 | 317 |
318 void ExtensionUpdater::StopTimerForTesting() { | 318 void ExtensionUpdater::StopTimerForTesting() { |
319 timer_.Stop(); | 319 timer_.Stop(); |
320 } | 320 } |
321 | 321 |
322 void ExtensionUpdater::DoCheckSoon() { | 322 void ExtensionUpdater::DoCheckSoon() { |
323 DCHECK(will_check_soon_); | 323 DCHECK(will_check_soon_); |
324 CheckNow(default_params_); | 324 CheckNow(CheckParams()); |
325 will_check_soon_ = false; | 325 will_check_soon_ = false; |
326 } | 326 } |
327 | 327 |
328 void ExtensionUpdater::AddToDownloader( | 328 void ExtensionUpdater::AddToDownloader( |
329 const ExtensionSet* extensions, | 329 const ExtensionSet* extensions, |
330 const std::list<std::string>& pending_ids, | 330 const std::list<std::string>& pending_ids, |
331 int request_id) { | 331 int request_id) { |
332 InProgressCheck& request = requests_in_progress_[request_id]; | 332 InProgressCheck& request = requests_in_progress_[request_id]; |
333 for (ExtensionSet::const_iterator extension_iter = extensions->begin(); | 333 for (ExtensionSet::const_iterator extension_iter = extensions->begin(); |
334 extension_iter != extensions->end(); ++extension_iter) { | 334 extension_iter != extensions->end(); ++extension_iter) { |
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
673 const InProgressCheck& request = requests_in_progress_[request_id]; | 673 const InProgressCheck& request = requests_in_progress_[request_id]; |
674 if (request.in_progress_ids_.empty()) { | 674 if (request.in_progress_ids_.empty()) { |
675 VLOG(2) << "Finished update check " << request_id; | 675 VLOG(2) << "Finished update check " << request_id; |
676 if (!request.callback.is_null()) | 676 if (!request.callback.is_null()) |
677 request.callback.Run(); | 677 request.callback.Run(); |
678 requests_in_progress_.erase(request_id); | 678 requests_in_progress_.erase(request_id); |
679 } | 679 } |
680 } | 680 } |
681 | 681 |
682 } // namespace extensions | 682 } // namespace extensions |
OLD | NEW |