| 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 6fd762b55d735ac1ae04ee73d838b741e4b1b02b..fdb0073f4e052266a8d75236515f58e08009ee96 100644
|
| --- a/chrome/browser/extensions/webstore_standalone_installer.cc
|
| +++ b/chrome/browser/extensions/webstore_standalone_installer.cc
|
| @@ -13,6 +13,7 @@
|
| #include "chrome/browser/profiles/profile.h"
|
| #include "content/public/browser/web_contents.h"
|
| #include "extensions/browser/extension_prefs.h"
|
| +#include "extensions/browser/extension_registry.h"
|
| #include "extensions/browser/extension_system.h"
|
| #include "extensions/browser/extension_util.h"
|
| #include "extensions/common/extension.h"
|
| @@ -231,32 +232,34 @@ void WebstoreStandaloneInstaller::InstallUIProceed() {
|
| return;
|
| }
|
|
|
| + scoped_ptr<WebstoreInstaller::Approval> approval = CreateApproval();
|
| +
|
| 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 if (!util::IsEphemeralApp(extension->id(), profile_)) {
|
| - // else extension is installed and enabled; no work to be done.
|
| - CompleteInstall(install_result);
|
| - return;
|
| - }
|
|
|
| - // TODO(tmdiep): Optimize installation of ephemeral apps. For now we just
|
| - // reinstall the app.
|
| + if (ExtensionPrefs::Get(profile_)->IsExtensionBlacklisted(id_)) {
|
| + // Don't install a blacklisted extension.
|
| + install_result = kExtensionIsBlacklisted;
|
| + } else if (util::IsEphemeralApp(extension->id(), profile_) &&
|
| + !approval->is_ephemeral) {
|
| + // If the target extension has already been installed ephemerally, it can
|
| + // be promoted to a regular installed extension and downloading from the
|
| + // Web Store is not necessary.
|
| + extension_service->InstallEphemeralApp(extension, true);
|
| + } else if (!extension_service->IsExtensionEnabled(id_)) {
|
| + // If the extension is installed but disabled, and not blacklisted,
|
| + // enable it.
|
| + extension_service->EnableExtension(id_);
|
| + } // 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(
|
| profile_,
|
| this,
|
|
|