Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/ui_proxy_config_service.h" | 5 #include "chromeos/network/proxy/ui_proxy_config_service.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 146 config.ToPrefProxyConfig()); | 146 config.ToPrefProxyConfig()); |
| 147 | 147 |
| 148 VLOG(1) << "Set proxy for " << current_ui_network_guid_ << " to " | 148 VLOG(1) << "Set proxy for " << current_ui_network_guid_ << " to " |
| 149 << *proxy_config_value; | 149 << *proxy_config_value; |
| 150 | 150 |
| 151 ProxyConfigDictionary proxy_config_dict(std::move(proxy_config_value)); | 151 ProxyConfigDictionary proxy_config_dict(std::move(proxy_config_value)); |
| 152 proxy_config::SetProxyConfigForNetwork(proxy_config_dict, *network); | 152 proxy_config::SetProxyConfigForNetwork(proxy_config_dict, *network); |
| 153 current_ui_config_.state = ProxyPrefs::CONFIG_SYSTEM; | 153 current_ui_config_.state = ProxyPrefs::CONFIG_SYSTEM; |
| 154 } | 154 } |
| 155 | 155 |
| 156 bool UIProxyConfigService::HasDefaultNetworkProxyConfigured() { | |
| 157 const NetworkState* network = | |
| 158 NetworkHandler::Get()->network_state_handler()->DefaultNetwork(); | |
| 159 if (!network) | |
| 160 return false; | |
| 161 onc::ONCSource onc_source = onc::ONC_SOURCE_NONE; | |
| 162 std::unique_ptr<ProxyConfigDictionary> proxy_dict = | |
| 163 proxy_config::GetProxyConfigForNetwork(NULL, local_state_prefs_, *network, | |
|
stevenjb
2017/04/21 18:38:24
nullptr
sammiequon
2017/04/21 19:02:53
Done.
| |
| 164 &onc_source); | |
| 165 ProxyPrefs::ProxyMode mode; | |
| 166 return (proxy_dict && proxy_dict->GetMode(&mode) && | |
| 167 mode == ProxyPrefs::MODE_FIXED_SERVERS); | |
| 168 } | |
| 169 | |
| 156 void UIProxyConfigService::DetermineEffectiveConfig( | 170 void UIProxyConfigService::DetermineEffectiveConfig( |
| 157 const NetworkState& network) { | 171 const NetworkState& network) { |
| 158 DCHECK(local_state_prefs_); | 172 DCHECK(local_state_prefs_); |
| 159 | 173 |
| 160 // The pref service to read proxy settings that apply to all networks. | 174 // The pref service to read proxy settings that apply to all networks. |
| 161 // Settings from the profile overrule local state. | 175 // Settings from the profile overrule local state. |
| 162 PrefService* top_pref_service = | 176 PrefService* top_pref_service = |
| 163 profile_prefs_ ? profile_prefs_ : local_state_prefs_; | 177 profile_prefs_ ? profile_prefs_ : local_state_prefs_; |
| 164 | 178 |
| 165 // Get prefs proxy config if available. | 179 // Get prefs proxy config if available. |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 208 current_ui_network_guid_); | 222 current_ui_network_guid_); |
| 209 if (!network) | 223 if (!network) |
| 210 return; | 224 return; |
| 211 UpdateFromPrefs(current_ui_network_guid_); | 225 UpdateFromPrefs(current_ui_network_guid_); |
| 212 NetworkHandler::Get() | 226 NetworkHandler::Get() |
| 213 ->network_state_handler() | 227 ->network_state_handler() |
| 214 ->SendUpdateNotificationForNetwork(network->path()); | 228 ->SendUpdateNotificationForNetwork(network->path()); |
| 215 } | 229 } |
| 216 | 230 |
| 217 } // namespace chromeos | 231 } // namespace chromeos |
| OLD | NEW |