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

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

Issue 93513006: Allow re-enabling of DISABLE_NOT_VERIFIED extensions if appropriate (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ready for review Created 7 years 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
Index: chrome/browser/extensions/extension_service.cc
diff --git a/chrome/browser/extensions/extension_service.cc b/chrome/browser/extensions/extension_service.cc
index f8245a56f3b091a404eb01a27badbf9469934199..30fb8d390fc448bb067a91913e275f4d8332b476 100644
--- a/chrome/browser/extensions/extension_service.cc
+++ b/chrome/browser/extensions/extension_service.cc
@@ -888,8 +888,17 @@ void ExtensionService::EnableExtension(const std::string& extension_id) {
const Extension* extension = disabled_extensions_.GetByID(extension_id);
ManagementPolicy* policy = system_->management_policy();
- if (extension && policy->MustRemainDisabled(extension, NULL, NULL)) {
+ Extension::DisableReason reason;
+ if (extension && policy->MustRemainDisabled(extension, &reason, NULL)) {
UMA_HISTOGRAM_COUNTS_100("Extensions.EnableDeniedByPolicy", 1);
+ if (reason == Extension::DISABLE_NOT_VERIFIED) {
+ // Try adding this id to the verified list, and if it succeeds we may
+ // be able to enable it.
+ extensions::ExtensionSystem::Get(profile_)->install_verifier()->Add(
+ extension->id(), base::Bind(&ExtensionService::EnableOnVerifySuccess,
+ base::Unretained(this),
+ extension_id));
Finnur 2013/12/11 17:28:20 I'm worried this will slam the webstore with lots
asargent_no_longer_on_chrome 2013/12/11 21:26:05 I think this should only happen as a result of the
Finnur 2013/12/11 21:46:31 Does the only codepath through this function invol
+ }
return;
}
@@ -2788,6 +2797,17 @@ void ExtensionService::ManageBlacklist(const std::set<std::string>& updated) {
IdentifyAlertableExtensions();
}
+void ExtensionService::EnableOnVerifySuccess(std::string extension_id,
+ bool verify_success) {
+ ManagementPolicy* policy = system_->management_policy();
+ const Extension* extension = GetExtensionById(extension_id, true);
+ if (verify_success && !IsExtensionEnabled(extension_id) &&
+ !policy->MustRemainDisabled(extension, NULL, NULL)) {
Finnur 2013/12/11 17:28:20 We're guaranteed to have this check in other locat
asargent_no_longer_on_chrome 2013/12/11 21:26:05 Yeah, I agree this is a little awkward. The proble
Finnur 2013/12/11 21:46:31 As discussed in person I had a concern that we hav
+ EnableExtension(extension_id);
+ }
Finnur 2013/12/11 17:28:20 nit: Single line if body, no braces.
asargent_no_longer_on_chrome 2013/12/11 21:26:05 Done.
+}
+
+
void ExtensionService::AddUpdateObserver(extensions::UpdateObserver* observer) {
update_observers_.AddObserver(observer);
}

Powered by Google App Engine
This is Rietveld 408576698