Chromium Code Reviews| Index: chrome/browser/extensions/extension_service.cc |
| diff --git a/chrome/browser/extensions/extension_service.cc b/chrome/browser/extensions/extension_service.cc |
| index b4f927a3d6e276d662c5977cd4a6e4d33219b5a0..f94b506d5ca1920dd3564852452ac702a5344f2e 100644 |
| --- a/chrome/browser/extensions/extension_service.cc |
| +++ b/chrome/browser/extensions/extension_service.cc |
| @@ -2093,7 +2093,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. |
| @@ -2140,6 +2141,15 @@ void ExtensionService::OnExtensionInstalled( |
| } |
| } |
| + // Unsupported requirements overrides the management policy. |
| + if (!requirement_errors.empty()) { |
| + initial_enable = false; |
|
Aaron Boodman
2012/08/01 03:58:54
Oh cool. Since we already had code that was initia
eaugusti
2012/08/03 01:06:26
Done.
|
| + // If the extension was disabled because of unsupported requirements but |
| + // now supports all requirements after an update, enable it. |
| + } else if (extension_prefs_->HasUnsupportedRequirements(id)) { |
|
Aaron Boodman
2012/08/01 03:58:54
Can you check whether state == DISABLE_UNSUPPORTED
eaugusti
2012/08/03 01:06:26
If we remove the unsupported requirements in the p
|
| + initial_enable = true; |
| + } |
| + |
| // Do not record the install histograms for upgrades. |
| if (!GetExtensionByIdInternal(extension->id(), true, true, false)) { |
| UMA_HISTOGRAM_ENUMERATION("Extensions.InstallType", |
| @@ -2160,6 +2170,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()) && |