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

Side by Side Diff: chromeos/network/proxy/proxy_config_service_impl.cc

Issue 2950573002: Fix chromeos::ProxyConfigServiceImpl not setting ProxyConfig on start. (Closed)
Patch Set: Oops Created 3 years, 6 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
« no previous file with comments | « no previous file | components/proxy_config/pref_proxy_config_tracker_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chromeos/network/proxy/proxy_config_service_impl.h" 5 #include "chromeos/network/proxy/proxy_config_service_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 } 249 }
250 } 250 }
251 251
252 // Determine effective proxy config, either from prefs or network. 252 // Determine effective proxy config, either from prefs or network.
253 ProxyPrefs::ConfigState effective_config_state; 253 ProxyPrefs::ConfigState effective_config_state;
254 net::ProxyConfig effective_config; 254 net::ProxyConfig effective_config;
255 GetEffectiveProxyConfig(pref_state, pref_config, network_availability, 255 GetEffectiveProxyConfig(pref_state, pref_config, network_availability,
256 network_config, ignore_proxy, &effective_config_state, 256 network_config, ignore_proxy, &effective_config_state,
257 &effective_config); 257 &effective_config);
258 258
259 // Activate effective proxy and store into |active_config_|. 259 bool config_changed = active_config_state_ != effective_config_state ||
260 // If last update didn't complete, we definitely update now. 260 (active_config_state_ != ProxyPrefs::CONFIG_UNSET &&
261 bool update_now = update_pending(); 261 !active_config_.Equals(effective_config));
262 if (!update_now) { // Otherwise, only update now if there're changes. 262 if (config_changed) { // Activate and store new effective config.
263 update_now = active_config_state_ != effective_config_state ||
264 (active_config_state_ != ProxyPrefs::CONFIG_UNSET &&
265 !active_config_.Equals(effective_config));
266 }
267 if (update_now) { // Activate and store new effective config.
268 active_config_state_ = effective_config_state; 263 active_config_state_ = effective_config_state;
269 if (active_config_state_ != ProxyPrefs::CONFIG_UNSET) 264 if (active_config_state_ != ProxyPrefs::CONFIG_UNSET)
270 active_config_ = effective_config; 265 active_config_ = effective_config;
271 // If effective config is from system (i.e. network), it's considered a 266 // If effective config is from system (i.e. network), it's considered a
272 // special kind of prefs that ranks below policy/extension but above 267 // special kind of prefs that ranks below policy/extension but above
273 // others, so bump it up to CONFIG_OTHER_PRECEDE to force its precedence 268 // others, so bump it up to CONFIG_OTHER_PRECEDE to force its precedence
274 // when PrefProxyConfigTrackerImpl pushes it to ChromeProxyConfigService. 269 // when PrefProxyConfigTrackerImpl pushes it to ChromeProxyConfigService.
275 if (effective_config_state == ProxyPrefs::CONFIG_SYSTEM) 270 if (effective_config_state == ProxyPrefs::CONFIG_SYSTEM)
276 effective_config_state = ProxyPrefs::CONFIG_OTHER_PRECEDE; 271 effective_config_state = ProxyPrefs::CONFIG_OTHER_PRECEDE;
277 // If config is manual, add rule to bypass local host. 272 // If config is manual, add rule to bypass local host.
278 if (effective_config.proxy_rules().type != 273 if (effective_config.proxy_rules().type !=
279 net::ProxyConfig::ProxyRules::TYPE_NO_RULES) { 274 net::ProxyConfig::ProxyRules::TYPE_NO_RULES) {
280 effective_config.proxy_rules().bypass_rules.AddRuleToBypassLocal(); 275 effective_config.proxy_rules().bypass_rules.AddRuleToBypassLocal();
281 } 276 }
282 PrefProxyConfigTrackerImpl::OnProxyConfigChanged(effective_config_state, 277 PrefProxyConfigTrackerImpl::OnProxyConfigChanged(effective_config_state,
283 effective_config); 278 effective_config);
284 if (VLOG_IS_ON(1) && !update_pending()) { // Update was successful. 279 if (VLOG_IS_ON(1)) {
285 std::unique_ptr<base::DictionaryValue> config_dict( 280 std::unique_ptr<base::DictionaryValue> config_dict(
286 effective_config.ToValue()); 281 effective_config.ToValue());
287 VLOG(1) << this << ": Proxy changed: " 282 VLOG(1) << this << ": Proxy changed: "
288 << ProxyPrefs::ConfigStateToDebugString(active_config_state_) 283 << ProxyPrefs::ConfigStateToDebugString(active_config_state_)
289 << ", " << *config_dict; 284 << ", " << *config_dict;
290 } 285 }
291 } 286 }
292 } 287 }
293 288
294 } // namespace chromeos 289 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | components/proxy_config/pref_proxy_config_tracker_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698