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

Side by Side Diff: components/component_updater/configurator_impl.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, 9 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/configurator_impl.h" 5 #include "components/component_updater/configurator_impl.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 10
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 } 75 }
76 } 76 }
77 } 77 }
78 return std::string(); 78 return std::string();
79 } 79 }
80 80
81 } // namespace 81 } // namespace
82 82
83 ConfiguratorImpl::ConfiguratorImpl( 83 ConfiguratorImpl::ConfiguratorImpl(
84 const base::CommandLine* cmdline, 84 const base::CommandLine* cmdline,
85 net::URLRequestContextGetter* url_request_getter) 85 net::URLRequestContextGetter* url_request_getter,
86 bool require_encryption)
86 : url_request_getter_(url_request_getter), 87 : url_request_getter_(url_request_getter),
87 fast_update_(false), 88 fast_update_(false),
88 pings_enabled_(false), 89 pings_enabled_(false),
89 deltas_enabled_(false), 90 deltas_enabled_(false),
90 background_downloads_enabled_(false) { 91 background_downloads_enabled_(false),
92 require_encryption_(require_encryption) {
91 // Parse comma-delimited debug flags. 93 // Parse comma-delimited debug flags.
92 std::vector<std::string> switch_values = base::SplitString( 94 std::vector<std::string> switch_values = base::SplitString(
93 cmdline->GetSwitchValueASCII(switches::kComponentUpdater), ",", 95 cmdline->GetSwitchValueASCII(switches::kComponentUpdater), ",",
94 base::KEEP_WHITESPACE, base::SPLIT_WANT_NONEMPTY); 96 base::KEEP_WHITESPACE, base::SPLIT_WANT_NONEMPTY);
95 fast_update_ = HasSwitchValue(switch_values, kSwitchFastUpdate); 97 fast_update_ = HasSwitchValue(switch_values, kSwitchFastUpdate);
96 pings_enabled_ = !HasSwitchValue(switch_values, kSwitchDisablePings); 98 pings_enabled_ = !HasSwitchValue(switch_values, kSwitchDisablePings);
97 deltas_enabled_ = !HasSwitchValue(switch_values, kSwitchDisableDeltaUpdates); 99 deltas_enabled_ = !HasSwitchValue(switch_values, kSwitchDisableDeltaUpdates);
98 100
99 #if defined(OS_WIN) 101 #if defined(OS_WIN)
100 background_downloads_enabled_ = 102 background_downloads_enabled_ =
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 } 135 }
134 136
135 int ConfiguratorImpl::UpdateDelay() const { 137 int ConfiguratorImpl::UpdateDelay() const {
136 return fast_update_ ? 10 : (15 * kDelayOneMinute); 138 return fast_update_ ? 10 : (15 * kDelayOneMinute);
137 } 139 }
138 140
139 std::vector<GURL> ConfiguratorImpl::UpdateUrl() const { 141 std::vector<GURL> ConfiguratorImpl::UpdateUrl() const {
140 std::vector<GURL> urls; 142 std::vector<GURL> urls;
141 if (url_source_override_.is_valid()) { 143 if (url_source_override_.is_valid()) {
142 urls.push_back(GURL(url_source_override_)); 144 urls.push_back(GURL(url_source_override_));
143 } else { 145 return urls;
144 urls.push_back(GURL(kUpdaterDefaultUrl));
145 } 146 }
147
148 urls.push_back(GURL(kUpdaterDefaultUrl));
149 urls.push_back(GURL(kUpdaterFallbackUrl));
150 if (require_encryption_) {
151 urls.erase(std::remove_if(urls.begin(), urls.end(),
152 [](const GURL& url) {
153 return !url.SchemeIsCryptographic();
154 }),
155 urls.end());
156 }
157
146 return urls; 158 return urls;
147 } 159 }
148 160
149 std::vector<GURL> ConfiguratorImpl::PingUrl() const { 161 std::vector<GURL> ConfiguratorImpl::PingUrl() const {
150 return pings_enabled_ ? UpdateUrl() : std::vector<GURL>(); 162 return pings_enabled_ ? UpdateUrl() : std::vector<GURL>();
151 } 163 }
152 164
153 base::Version ConfiguratorImpl::GetBrowserVersion() const { 165 base::Version ConfiguratorImpl::GetBrowserVersion() const {
154 return base::Version(version_info::GetVersionNumber()); 166 return base::Version(version_info::GetVersionNumber());
155 } 167 }
(...skipping 20 matching lines...) Expand all
176 188
177 bool ConfiguratorImpl::UseBackgroundDownloader() const { 189 bool ConfiguratorImpl::UseBackgroundDownloader() const {
178 return background_downloads_enabled_; 190 return background_downloads_enabled_;
179 } 191 }
180 192
181 bool ConfiguratorImpl::UseCupSigning() const { 193 bool ConfiguratorImpl::UseCupSigning() const {
182 return true; 194 return true;
183 } 195 }
184 196
185 } // namespace component_updater 197 } // namespace component_updater
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698