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 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 | 95 |
96 ExtensionUpdater::CheckParams::CheckParams() | 96 ExtensionUpdater::CheckParams::CheckParams() |
97 : install_immediately(false) {} | 97 : install_immediately(false) {} |
98 | 98 |
99 ExtensionUpdater::CheckParams::~CheckParams() {} | 99 ExtensionUpdater::CheckParams::~CheckParams() {} |
100 | 100 |
101 ExtensionUpdater::FetchedCRXFile::FetchedCRXFile( | 101 ExtensionUpdater::FetchedCRXFile::FetchedCRXFile( |
102 const std::string& i, | 102 const std::string& i, |
103 const base::FilePath& p, | 103 const base::FilePath& p, |
104 bool file_ownership_passed, | 104 bool file_ownership_passed, |
105 const GURL& u, | |
106 const std::set<int>& request_ids) | 105 const std::set<int>& request_ids) |
107 : extension_id(i), | 106 : extension_id(i), |
108 path(p), | 107 path(p), |
109 file_ownership_passed(file_ownership_passed), | 108 file_ownership_passed(file_ownership_passed), |
110 download_url(u), | |
111 request_ids(request_ids) {} | 109 request_ids(request_ids) {} |
112 | 110 |
113 ExtensionUpdater::FetchedCRXFile::FetchedCRXFile() | 111 ExtensionUpdater::FetchedCRXFile::FetchedCRXFile() |
114 : path(), file_ownership_passed(true), download_url() {} | 112 : path(), file_ownership_passed(true) {} |
115 | 113 |
116 ExtensionUpdater::FetchedCRXFile::~FetchedCRXFile() {} | 114 ExtensionUpdater::FetchedCRXFile::~FetchedCRXFile() {} |
117 | 115 |
118 ExtensionUpdater::InProgressCheck::InProgressCheck() | 116 ExtensionUpdater::InProgressCheck::InProgressCheck() |
119 : install_immediately(false) {} | 117 : install_immediately(false) {} |
120 | 118 |
121 ExtensionUpdater::InProgressCheck::~InProgressCheck() {} | 119 ExtensionUpdater::InProgressCheck::~InProgressCheck() {} |
122 | 120 |
123 struct ExtensionUpdater::ThrottleInfo { | 121 struct ExtensionUpdater::ThrottleInfo { |
124 ThrottleInfo() | 122 ThrottleInfo() |
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
478 bool file_ownership_passed, | 476 bool file_ownership_passed, |
479 const GURL& download_url, | 477 const GURL& download_url, |
480 const std::string& version, | 478 const std::string& version, |
481 const PingResult& ping, | 479 const PingResult& ping, |
482 const std::set<int>& request_ids) { | 480 const std::set<int>& request_ids) { |
483 DCHECK(alive_); | 481 DCHECK(alive_); |
484 UpdatePingData(id, ping); | 482 UpdatePingData(id, ping); |
485 | 483 |
486 VLOG(2) << download_url << " written to " << path.value(); | 484 VLOG(2) << download_url << " written to " << path.value(); |
487 | 485 |
488 FetchedCRXFile fetched(id, path, file_ownership_passed, download_url, | 486 FetchedCRXFile fetched(id, path, file_ownership_passed, request_ids); |
489 request_ids); | |
490 fetched_crx_files_.push(fetched); | 487 fetched_crx_files_.push(fetched); |
491 | 488 |
492 // MaybeInstallCRXFile() removes extensions from |in_progress_ids_| after | 489 // MaybeInstallCRXFile() removes extensions from |in_progress_ids_| after |
493 // starting the crx installer. | 490 // starting the crx installer. |
494 MaybeInstallCRXFile(); | 491 MaybeInstallCRXFile(); |
495 } | 492 } |
496 | 493 |
497 bool ExtensionUpdater::GetPingDataForExtension( | 494 bool ExtensionUpdater::GetPingDataForExtension( |
498 const std::string& id, | 495 const std::string& id, |
499 ManifestFetchData::PingData* ping_data) { | 496 ManifestFetchData::PingData* ping_data) { |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
553 | 550 |
554 VLOG(2) << "updating " << crx_file.extension_id | 551 VLOG(2) << "updating " << crx_file.extension_id |
555 << " with " << crx_file.path.value(); | 552 << " with " << crx_file.path.value(); |
556 | 553 |
557 // The ExtensionService is now responsible for cleaning up the temp file | 554 // The ExtensionService is now responsible for cleaning up the temp file |
558 // at |crx_file.path|. | 555 // at |crx_file.path|. |
559 CrxInstaller* installer = NULL; | 556 CrxInstaller* installer = NULL; |
560 if (service_->UpdateExtension(crx_file.extension_id, | 557 if (service_->UpdateExtension(crx_file.extension_id, |
561 crx_file.path, | 558 crx_file.path, |
562 crx_file.file_ownership_passed, | 559 crx_file.file_ownership_passed, |
563 crx_file.download_url, | |
564 &installer)) { | 560 &installer)) { |
565 crx_install_is_running_ = true; | 561 crx_install_is_running_ = true; |
566 current_crx_file_ = crx_file; | 562 current_crx_file_ = crx_file; |
567 | 563 |
568 for (std::set<int>::const_iterator it = crx_file.request_ids.begin(); | 564 for (std::set<int>::const_iterator it = crx_file.request_ids.begin(); |
569 it != crx_file.request_ids.end(); ++it) { | 565 it != crx_file.request_ids.end(); ++it) { |
570 InProgressCheck& request = requests_in_progress_[*it]; | 566 InProgressCheck& request = requests_in_progress_[*it]; |
571 if (request.install_immediately) { | 567 if (request.install_immediately) { |
572 installer->set_install_wait_for_idle(false); | 568 installer->set_install_wait_for_idle(false); |
573 break; | 569 break; |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
644 const InProgressCheck& request = requests_in_progress_[request_id]; | 640 const InProgressCheck& request = requests_in_progress_[request_id]; |
645 if (request.in_progress_ids_.empty()) { | 641 if (request.in_progress_ids_.empty()) { |
646 VLOG(2) << "Finished update check " << request_id; | 642 VLOG(2) << "Finished update check " << request_id; |
647 if (!request.callback.is_null()) | 643 if (!request.callback.is_null()) |
648 request.callback.Run(); | 644 request.callback.Run(); |
649 requests_in_progress_.erase(request_id); | 645 requests_in_progress_.erase(request_id); |
650 } | 646 } |
651 } | 647 } |
652 | 648 |
653 } // namespace extensions | 649 } // namespace extensions |
OLD | NEW |