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

Side by Side Diff: components/component_updater/configurator_impl.cc

Issue 2654033009: Update component updater URLs. (Closed)
Patch Set: Created 3 years, 10 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
11 #include "base/command_line.h" 11 #include "base/command_line.h"
12 #include "base/feature_list.h"
12 #include "base/strings/string_split.h" 13 #include "base/strings/string_split.h"
13 #include "base/strings/string_util.h" 14 #include "base/strings/string_util.h"
14 #include "base/version.h" 15 #include "base/version.h"
15 #include "build/build_config.h" 16 #include "build/build_config.h"
16 #include "components/component_updater/component_updater_switches.h" 17 #include "components/component_updater/component_updater_switches.h"
17 #include "components/component_updater/component_updater_url_constants.h" 18 #include "components/component_updater/component_updater_url_constants.h"
18 #include "components/update_client/utils.h" 19 #include "components/update_client/utils.h"
19 #include "components/version_info/version_info.h" 20 #include "components/version_info/version_info.h"
20 21
21 #if defined(OS_WIN) 22 #if defined(OS_WIN)
(...skipping 25 matching lines...) Expand all
47 const char kSwitchUrlSource[] = "url-source"; 48 const char kSwitchUrlSource[] = "url-source";
48 49
49 // Disables differential updates. 50 // Disables differential updates.
50 const char kSwitchDisableDeltaUpdates[] = "disable-delta-updates"; 51 const char kSwitchDisableDeltaUpdates[] = "disable-delta-updates";
51 52
52 #if defined(OS_WIN) 53 #if defined(OS_WIN)
53 // Disables background downloads. 54 // Disables background downloads.
54 const char kSwitchDisableBackgroundDownloads[] = "disable-background-downloads"; 55 const char kSwitchDisableBackgroundDownloads[] = "disable-background-downloads";
55 #endif // defined(OS_WIN) 56 #endif // defined(OS_WIN)
56 57
58 const base::Feature kAlternateComponentUrls {
59 "AlternateComponentUrls", base::FEATURE_DISABLED_BY_DEFAULT
60 };
61
57 // Returns true if and only if |test| is contained in |vec|. 62 // Returns true if and only if |test| is contained in |vec|.
58 bool HasSwitchValue(const std::vector<std::string>& vec, const char* test) { 63 bool HasSwitchValue(const std::vector<std::string>& vec, const char* test) {
59 if (vec.empty()) 64 if (vec.empty())
60 return 0; 65 return 0;
61 return (std::find(vec.begin(), vec.end(), test) != vec.end()); 66 return (std::find(vec.begin(), vec.end(), test) != vec.end());
62 } 67 }
63 68
64 // If there is an element of |vec| of the form |test|=.*, returns the right- 69 // If there is an element of |vec| of the form |test|=.*, returns the right-
65 // hand side of that assignment. Otherwise, returns an empty string. 70 // hand side of that assignment. Otherwise, returns an empty string.
66 // The right-hand side may contain additional '=' characters, allowing for 71 // The right-hand side may contain additional '=' characters, allowing for
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 return fast_update_ ? 10 : (15 * kDelayOneMinute); 146 return fast_update_ ? 10 : (15 * kDelayOneMinute);
142 } 147 }
143 148
144 std::vector<GURL> ConfiguratorImpl::UpdateUrl() const { 149 std::vector<GURL> ConfiguratorImpl::UpdateUrl() const {
145 std::vector<GURL> urls; 150 std::vector<GURL> urls;
146 if (url_source_override_.is_valid()) { 151 if (url_source_override_.is_valid()) {
147 urls.push_back(GURL(url_source_override_)); 152 urls.push_back(GURL(url_source_override_));
148 return urls; 153 return urls;
149 } 154 }
150 155
151 urls.push_back(GURL(kUpdaterDefaultUrl)); 156 if (base::FeatureList::IsEnabled(kAlternateComponentUrls)) {
152 urls.push_back(GURL(kUpdaterFallbackUrl)); 157 urls.push_back(GURL(kUpdaterDefaultUrlAlt));
158 urls.push_back(GURL(kUpdaterFallbackUrlAlt));
159 } else {
160 urls.push_back(GURL(kUpdaterDefaultUrl));
161 urls.push_back(GURL(kUpdaterFallbackUrl));
162 }
163
153 if (require_encryption_) 164 if (require_encryption_)
154 update_client::RemoveUnsecureUrls(&urls); 165 update_client::RemoveUnsecureUrls(&urls);
155 166
156 return urls; 167 return urls;
157 } 168 }
158 169
159 std::vector<GURL> ConfiguratorImpl::PingUrl() const { 170 std::vector<GURL> ConfiguratorImpl::PingUrl() const {
160 return pings_enabled_ ? UpdateUrl() : std::vector<GURL>(); 171 return pings_enabled_ ? UpdateUrl() : std::vector<GURL>();
161 } 172 }
162 173
(...skipping 27 matching lines...) Expand all
190 201
191 bool ConfiguratorImpl::EnabledBackgroundDownloader() const { 202 bool ConfiguratorImpl::EnabledBackgroundDownloader() const {
192 return background_downloads_enabled_; 203 return background_downloads_enabled_;
193 } 204 }
194 205
195 bool ConfiguratorImpl::EnabledCupSigning() const { 206 bool ConfiguratorImpl::EnabledCupSigning() const {
196 return true; 207 return true;
197 } 208 }
198 209
199 } // namespace component_updater 210 } // namespace component_updater
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698