Index: chrome/browser/extensions/extension_service.cc |
diff --git a/chrome/browser/extensions/extension_service.cc b/chrome/browser/extensions/extension_service.cc |
index f095f9e76d3658de7a7e348f1711eaf449258a02..7926e45231e83bbed828e6b22c63f0436c425439 100644 |
--- a/chrome/browser/extensions/extension_service.cc |
+++ b/chrome/browser/extensions/extension_service.cc |
@@ -2100,7 +2100,8 @@ void ExtensionService::UpdateActiveExtensionsInCrashReporter() { |
void ExtensionService::OnExtensionInstalled( |
const Extension* extension, |
bool from_webstore, |
- const StringOrdinal& page_ordinal) { |
+ const StringOrdinal& page_ordinal, |
+ const std::vector<std::string>& requirement_errors) { |
CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
// Ensure extension is deleted unless we transfer ownership. |
@@ -2147,6 +2148,18 @@ void ExtensionService::OnExtensionInstalled( |
} |
} |
+ // Unsupported requirements overrides the management policy. |
+ if (!requirement_errors.empty()) { |
+ initial_enable = false; |
+ // If the extension was disabled because of unsupported requirements but |
+ // now supports all requirements after an update, enable it and clear |
+ // the errors. The case where the extension has different requirement errors |
+ // will be handled later. |
+ } else if (extension_prefs_->HasUnsupportedRequirements(id)) { |
+ initial_enable = true; |
+ extension_prefs_->ClearUnsupportedRequirements(id); |
+ } |
+ |
// Do not record the install histograms for upgrades. |
if (!GetExtensionByIdInternal(extension->id(), true, true, false)) { |
UMA_HISTOGRAM_ENUMERATION("Extensions.InstallType", |
@@ -2167,6 +2180,12 @@ void ExtensionService::OnExtensionInstalled( |
from_webstore, |
page_ordinal); |
+ if (!requirement_errors.empty()) { |
+ extension_prefs_->SetDisableReason( |
+ id, Extension::DISABLE_UNSUPPORTED_REQUIREMENT); |
+ extension_prefs_->SetUnsupportedRequirements(id, requirement_errors); |
+ } |
+ |
// Unpacked extensions default to allowing file access, but if that has been |
// overridden, don't reset the value. |
if (Extension::ShouldAlwaysAllowFileAccess(extension->location()) && |