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

Unified Diff: components/component_updater/component_updater_service.cc

Issue 1740333002: Allow fallback from https to http for component update checks. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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: components/component_updater/component_updater_service.cc
diff --git a/components/component_updater/component_updater_service.cc b/components/component_updater/component_updater_service.cc
index 8f0515bda3760619c54dea4cdda42e0b50419804..775e7805474db4922eb2ec550c160f64574a6ae7 100644
--- a/components/component_updater/component_updater_service.cc
+++ b/components/component_updater/component_updater_service.cc
@@ -264,16 +264,33 @@ bool CrxUpdateService::CheckForUpdates() {
UMA_HISTOGRAM_ENUMERATION("ComponentUpdater.Calls", UPDATE_TYPE_AUTOMATIC,
UPDATE_TYPE_COUNT);
- std::vector<std::string> ids;
+ std::vector<std::string> secure_ids; // Requires HTTPS for update checks.
+ std::vector<std::string> unsecure_ids; // Can fallback to HTTP.
for (const auto id : components_order_) {
DCHECK(components_.find(id) != components_.end());
- ids.push_back(id);
+
+ auto component(GetComponent(id));
+ if (!component || component->requires_network_encryption)
+ secure_ids.push_back(id);
+ else
+ unsecure_ids.push_back(id);
}
- update_client_->Update(
- ids, base::Bind(&CrxUpdateService::OnUpdate, base::Unretained(this)),
- base::Bind(&CrxUpdateService::OnUpdateComplete, base::Unretained(this),
- base::TimeTicks::Now()));
+ if (!unsecure_ids.empty()) {
+ update_client_->Update(
+ unsecure_ids,
+ base::Bind(&CrxUpdateService::OnUpdate, base::Unretained(this)),
+ base::Bind(&CrxUpdateService::OnUpdateComplete, base::Unretained(this),
+ base::TimeTicks::Now()));
+ }
+
+ if (!secure_ids.empty()) {
+ update_client_->Update(
+ secure_ids,
+ base::Bind(&CrxUpdateService::OnUpdate, base::Unretained(this)),
+ base::Bind(&CrxUpdateService::OnUpdateComplete, base::Unretained(this),
+ base::TimeTicks::Now()));
+ }
return true;
}
« no previous file with comments | « chrome/browser/net/crl_set_fetcher.cc ('k') | components/component_updater/component_updater_url_constants.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698