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

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

Issue 130393002: Make inline install for disabled items just re-enable (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Moved short-circuit code from BeginInstall to InstallUIProceed Created 6 years, 11 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 | « no previous file | no next file » | 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 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(
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698