| 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/crx_installer.h" | 5 #include "chrome/browser/extensions/crx_installer.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <set> | 8 #include <set> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 // See header file comment on |client_| for why we use a raw pointer here. | 119 // See header file comment on |client_| for why we use a raw pointer here. |
| 120 client_(client.release()), | 120 client_(client.release()), |
| 121 apps_require_extension_mime_type_(false), | 121 apps_require_extension_mime_type_(false), |
| 122 allow_silent_install_(false), | 122 allow_silent_install_(false), |
| 123 install_cause_(extension_misc::INSTALL_CAUSE_UNSET), | 123 install_cause_(extension_misc::INSTALL_CAUSE_UNSET), |
| 124 creation_flags_(Extension::NO_FLAGS), | 124 creation_flags_(Extension::NO_FLAGS), |
| 125 off_store_install_allow_reason_(OffStoreInstallDisallowed), | 125 off_store_install_allow_reason_(OffStoreInstallDisallowed), |
| 126 did_handle_successfully_(true), | 126 did_handle_successfully_(true), |
| 127 error_on_unsupported_requirements_(false), | 127 error_on_unsupported_requirements_(false), |
| 128 has_requirement_errors_(false), | 128 has_requirement_errors_(false), |
| 129 blacklist_state_(extensions::Blacklist::NOT_BLACKLISTED), | 129 blacklist_state_(extensions::NOT_BLACKLISTED), |
| 130 install_wait_for_idle_(true), | 130 install_wait_for_idle_(true), |
| 131 update_from_settings_page_(false), | 131 update_from_settings_page_(false), |
| 132 installer_(service_weak->profile()) { | 132 installer_(service_weak->profile()) { |
| 133 installer_task_runner_ = service_weak->GetFileTaskRunner(); | 133 installer_task_runner_ = service_weak->GetFileTaskRunner(); |
| 134 if (!approval) | 134 if (!approval) |
| 135 return; | 135 return; |
| 136 | 136 |
| 137 CHECK(profile()->IsSameProfile(approval->profile)); | 137 CHECK(profile()->IsSameProfile(approval->profile)); |
| 138 if (client_) { | 138 if (client_) { |
| 139 client_->install_ui()->SetUseAppInstalledBubble( | 139 client_->install_ui()->SetUseAppInstalledBubble( |
| (...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 512 } | 512 } |
| 513 has_requirement_errors_ = true; | 513 has_requirement_errors_ = true; |
| 514 } | 514 } |
| 515 | 515 |
| 516 ExtensionSystem::Get(profile())->blacklist()->IsBlacklisted( | 516 ExtensionSystem::Get(profile())->blacklist()->IsBlacklisted( |
| 517 extension()->id(), | 517 extension()->id(), |
| 518 base::Bind(&CrxInstaller::OnBlacklistChecked, this)); | 518 base::Bind(&CrxInstaller::OnBlacklistChecked, this)); |
| 519 } | 519 } |
| 520 | 520 |
| 521 void CrxInstaller::OnBlacklistChecked( | 521 void CrxInstaller::OnBlacklistChecked( |
| 522 extensions::Blacklist::BlacklistState blacklist_state) { | 522 extensions::BlacklistState blacklist_state) { |
| 523 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 523 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 524 if (!service_weak_) | 524 if (!service_weak_) |
| 525 return; | 525 return; |
| 526 | 526 |
| 527 blacklist_state_ = blacklist_state; | 527 blacklist_state_ = blacklist_state; |
| 528 | 528 |
| 529 if (blacklist_state_ == extensions::Blacklist::BLACKLISTED_MALWARE && | 529 if ((blacklist_state_ == extensions::BLACKLISTED_MALWARE || |
| 530 blacklist_state_ == extensions::BLACKLISTED_UNKNOWN) && |
| 530 !allow_silent_install_) { | 531 !allow_silent_install_) { |
| 531 // User tried to install a blacklisted extension. Show an error and | 532 // User tried to install a blacklisted extension. Show an error and |
| 532 // refuse to install it. | 533 // refuse to install it. |
| 533 ReportFailureFromUIThread(extensions::CrxInstallerError( | 534 ReportFailureFromUIThread(extensions::CrxInstallerError( |
| 534 l10n_util::GetStringFUTF16(IDS_EXTENSION_IS_BLACKLISTED, | 535 l10n_util::GetStringFUTF16(IDS_EXTENSION_IS_BLACKLISTED, |
| 535 UTF8ToUTF16(extension()->name())))); | 536 UTF8ToUTF16(extension()->name())))); |
| 536 UMA_HISTOGRAM_ENUMERATION("ExtensionBlacklist.BlockCRX", | 537 UMA_HISTOGRAM_ENUMERATION("ExtensionBlacklist.BlockCRX", |
| 537 extension()->location(), | 538 extension()->location(), |
| 538 Manifest::NUM_LOCATIONS); | 539 Manifest::NUM_LOCATIONS); |
| 539 return; | 540 return; |
| (...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 865 if (!prefs->DidExtensionEscalatePermissions(extension()->id())) | 866 if (!prefs->DidExtensionEscalatePermissions(extension()->id())) |
| 866 return; | 867 return; |
| 867 | 868 |
| 868 if (client_) { | 869 if (client_) { |
| 869 AddRef(); // Balanced in InstallUIProceed() and InstallUIAbort(). | 870 AddRef(); // Balanced in InstallUIProceed() and InstallUIAbort(). |
| 870 client_->ConfirmReEnable(this, extension()); | 871 client_->ConfirmReEnable(this, extension()); |
| 871 } | 872 } |
| 872 } | 873 } |
| 873 | 874 |
| 874 } // namespace extensions | 875 } // namespace extensions |
| OLD | NEW |