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

Side by Side Diff: chrome/browser/chromeos/proxy_config_service_impl.cc

Issue 238433003: Provide Shill IP Address to myIpAddress() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | net/proxy/proxy_config.h » ('j') | net/proxy/proxy_resolver_v8.cc » ('J')
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 "chrome/browser/chromeos/proxy_config_service_impl.h" 5 #include "chrome/browser/chromeos/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 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 } 154 }
155 155
156 // This network is shared and not managed by the user's domain. 156 // This network is shared and not managed by the user's domain.
157 bool use_shared_proxies = profile_prefs->GetBoolean(prefs::kUseSharedProxies); 157 bool use_shared_proxies = profile_prefs->GetBoolean(prefs::kUseSharedProxies);
158 VLOG(1) << "Use proxy of shared network: " << use_shared_proxies; 158 VLOG(1) << "Use proxy of shared network: " << use_shared_proxies;
159 return !use_shared_proxies; 159 return !use_shared_proxies;
160 } 160 }
161 161
162 void ProxyConfigServiceImpl::DetermineEffectiveConfigFromDefaultNetwork() { 162 void ProxyConfigServiceImpl::DetermineEffectiveConfigFromDefaultNetwork() {
163 NetworkStateHandler* handler = NetworkHandler::Get()->network_state_handler(); 163 NetworkStateHandler* handler = NetworkHandler::Get()->network_state_handler();
164 const FavoriteState* network = handler->DefaultFavoriteNetwork(); 164 const FavoriteState* favorite = handler->DefaultFavoriteNetwork();
165 165
166 // Get prefs proxy config if available. 166 // Get prefs proxy config if available.
167 net::ProxyConfig pref_config; 167 net::ProxyConfig pref_config;
168 ProxyPrefs::ConfigState pref_state = GetProxyConfig(&pref_config); 168 ProxyPrefs::ConfigState pref_state = GetProxyConfig(&pref_config);
169 169
170 // Get network proxy config if available. 170 // Get network proxy config if available.
171 net::ProxyConfig network_config; 171 net::ProxyConfig network_config;
172 net::ProxyConfigService::ConfigAvailability network_availability = 172 net::ProxyConfigService::ConfigAvailability network_availability =
173 net::ProxyConfigService::CONFIG_UNSET; 173 net::ProxyConfigService::CONFIG_UNSET;
174 bool ignore_proxy = true; 174 bool ignore_proxy = true;
175 if (network) { 175 if (favorite) {
176 ::onc::ONCSource onc_source = ::onc::ONC_SOURCE_NONE; 176 ::onc::ONCSource onc_source = ::onc::ONC_SOURCE_NONE;
177 const bool network_proxy_configured = chromeos::GetProxyConfig( 177 const bool network_proxy_configured = chromeos::GetProxyConfig(
178 prefs(), local_state_prefs_, *network, &network_config, &onc_source); 178 prefs(), local_state_prefs_, *favorite, &network_config, &onc_source);
179 ignore_proxy = 179 ignore_proxy =
180 IgnoreProxy(profile_prefs_, network->profile_path(), onc_source); 180 IgnoreProxy(profile_prefs_, favorite->profile_path(), onc_source);
181 181
182 // If network is shared but use-shared-proxies is off, use direct mode. 182 // If favorite is shared but use-shared-proxies is off, use direct mode.
183 if (ignore_proxy) { 183 if (ignore_proxy) {
184 network_config = net::ProxyConfig(); 184 network_config = net::ProxyConfig();
185 network_availability = net::ProxyConfigService::CONFIG_VALID; 185 network_availability = net::ProxyConfigService::CONFIG_VALID;
186 } else if (network_proxy_configured) { 186 } else if (network_proxy_configured) {
187 // Network is private or shared with user using shared proxies. 187 // Network is private or shared with user using shared proxies.
188 VLOG(1) << this << ": using proxy of network " << network->path(); 188 VLOG(1) << this << ": using proxy of network " << favorite->path();
189 network_availability = net::ProxyConfigService::CONFIG_VALID; 189 network_availability = net::ProxyConfigService::CONFIG_VALID;
190 } 190 }
191 } 191 }
192 192
193 // Determine effective proxy config, either from prefs or network. 193 // Determine effective proxy config, either from prefs or network.
194 ProxyPrefs::ConfigState effective_config_state; 194 ProxyPrefs::ConfigState effective_config_state;
195 net::ProxyConfig effective_config; 195 net::ProxyConfig effective_config;
196 GetEffectiveProxyConfig(pref_state, pref_config, 196 GetEffectiveProxyConfig(pref_state, pref_config,
197 network_availability, network_config, ignore_proxy, 197 network_availability, network_config, ignore_proxy,
198 &effective_config_state, &effective_config); 198 &effective_config_state, &effective_config);
199 if (favorite) {
200 const NetworkState* network = handler->GetNetworkState(favorite->path());
201 if (network)
202 effective_config.set_my_ip_address(network->ip_address());
203 }
199 204
200 // Activate effective proxy and store into |active_config_|. 205 // Activate effective proxy and store into |active_config_|.
201 // If last update didn't complete, we definitely update now. 206 // If last update didn't complete, we definitely update now.
202 bool update_now = update_pending(); 207 bool update_now = update_pending();
203 if (!update_now) { // Otherwise, only update now if there're changes. 208 if (!update_now) { // Otherwise, only update now if there're changes.
204 update_now = active_config_state_ != effective_config_state || 209 update_now = active_config_state_ != effective_config_state ||
205 (active_config_state_ != ProxyPrefs::CONFIG_UNSET && 210 (active_config_state_ != ProxyPrefs::CONFIG_UNSET &&
206 !active_config_.Equals(effective_config)); 211 !active_config_.Equals(effective_config));
207 } 212 }
208 if (update_now) { // Activate and store new effective config. 213 if (update_now) { // Activate and store new effective config.
(...skipping 16 matching lines...) Expand all
225 if (VLOG_IS_ON(1) && !update_pending()) { // Update was successful. 230 if (VLOG_IS_ON(1) && !update_pending()) { // Update was successful.
226 scoped_ptr<base::DictionaryValue> config_dict(effective_config.ToValue()); 231 scoped_ptr<base::DictionaryValue> config_dict(effective_config.ToValue());
227 VLOG(1) << this << ": Proxy changed: " 232 VLOG(1) << this << ": Proxy changed: "
228 << ProxyPrefs::ConfigStateToDebugString(active_config_state_) 233 << ProxyPrefs::ConfigStateToDebugString(active_config_state_)
229 << ", " << *config_dict; 234 << ", " << *config_dict;
230 } 235 }
231 } 236 }
232 } 237 }
233 238
234 } // namespace chromeos 239 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | net/proxy/proxy_config.h » ('j') | net/proxy/proxy_resolver_v8.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698