Index: chrome/browser/extensions/crx_installer.cc |
diff --git a/chrome/browser/extensions/crx_installer.cc b/chrome/browser/extensions/crx_installer.cc |
index dd54f0637ba46f167bb5e360d560ebf2a5ef9c1e..e9797abadb4d52b6e55a93570d2f56f4fb5db90e 100644 |
--- a/chrome/browser/extensions/crx_installer.cc |
+++ b/chrome/browser/extensions/crx_installer.cc |
@@ -16,9 +16,9 @@ |
#include "base/sequenced_task_runner.h" |
#include "base/string_util.h" |
#include "base/stringprintf.h" |
+#include "base/threading/sequenced_worker_pool.h" |
#include "base/threading/thread_restrictions.h" |
#include "base/time.h" |
-#include "base/threading/sequenced_worker_pool.h" |
#include "base/utf_string_conversions.h" |
#include "base/version.h" |
#include "chrome/browser/browser_process.h" |
@@ -26,6 +26,7 @@ |
#include "chrome/browser/extensions/convert_web_app.h" |
#include "chrome/browser/extensions/extension_error_reporter.h" |
#include "chrome/browser/extensions/extension_install_ui.h" |
+#include "chrome/browser/extensions/extension_install_ui_default.h" |
#include "chrome/browser/extensions/extension_service.h" |
#include "chrome/browser/extensions/extension_system.h" |
#include "chrome/browser/extensions/management_policy.h" |
@@ -485,7 +486,7 @@ void CrxInstaller::InstallUIAbort(bool user_initiated) { |
content::Source<CrxInstaller>(this), |
content::NotificationService::NoDetails()); |
- NotifyCrxInstallComplete(NULL); |
+ NotifyCrxInstallComplete(false); |
Release(); // balanced in ConfirmInstall(). |
@@ -581,7 +582,7 @@ void CrxInstaller::ReportFailureFromUIThread(const CrxInstallerError& error) { |
if (client_) |
client_->OnInstallFailure(error); |
- NotifyCrxInstallComplete(NULL); |
+ NotifyCrxInstallComplete(false); |
// Delete temporary files. |
CleanupTempFiles(); |
@@ -625,22 +626,34 @@ void CrxInstaller::ReportSuccessFromUIThread() { |
perms_updater.GrantActivePermissions(extension_, record_oauth2_grant_); |
} |
- // Tell the frontend about the installation and hand off ownership of |
- // extension_ to it. |
- frontend_weak_->OnExtensionInstalled(extension_, |
- page_ordinal_, |
- has_requirement_errors_, |
- install_wait_for_idle_); |
- |
- NotifyCrxInstallComplete(extension_.get()); |
- |
- extension_ = NULL; |
+ // Install the extension if it's not blacklisted, but notify either way. |
+ ExtensionSystem::Get(profile_)->blacklist()->IsBlacklisted( |
+ extension_->id(), |
+ base::Bind(&CrxInstaller::HandleIsBlacklistedResponse, |
+ this, |
+ base::Bind(&ExtensionService::OnExtensionInstalled, |
+ frontend_weak_, |
+ extension_, |
+ page_ordinal_, |
+ has_requirement_errors_, |
+ install_wait_for_idle_))); |
+} |
- // We're done. We don't post any more tasks to ourselves so we are deleted |
- // soon. |
+void CrxInstaller::HandleIsBlacklistedResponse( |
+ const base::Closure& on_success, |
+ bool is_blacklisted) { |
+ if (is_blacklisted) { |
+ ExtensionInstallUIDefault(profile()).OnInstallFailure( |
+ extensions::CrxInstallerError( |
+ l10n_util::GetStringFUTF16(IDS_EXTENSION_IS_BLACKLISTED, |
+ UTF8ToUTF16(extension_->name())))); |
+ } else { |
+ on_success.Run(); |
+ } |
+ NotifyCrxInstallComplete(!is_blacklisted); |
} |
-void CrxInstaller::NotifyCrxInstallComplete(const Extension* extension) { |
+void CrxInstaller::NotifyCrxInstallComplete(bool success) { |
// Some users (such as the download shelf) need to know when a |
// CRXInstaller is done. Listening for the EXTENSION_* events |
// is problematic because they don't know anything about the |
@@ -649,7 +662,11 @@ void CrxInstaller::NotifyCrxInstallComplete(const Extension* extension) { |
content::NotificationService::current()->Notify( |
chrome::NOTIFICATION_CRX_INSTALLER_DONE, |
content::Source<CrxInstaller>(this), |
- content::Details<const Extension>(extension)); |
+ content::Details<const Extension>(success ? extension_.get() : NULL)); |
+ |
+ // We're done. We don't post any more tasks to ourselves so we are deleted |
+ // soon. |
+ extension_ = NULL; |
} |
void CrxInstaller::CleanupTempFiles() { |