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

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

Issue 10689097: Enforce the 'requirements' field in manifests. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fixed UnpackedInstller issue Created 8 years, 3 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
Index: chrome/browser/extensions/extension_service.cc
diff --git a/chrome/browser/extensions/extension_service.cc b/chrome/browser/extensions/extension_service.cc
index d0a6ca833d1fc8c6ff5fada01d8b6e8a9efd03b6..49133c3c1e8fa7dac8a5c50da632c88dbf5cbbb9 100644
--- a/chrome/browser/extensions/extension_service.cc
+++ b/chrome/browser/extensions/extension_service.cc
@@ -2127,7 +2127,8 @@ void ExtensionService::UpdateActiveExtensionsInCrashReporter() {
void ExtensionService::OnExtensionInstalled(
const Extension* extension,
bool from_webstore,
- const syncer::StringOrdinal& page_ordinal) {
+ const syncer::StringOrdinal& page_ordinal,
+ bool has_requirement_errors) {
CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
// Ensure extension is deleted unless we transfer ownership.
@@ -2174,6 +2175,20 @@ void ExtensionService::OnExtensionInstalled(
}
}
+ // Unsupported requirements overrides the management policy.
+ if (has_requirement_errors) {
+ initial_enable = false;
+ extension_prefs_->AddDisableReason(
+ id, Extension::DISABLE_UNSUPPORTED_REQUIREMENT);
+ // If the extension was disabled because of unsupported requirements but
+ // now supports all requirements after an update and there are not other
+ // disable reasons, enable it.
+ } else if (extension_prefs_->GetDisableReasons(id) ==
+ Extension::DISABLE_UNSUPPORTED_REQUIREMENT) {
+ initial_enable = true;
+ extension_prefs_->ClearDisableReasons(id);
+ }
+
int include_mask = INCLUDE_ENABLED;
include_mask |= INCLUDE_DISABLED;
// Do not record the install histograms for upgrades.
« no previous file with comments | « chrome/browser/extensions/extension_service.h ('k') | chrome/browser/extensions/extension_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698