OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/browser/net/pref_proxy_config_tracker_impl.h" | 5 #include "chrome/browser/net/pref_proxy_config_tracker_impl.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/prefs/pref_registry_simple.h" | 8 #include "base/prefs/pref_registry_simple.h" |
9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 | 72 |
73 void ChromeProxyConfigService::UpdateProxyConfig( | 73 void ChromeProxyConfigService::UpdateProxyConfig( |
74 ProxyPrefs::ConfigState config_state, | 74 ProxyPrefs::ConfigState config_state, |
75 const net::ProxyConfig& config) { | 75 const net::ProxyConfig& config) { |
76 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 76 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
77 | 77 |
78 pref_config_read_pending_ = false; | 78 pref_config_read_pending_ = false; |
79 pref_config_state_ = config_state; | 79 pref_config_state_ = config_state; |
80 pref_config_ = config; | 80 pref_config_ = config; |
81 | 81 |
82 if (!observers_.size()) | 82 if (!observers_.might_have_observers()) |
83 return; | 83 return; |
84 | 84 |
85 // Evaluate the proxy configuration. If GetLatestProxyConfig returns | 85 // Evaluate the proxy configuration. If GetLatestProxyConfig returns |
86 // CONFIG_PENDING, we are using the system proxy service, but it doesn't have | 86 // CONFIG_PENDING, we are using the system proxy service, but it doesn't have |
87 // a valid configuration yet. Once it is ready, OnProxyConfigChanged() will be | 87 // a valid configuration yet. Once it is ready, OnProxyConfigChanged() will be |
88 // called and broadcast the proxy configuration. | 88 // called and broadcast the proxy configuration. |
89 // Note: If a switch between a preference proxy configuration and the system | 89 // Note: If a switch between a preference proxy configuration and the system |
90 // proxy configuration occurs an unnecessary notification might get send if | 90 // proxy configuration occurs an unnecessary notification might get send if |
91 // the two configurations agree. This case should be rare however, so we don't | 91 // the two configurations agree. This case should be rare however, so we don't |
92 // handle that case specially. | 92 // handle that case specially. |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
345 (config_state_ != ProxyPrefs::CONFIG_UNSET && | 345 (config_state_ != ProxyPrefs::CONFIG_UNSET && |
346 !pref_config_.Equals(new_config))) { | 346 !pref_config_.Equals(new_config))) { |
347 config_state_ = config_state; | 347 config_state_ = config_state; |
348 if (config_state_ != ProxyPrefs::CONFIG_UNSET) | 348 if (config_state_ != ProxyPrefs::CONFIG_UNSET) |
349 pref_config_ = new_config; | 349 pref_config_ = new_config; |
350 update_pending_ = true; | 350 update_pending_ = true; |
351 } | 351 } |
352 if (update_pending_) | 352 if (update_pending_) |
353 OnProxyConfigChanged(config_state, new_config); | 353 OnProxyConfigChanged(config_state, new_config); |
354 } | 354 } |
OLD | NEW |