Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(278)

Unified Diff: chrome/browser/extensions/webstore_standalone_installer.cc

Issue 297263003: Optimize promotion of ephemeral apps (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/extensions/webstore_installer.cc ('k') | chrome/chrome_tests.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..91662ea6750c4fd732d894f2b803da64b3c321f8 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->PromoteEphemeralApp(extension, false);
+ } 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,
« no previous file with comments | « chrome/browser/extensions/webstore_installer.cc ('k') | chrome/chrome_tests.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698