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

Side by Side 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "components/component_updater/component_updater_service.h" 5 #include "components/component_updater/component_updater_service.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 257
258 return true; 258 return true;
259 } 259 }
260 260
261 bool CrxUpdateService::CheckForUpdates() { 261 bool CrxUpdateService::CheckForUpdates() {
262 DCHECK(thread_checker_.CalledOnValidThread()); 262 DCHECK(thread_checker_.CalledOnValidThread());
263 263
264 UMA_HISTOGRAM_ENUMERATION("ComponentUpdater.Calls", UPDATE_TYPE_AUTOMATIC, 264 UMA_HISTOGRAM_ENUMERATION("ComponentUpdater.Calls", UPDATE_TYPE_AUTOMATIC,
265 UPDATE_TYPE_COUNT); 265 UPDATE_TYPE_COUNT);
266 266
267 std::vector<std::string> ids; 267 std::vector<std::string> secure_ids; // Requires HTTPS for update checks.
268 std::vector<std::string> unsecure_ids; // Can fallback to HTTP.
268 for (const auto id : components_order_) { 269 for (const auto id : components_order_) {
269 DCHECK(components_.find(id) != components_.end()); 270 DCHECK(components_.find(id) != components_.end());
270 ids.push_back(id); 271
272 auto component(GetComponent(id));
273 if (!component || component->requires_network_encryption)
274 secure_ids.push_back(id);
275 else
276 unsecure_ids.push_back(id);
271 } 277 }
272 278
273 update_client_->Update( 279 if (!unsecure_ids.empty()) {
274 ids, base::Bind(&CrxUpdateService::OnUpdate, base::Unretained(this)), 280 update_client_->Update(
275 base::Bind(&CrxUpdateService::OnUpdateComplete, base::Unretained(this), 281 unsecure_ids,
276 base::TimeTicks::Now())); 282 base::Bind(&CrxUpdateService::OnUpdate, base::Unretained(this)),
283 base::Bind(&CrxUpdateService::OnUpdateComplete, base::Unretained(this),
284 base::TimeTicks::Now()));
285 }
286
287 if (!secure_ids.empty()) {
288 update_client_->Update(
289 secure_ids,
290 base::Bind(&CrxUpdateService::OnUpdate, base::Unretained(this)),
291 base::Bind(&CrxUpdateService::OnUpdateComplete, base::Unretained(this),
292 base::TimeTicks::Now()));
293 }
277 294
278 return true; 295 return true;
279 } 296 }
280 297
281 scoped_refptr<base::SequencedTaskRunner> 298 scoped_refptr<base::SequencedTaskRunner>
282 CrxUpdateService::GetSequencedTaskRunner() { 299 CrxUpdateService::GetSequencedTaskRunner() {
283 DCHECK(thread_checker_.CalledOnValidThread()); 300 DCHECK(thread_checker_.CalledOnValidThread());
284 return blocking_task_runner_; 301 return blocking_task_runner_;
285 } 302 }
286 303
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 // TODO(sorin): consider making this a singleton. 391 // TODO(sorin): consider making this a singleton.
375 scoped_ptr<ComponentUpdateService> ComponentUpdateServiceFactory( 392 scoped_ptr<ComponentUpdateService> ComponentUpdateServiceFactory(
376 const scoped_refptr<Configurator>& config) { 393 const scoped_refptr<Configurator>& config) {
377 DCHECK(config); 394 DCHECK(config);
378 auto update_client = update_client::UpdateClientFactory(config); 395 auto update_client = update_client::UpdateClientFactory(config);
379 return scoped_ptr<ComponentUpdateService>( 396 return scoped_ptr<ComponentUpdateService>(
380 new CrxUpdateService(config, std::move(update_client))); 397 new CrxUpdateService(config, std::move(update_client)));
381 } 398 }
382 399
383 } // namespace component_updater 400 } // namespace component_updater
OLDNEW
« 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