| Index: chrome/browser/extensions/webstore_standalone_installer.cc
|
| diff --git a/chrome/browser/extensions/webstore_standalone_installer.cc b/chrome/browser/extensions/webstore_standalone_installer.cc
|
| index 731c145ce38334ef14900811e55da28f4188389f..603c5d857e31b030db790f2a905a2e4401f5d3f8 100644
|
| --- a/chrome/browser/extensions/webstore_standalone_installer.cc
|
| +++ b/chrome/browser/extensions/webstore_standalone_installer.cc
|
| @@ -8,7 +8,9 @@
|
| #include "chrome/browser/extensions/crx_installer.h"
|
| #include "chrome/browser/extensions/extension_install_prompt.h"
|
| #include "chrome/browser/extensions/extension_install_ui.h"
|
| +#include "chrome/browser/extensions/extension_prefs.h"
|
| #include "chrome/browser/extensions/extension_service.h"
|
| +#include "chrome/browser/extensions/extension_system.h"
|
| #include "chrome/browser/extensions/webstore_data_fetcher.h"
|
| #include "chrome/browser/profiles/profile.h"
|
| #include "content/public/browser/web_contents.h"
|
| @@ -34,7 +36,7 @@ const char kWebstoreRequestError[] =
|
| const char kInvalidWebstoreResponseError[] = "Invalid Chrome Web Store reponse";
|
| const char kInvalidManifestError[] = "Invalid manifest";
|
| const char kUserCancelledError[] = "User cancelled install";
|
| -
|
| +const char kExtensionIsBlacklisted[] = "Extension is blacklisted";
|
|
|
| WebstoreStandaloneInstaller::WebstoreStandaloneInstaller(
|
| const std::string& webstore_item_id,
|
| @@ -237,6 +239,25 @@ void WebstoreStandaloneInstaller::InstallUIProceed() {
|
| return;
|
| }
|
|
|
| + ExtensionService* extension_service =
|
| + ExtensionSystem::Get(profile_)->extension_service();
|
| + const Extension* extension =
|
| + extension_service->GetExtensionById(id_, true /* include disabled */);
|
| + if (extension) {
|
| + std::string install_result; // Empty string for install success.
|
| + if (!extension_service->IsExtensionEnabled(id_)) {
|
| + if (!ExtensionPrefs::Get(profile_)->IsExtensionBlacklisted(id_)) {
|
| + // If the extension is installed but disabled, and not blacklisted,
|
| + // enable it.
|
| + extension_service->EnableExtension(id_);
|
| + } else { // Don't install a blacklisted extension.
|
| + install_result = kExtensionIsBlacklisted;
|
| + }
|
| + } // else extension is installed and enabled; no work to be done.
|
| + CompleteInstall(install_result);
|
| + return;
|
| + }
|
| +
|
| scoped_ptr<WebstoreInstaller::Approval> approval = CreateApproval();
|
|
|
| scoped_refptr<WebstoreInstaller> installer = new WebstoreInstaller(
|
|
|