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

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

Issue 2495123003: Continue attempts to reinstall corrupt policy extensions across restarts (Closed)
Patch Set: merged latest from origin/master Created 4 years, 1 month 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
« no previous file with comments | « chrome/browser/extensions/content_verifier_browsertest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/installed_loader.cc
diff --git a/chrome/browser/extensions/installed_loader.cc b/chrome/browser/extensions/installed_loader.cc
index 4a53315a20ef6255a0833a953b01b2a409c3c7b3..70d41114c4e6dbebd51989d42ae4fa742c520639 100644
--- a/chrome/browser/extensions/installed_loader.cc
+++ b/chrome/browser/extensions/installed_loader.cc
@@ -5,6 +5,9 @@
#include "chrome/browser/extensions/installed_loader.h"
#include <stddef.h>
+#include <memory>
+#include <string>
+#include <vector>
#include "base/files/file_path.h"
#include "base/metrics/histogram_macros.h"
@@ -204,16 +207,28 @@ void InstalledLoader::Load(const ExtensionInfo& info, bool write_to_prefs) {
if (extension.get()) {
Extension::DisableReason disable_reason = Extension::DISABLE_NONE;
bool force_disabled = false;
- if (!policy->UserMayLoad(extension.get(), NULL)) {
+ if (!policy->UserMayLoad(extension.get(), nullptr)) {
// The error message from UserMayInstall() often contains the extension ID
// and is therefore not well suited to this UI.
error = errors::kDisabledByPolicy;
extension = NULL;
} else if (!extension_prefs_->IsExtensionDisabled(extension->id()) &&
- policy->MustRemainDisabled(
- extension.get(), &disable_reason, NULL)) {
+ policy->MustRemainDisabled(extension.get(), &disable_reason,
+ nullptr)) {
extension_prefs_->SetExtensionDisabled(extension->id(), disable_reason);
force_disabled = true;
+ } else if (extension_prefs_->IsExtensionDisabled(extension->id()) &&
+ policy->MustRemainEnabled(extension.get(), nullptr) &&
+ extension_prefs_->HasDisableReason(
+ extension->id(), Extension::DISABLE_CORRUPTED)) {
+ // This extension must have been disabled due to corruption on a previous
+ // run of chrome, and for some reason we weren't successful in
+ // auto-reinstalling it. So we want to notify the PendingExtensionManager
+ // that we'd still like to keep attempt to re-download and reinstall it
+ // whenever the ExtensionService checks for external updates.
+ PendingExtensionManager* pending_manager =
+ extension_service_->pending_extension_manager();
+ pending_manager->ExpectPolicyReinstallForCorruption(extension->id());
}
UMA_HISTOGRAM_BOOLEAN("ExtensionInstalledLoader.ForceDisabled",
force_disabled);
« no previous file with comments | « chrome/browser/extensions/content_verifier_browsertest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698