| 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" |
| 11 #include "base/bind_helpers.h" | 11 #include "base/bind_helpers.h" |
| 12 #include "base/logging.h" | 12 #include "base/logging.h" |
| 13 #include "base/values.h" | 13 #include "base/values.h" |
| 14 #include "chromeos/network/network_state.h" | 14 #include "chromeos/network/network_state.h" |
| 15 #include "chromeos/network/network_state_handler.h" | 15 #include "chromeos/network/network_state_handler.h" |
| 16 #include "chromeos/network/proxy/proxy_config_handler.h" | 16 #include "chromeos/network/proxy/proxy_config_handler.h" |
| 17 #include "chromeos/network/proxy/proxy_config_service_impl.h" | 17 #include "chromeos/network/proxy/proxy_config_service_impl.h" |
| 18 #include "chromeos/network/tether_constants.h" |
| 18 #include "components/device_event_log/device_event_log.h" | 19 #include "components/device_event_log/device_event_log.h" |
| 19 #include "components/proxy_config/pref_proxy_config_tracker_impl.h" | 20 #include "components/proxy_config/pref_proxy_config_tracker_impl.h" |
| 20 #include "components/proxy_config/proxy_config_pref_names.h" | 21 #include "components/proxy_config/proxy_config_pref_names.h" |
| 21 #include "net/proxy/proxy_config.h" | 22 #include "net/proxy/proxy_config.h" |
| 22 | 23 |
| 23 namespace chromeos { | 24 namespace chromeos { |
| 24 | 25 |
| 25 namespace { | 26 namespace { |
| 26 | 27 |
| 27 const char* ModeToString(UIProxyConfig::Mode mode) { | 28 const char* ModeToString(UIProxyConfig::Mode mode) { |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 | 94 |
| 94 void UIProxyConfigService::UpdateFromPrefs(const std::string& network_guid) { | 95 void UIProxyConfigService::UpdateFromPrefs(const std::string& network_guid) { |
| 95 current_ui_network_guid_ = network_guid; | 96 current_ui_network_guid_ = network_guid; |
| 96 const NetworkState* network = nullptr; | 97 const NetworkState* network = nullptr; |
| 97 if (!network_guid.empty()) { | 98 if (!network_guid.empty()) { |
| 98 network = | 99 network = |
| 99 NetworkHandler::Get()->network_state_handler()->GetNetworkStateFromGuid( | 100 NetworkHandler::Get()->network_state_handler()->GetNetworkStateFromGuid( |
| 100 network_guid); | 101 network_guid); |
| 101 if (!network) { | 102 if (!network) { |
| 102 NET_LOG(ERROR) << "No NetworkState for guid: " << network_guid; | 103 NET_LOG(ERROR) << "No NetworkState for guid: " << network_guid; |
| 103 } else if (!network->IsInProfile()) { | 104 } else if (!network->IsInProfile() && network->type() != kTypeTether) { |
| 105 // Tether networks are not expected to have an associated profile; only |
| 106 // log an error if the provided properties do not correspond to a |
| 107 // Tether network. |
| 104 NET_LOG(ERROR) << "Network not in profile: " << network_guid; | 108 NET_LOG(ERROR) << "Network not in profile: " << network_guid; |
| 105 network = nullptr; | 109 network = nullptr; |
| 106 } | 110 } |
| 107 } | 111 } |
| 108 if (!network) { | 112 if (!network) { |
| 109 current_ui_network_guid_.clear(); | 113 current_ui_network_guid_.clear(); |
| 110 current_ui_config_ = UIProxyConfig(); | 114 current_ui_config_ = UIProxyConfig(); |
| 111 return; | 115 return; |
| 112 } | 116 } |
| 113 | 117 |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 current_ui_network_guid_); | 226 current_ui_network_guid_); |
| 223 if (!network) | 227 if (!network) |
| 224 return; | 228 return; |
| 225 UpdateFromPrefs(current_ui_network_guid_); | 229 UpdateFromPrefs(current_ui_network_guid_); |
| 226 NetworkHandler::Get() | 230 NetworkHandler::Get() |
| 227 ->network_state_handler() | 231 ->network_state_handler() |
| 228 ->SendUpdateNotificationForNetwork(network->path()); | 232 ->SendUpdateNotificationForNetwork(network->path()); |
| 229 } | 233 } |
| 230 | 234 |
| 231 } // namespace chromeos | 235 } // namespace chromeos |
| OLD | NEW |