| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/extensions/chrome_content_verifier_delegate.h" | 5 #include "chrome/browser/extensions/chrome_content_verifier_delegate.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 ContentVerifyJob::FailureReason reason) { | 169 ContentVerifyJob::FailureReason reason) { |
| 170 ExtensionRegistry* registry = ExtensionRegistry::Get(context_); | 170 ExtensionRegistry* registry = ExtensionRegistry::Get(context_); |
| 171 const Extension* extension = | 171 const Extension* extension = |
| 172 registry->enabled_extensions().GetByID(extension_id); | 172 registry->enabled_extensions().GetByID(extension_id); |
| 173 if (!extension) | 173 if (!extension) |
| 174 return; | 174 return; |
| 175 ExtensionSystem* system = ExtensionSystem::Get(context_); | 175 ExtensionSystem* system = ExtensionSystem::Get(context_); |
| 176 ExtensionService* service = system->extension_service(); | 176 ExtensionService* service = system->extension_service(); |
| 177 Mode mode = ShouldBeVerified(*extension); | 177 Mode mode = ShouldBeVerified(*extension); |
| 178 if (mode >= ContentVerifierDelegate::ENFORCE) { | 178 if (mode >= ContentVerifierDelegate::ENFORCE) { |
| 179 if (!system->management_policy()->UserMayModifySettings(extension, NULL)) { | 179 if (system->management_policy()->MustRemainEnabled(extension, NULL)) { |
| 180 PendingExtensionManager* pending_manager = | 180 PendingExtensionManager* pending_manager = |
| 181 service->pending_extension_manager(); | 181 service->pending_extension_manager(); |
| 182 if (pending_manager->IsPolicyReinstallForCorruptionExpected(extension_id)) | 182 if (pending_manager->IsPolicyReinstallForCorruptionExpected(extension_id)) |
| 183 return; | 183 return; |
| 184 SYSLOG(WARNING) << "Corruption detected in policy extension " | 184 SYSLOG(WARNING) << "Corruption detected in policy extension " |
| 185 << extension_id << " installed at: " | 185 << extension_id << " installed at: " |
| 186 << extension->path().value(); | 186 << extension->path().value(); |
| 187 pending_manager->ExpectPolicyReinstallForCorruption(extension_id); | 187 pending_manager->ExpectPolicyReinstallForCorruption(extension_id); |
| 188 service->DisableExtension(extension_id, Extension::DISABLE_CORRUPTED); | 188 service->DisableExtension(extension_id, Extension::DISABLE_CORRUPTED); |
| 189 service->CheckForExternalUpdates(); | 189 service->CheckForExternalUpdates(); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 200 UMA_HISTOGRAM_ENUMERATION("Extensions.CorruptExtensionDisabledReason", | 200 UMA_HISTOGRAM_ENUMERATION("Extensions.CorruptExtensionDisabledReason", |
| 201 reason, ContentVerifyJob::FAILURE_REASON_MAX); | 201 reason, ContentVerifyJob::FAILURE_REASON_MAX); |
| 202 } else if (!base::ContainsKey(would_be_disabled_ids_, extension_id)) { | 202 } else if (!base::ContainsKey(would_be_disabled_ids_, extension_id)) { |
| 203 UMA_HISTOGRAM_BOOLEAN("Extensions.CorruptExtensionWouldBeDisabled", true); | 203 UMA_HISTOGRAM_BOOLEAN("Extensions.CorruptExtensionWouldBeDisabled", true); |
| 204 would_be_disabled_ids_.insert(extension_id); | 204 would_be_disabled_ids_.insert(extension_id); |
| 205 } | 205 } |
| 206 } | 206 } |
| 207 | 207 |
| 208 | 208 |
| 209 } // namespace extensions | 209 } // namespace extensions |
| OLD | NEW |