| 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 "chrome/browser/chromeos/ui_proxy_config_service.h" | 5 #include "chrome/browser/chromeos/ui_proxy_config_service.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/values.h" | 9 #include "base/values.h" |
| 10 #include "chrome/browser/chromeos/net/proxy_config_handler.h" | 10 #include "chrome/browser/chromeos/net/proxy_config_handler.h" |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 } | 55 } |
| 56 | 56 |
| 57 } // namespace | 57 } // namespace |
| 58 | 58 |
| 59 UIProxyConfigService::UIProxyConfigService() { | 59 UIProxyConfigService::UIProxyConfigService() { |
| 60 } | 60 } |
| 61 | 61 |
| 62 UIProxyConfigService::~UIProxyConfigService() { | 62 UIProxyConfigService::~UIProxyConfigService() { |
| 63 } | 63 } |
| 64 | 64 |
| 65 void UIProxyConfigService::SetPrefs(PrefService* pref_service) { | 65 void UIProxyConfigService::SetPrefs(bool login_profile, |
| 66 PrefService* pref_service) { |
| 67 login_profile_ = login_profile; |
| 66 pref_service_ = pref_service; | 68 pref_service_ = pref_service; |
| 67 } | 69 } |
| 68 | 70 |
| 69 void UIProxyConfigService::SetCurrentNetwork( | 71 void UIProxyConfigService::SetCurrentNetwork( |
| 70 const std::string& current_network) { | 72 const std::string& current_network) { |
| 71 const NetworkState* network = NULL; | 73 const NetworkState* network = NULL; |
| 72 if (!current_network.empty()) { | 74 if (!current_network.empty()) { |
| 73 network = NetworkHandler::Get()->network_state_handler()->GetNetworkState( | 75 network = NetworkHandler::Get()->network_state_handler()->GetNetworkState( |
| 74 current_network); | 76 current_network); |
| 75 LOG_IF(ERROR, !network) | 77 LOG_IF(ERROR, !network) |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 current_ui_config_.FromNetProxyConfig(effective_config); | 152 current_ui_config_.FromNetProxyConfig(effective_config); |
| 151 current_ui_config_.state = effective_config_state; | 153 current_ui_config_.state = effective_config_state; |
| 152 if (ProxyConfigServiceImpl::PrefPrecedes(effective_config_state)) { | 154 if (ProxyConfigServiceImpl::PrefPrecedes(effective_config_state)) { |
| 153 current_ui_config_.user_modifiable = false; | 155 current_ui_config_.user_modifiable = false; |
| 154 } else if (!IsNetworkProxySettingsEditable(network)) { | 156 } else if (!IsNetworkProxySettingsEditable(network)) { |
| 155 // TODO(xiyuan): Figure out the right way to set config state for managed | 157 // TODO(xiyuan): Figure out the right way to set config state for managed |
| 156 // network. | 158 // network. |
| 157 current_ui_config_.state = ProxyPrefs::CONFIG_POLICY; | 159 current_ui_config_.state = ProxyPrefs::CONFIG_POLICY; |
| 158 current_ui_config_.user_modifiable = false; | 160 current_ui_config_.user_modifiable = false; |
| 159 } else { | 161 } else { |
| 160 current_ui_config_.user_modifiable = | 162 current_ui_config_.user_modifiable = !ProxyConfigServiceImpl::IgnoreProxy( |
| 161 !ProxyConfigServiceImpl::IgnoreProxy(pref_service_, | 163 login_profile_ ? NULL : pref_service_, |
| 162 network.profile_path(), | 164 network.profile_path(), |
| 163 network.onc_source()); | 165 network.onc_source()); |
| 164 } | 166 } |
| 165 } | 167 } |
| 166 | 168 |
| 167 } // namespace chromeos | 169 } // namespace chromeos |
| OLD | NEW |