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

Unified Diff: extensions/browser/updater/extension_downloader.cc

Issue 2299203004: Attempt to repair corrupt enterprise policy force-installed extensions (Closed)
Patch Set: fix chromeos compile problem Created 4 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: extensions/browser/updater/extension_downloader.cc
diff --git a/extensions/browser/updater/extension_downloader.cc b/extensions/browser/updater/extension_downloader.cc
index 7bc7f6752a6c14ca4ec8383a42964adfee75b6e2..731a32a18bc9e06096ef9e3f7c6d68ccc8ea6dc7 100644
--- a/extensions/browser/updater/extension_downloader.cc
+++ b/extensions/browser/updater/extension_downloader.cc
@@ -210,29 +210,35 @@ bool ExtensionDownloader::AddExtension(const Extension& extension,
return false;
}
+ ManifestFetchData::ExtraParams extra;
+
// If the extension updates itself from the gallery, ignore any update URL
// data. At the moment there is no extra data that an extension can
// communicate to the the gallery update servers.
std::string update_url_data;
if (!ManifestURL::UpdatesFromGallery(&extension))
- update_url_data = delegate_->GetUpdateUrlData(extension.id());
+ extra.update_url_data = delegate_->GetUpdateUrlData(extension.id());
return AddExtensionData(
extension.id(), *extension.version(), extension.GetType(),
- ManifestURL::GetUpdateURL(&extension), update_url_data, request_id);
+ ManifestURL::GetUpdateURL(&extension), &extra, request_id);
}
bool ExtensionDownloader::AddPendingExtension(const std::string& id,
const GURL& update_url,
+ bool is_corrupt_reinstall,
int request_id) {
// Use a zero version to ensure that a pending extension will always
// be updated, and thus installed (assuming all extensions have
// non-zero versions).
base::Version version("0.0.0.0");
DCHECK(version.IsValid());
+ ManifestFetchData::ExtraParams extra;
+ if (is_corrupt_reinstall)
+ extra.is_corrupt_policy_reinstall = true;
return AddExtensionData(id, version, Manifest::TYPE_UNKNOWN, update_url,
- std::string(), request_id);
+ &extra, request_id);
}
void ExtensionDownloader::StartAllPending(ExtensionCache* cache) {
@@ -270,7 +276,7 @@ void ExtensionDownloader::StartBlacklistUpdate(
extension_urls::GetWebstoreUpdateUrl(), request_id));
DCHECK(blacklist_fetch->base_url().SchemeIsCryptographic());
blacklist_fetch->AddExtension(kBlacklistAppID, version, &ping_data,
- std::string(), kDefaultInstallSource);
+ kDefaultInstallSource, nullptr);
StartUpdateCheck(std::move(blacklist_fetch));
}
@@ -285,12 +291,13 @@ void ExtensionDownloader::set_test_delegate(
g_test_delegate = delegate;
}
-bool ExtensionDownloader::AddExtensionData(const std::string& id,
- const base::Version& version,
- Manifest::Type extension_type,
- const GURL& extension_update_url,
- const std::string& update_url_data,
- int request_id) {
+bool ExtensionDownloader::AddExtensionData(
+ const std::string& id,
+ const base::Version& version,
+ Manifest::Type extension_type,
+ const GURL& extension_update_url,
+ const ManifestFetchData::ExtraParams* extra,
+ int request_id) {
GURL update_url(extension_update_url);
// Skip extensions with non-empty invalid update URLs.
if (!update_url.is_empty() && !update_url.is_valid()) {
@@ -362,8 +369,8 @@ bool ExtensionDownloader::AddExtensionData(const std::string& id,
// Try to add to the ManifestFetchData at the end of the list.
ManifestFetchData* existing_fetch = existing_iter->second.back().get();
if (existing_fetch->AddExtension(id, version.GetString(),
- optional_ping_data, update_url_data,
- install_source)) {
+ optional_ping_data, install_source,
+ extra)) {
added = true;
}
}
@@ -376,7 +383,7 @@ bool ExtensionDownloader::AddExtensionData(const std::string& id,
fetches_preparing_[std::make_pair(request_id, update_url)].push_back(
std::move(fetch));
added = fetch_ptr->AddExtension(id, version.GetString(), optional_ping_data,
- update_url_data, install_source);
+ install_source, extra);
DCHECK(added);
}

Powered by Google App Engine
This is Rietveld 408576698