| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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/component_updater/component_updater_service.h" | 5 #include "chrome/browser/component_updater/component_updater_service.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <set> | 8 #include <set> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 652 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 663 allow_background_download = workitem->component.allow_background_download; | 663 allow_background_download = workitem->component.allow_background_download; |
| 664 urls = &workitem->crx_urls; | 664 urls = &workitem->crx_urls; |
| 665 ChangeItemState(workitem, CrxUpdateItem::kDownloading); | 665 ChangeItemState(workitem, CrxUpdateItem::kDownloading); |
| 666 } | 666 } |
| 667 | 667 |
| 668 // On demand component updates are always downloaded in foreground. | 668 // On demand component updates are always downloaded in foreground. |
| 669 const bool is_background_download = | 669 const bool is_background_download = |
| 670 !workitem->on_demand && allow_background_download && | 670 !workitem->on_demand && allow_background_download && |
| 671 config_->UseBackgroundDownloader(); | 671 config_->UseBackgroundDownloader(); |
| 672 | 672 |
| 673 crx_downloader_.reset(CrxDownloader::Create( | 673 crx_downloader_.reset(CrxDownloader::Create(is_background_download, |
| 674 is_background_download, | 674 config_->RequestContext(), |
| 675 config_->RequestContext(), | 675 blocking_task_runner_)); |
| 676 blocking_task_runner_, | 676 crx_downloader_->StartDownload(*urls, |
| 677 base::Bind(&CrxUpdateService::DownloadComplete, | 677 base::Bind(&CrxUpdateService::DownloadComplete, |
| 678 base::Unretained(this), | 678 base::Unretained(this), |
| 679 base::Passed(&crx_context)))); | 679 base::Passed(&crx_context))); |
| 680 crx_downloader_->StartDownload(*urls); | |
| 681 } | 680 } |
| 682 | 681 |
| 683 void CrxUpdateService::UpdateCheckComplete( | 682 void CrxUpdateService::UpdateCheckComplete( |
| 684 int error, | 683 int error, |
| 685 const std::string& error_message, | 684 const std::string& error_message, |
| 686 const UpdateResponse::Results& results) { | 685 const UpdateResponse::Results& results) { |
| 687 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 686 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 688 update_checker_.reset(); | 687 update_checker_.reset(); |
| 689 if (!error) | 688 if (!error) |
| 690 OnUpdateCheckSucceeded(results); | 689 OnUpdateCheckSucceeded(results); |
| (...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1009 // The component update factory. Using the component updater as a singleton | 1008 // The component update factory. Using the component updater as a singleton |
| 1010 // is the job of the browser process. | 1009 // is the job of the browser process. |
| 1011 ComponentUpdateService* ComponentUpdateServiceFactory( | 1010 ComponentUpdateService* ComponentUpdateServiceFactory( |
| 1012 ComponentUpdateService::Configurator* config) { | 1011 ComponentUpdateService::Configurator* config) { |
| 1013 DCHECK(config); | 1012 DCHECK(config); |
| 1014 return new CrxUpdateService(config); | 1013 return new CrxUpdateService(config); |
| 1015 } | 1014 } |
| 1016 | 1015 |
| 1017 } // namespace component_updater | 1016 } // namespace component_updater |
| 1018 | 1017 |
| OLD | NEW |