| 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 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 // Save the last check time, and schedule the next check. | 268 // Save the last check time, and schedule the next check. |
| 269 int64_t now = Time::Now().ToInternalValue(); | 269 int64_t now = Time::Now().ToInternalValue(); |
| 270 prefs_->SetInt64(pref_names::kLastUpdateCheck, now); | 270 prefs_->SetInt64(pref_names::kLastUpdateCheck, now); |
| 271 ScheduleNextCheck(TimeDelta::FromSeconds(frequency_seconds_)); | 271 ScheduleNextCheck(TimeDelta::FromSeconds(frequency_seconds_)); |
| 272 } | 272 } |
| 273 | 273 |
| 274 void ExtensionUpdater::CheckSoon() { | 274 void ExtensionUpdater::CheckSoon() { |
| 275 DCHECK(alive_); | 275 DCHECK(alive_); |
| 276 if (will_check_soon_) | 276 if (will_check_soon_) |
| 277 return; | 277 return; |
| 278 if (BrowserThread::PostTask( | 278 if (BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, |
| 279 BrowserThread::UI, FROM_HERE, | 279 base::BindOnce(&ExtensionUpdater::DoCheckSoon, |
| 280 base::Bind(&ExtensionUpdater::DoCheckSoon, | 280 weak_ptr_factory_.GetWeakPtr()))) { |
| 281 weak_ptr_factory_.GetWeakPtr()))) { | |
| 282 will_check_soon_ = true; | 281 will_check_soon_ = true; |
| 283 } else { | 282 } else { |
| 284 NOTREACHED(); | 283 NOTREACHED(); |
| 285 } | 284 } |
| 286 } | 285 } |
| 287 | 286 |
| 288 bool ExtensionUpdater::WillCheckSoon() const { | 287 bool ExtensionUpdater::WillCheckSoon() const { |
| 289 return will_check_soon_; | 288 return will_check_soon_; |
| 290 } | 289 } |
| 291 | 290 |
| (...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 607 const InProgressCheck& request = requests_in_progress_[request_id]; | 606 const InProgressCheck& request = requests_in_progress_[request_id]; |
| 608 if (request.in_progress_ids_.empty()) { | 607 if (request.in_progress_ids_.empty()) { |
| 609 VLOG(2) << "Finished update check " << request_id; | 608 VLOG(2) << "Finished update check " << request_id; |
| 610 if (!request.callback.is_null()) | 609 if (!request.callback.is_null()) |
| 611 request.callback.Run(); | 610 request.callback.Run(); |
| 612 requests_in_progress_.erase(request_id); | 611 requests_in_progress_.erase(request_id); |
| 613 } | 612 } |
| 614 } | 613 } |
| 615 | 614 |
| 616 } // namespace extensions | 615 } // namespace extensions |
| OLD | NEW |