OLD | NEW |
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" |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
12 #include "base/prefs/pref_service.h" | 12 #include "base/prefs/pref_service.h" |
13 #include "base/values.h" | 13 #include "base/values.h" |
14 #include "chrome/browser/browser_process.h" | 14 #include "chrome/browser/browser_process.h" |
15 #include "chrome/browser/chromeos/net/proxy_config_handler.h" | 15 #include "chrome/browser/chromeos/net/proxy_config_handler.h" |
16 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" | |
17 #include "chrome/common/pref_names.h" | 16 #include "chrome/common/pref_names.h" |
18 #include "chromeos/network/network_profile.h" | 17 #include "chromeos/network/network_profile.h" |
19 #include "chromeos/network/network_profile_handler.h" | 18 #include "chromeos/network/network_profile_handler.h" |
20 #include "chromeos/network/network_state.h" | 19 #include "chromeos/network/network_state.h" |
21 #include "chromeos/network/network_state_handler.h" | 20 #include "chromeos/network/network_state_handler.h" |
22 #include "chromeos/network/onc/onc_utils.h" | 21 #include "chromeos/network/onc/onc_utils.h" |
23 #include "components/policy/core/common/cloud/cloud_policy_constants.h" | 22 #include "components/policy/core/common/cloud/cloud_policy_constants.h" |
24 #include "components/proxy_config/pref_proxy_config_tracker_impl.h" | 23 #include "components/proxy_config/pref_proxy_config_tracker_impl.h" |
25 #include "components/proxy_config/proxy_config_dictionary.h" | 24 #include "components/proxy_config/proxy_config_dictionary.h" |
26 #include "components/proxy_config/proxy_prefs.h" | 25 #include "components/proxy_config/proxy_prefs.h" |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 return false; | 144 return false; |
146 } | 145 } |
147 if (onc_source == ::onc::ONC_SOURCE_USER_POLICY) { | 146 if (onc_source == ::onc::ONC_SOURCE_USER_POLICY) { |
148 // Note that this case can occur if the network is shared (e.g. ethernet) | 147 // Note that this case can occur if the network is shared (e.g. ethernet) |
149 // but the proxy is determined by user policy. | 148 // but the proxy is determined by user policy. |
150 // See https://crbug.com/454966 . | 149 // See https://crbug.com/454966 . |
151 VLOG(1) << "Respect proxy from user policy although network is shared."; | 150 VLOG(1) << "Respect proxy from user policy although network is shared."; |
152 return false; | 151 return false; |
153 } | 152 } |
154 if (onc_source == ::onc::ONC_SOURCE_DEVICE_POLICY) { | 153 if (onc_source == ::onc::ONC_SOURCE_DEVICE_POLICY) { |
155 policy::BrowserPolicyConnectorChromeOS* connector = | |
156 g_browser_process->platform_part()->browser_policy_connector_chromeos(); | |
157 const user_manager::User* logged_in_user = | 154 const user_manager::User* logged_in_user = |
158 user_manager::UserManager::Get()->GetLoggedInUser(); | 155 user_manager::UserManager::Get()->GetLoggedInUser(); |
159 if (connector->GetUserAffiliation(logged_in_user->email()) == | 156 if (logged_in_user->is_affiliated()) { |
160 policy::USER_AFFILIATION_MANAGED) { | |
161 VLOG(1) << "Respecting proxy for network, as logged-in user belongs to " | 157 VLOG(1) << "Respecting proxy for network, as logged-in user belongs to " |
162 << "the domain the device is enrolled to."; | 158 << "the domain the device is enrolled to."; |
163 return false; | 159 return false; |
164 } | 160 } |
165 } | 161 } |
166 | 162 |
167 // This network is shared and not managed by the user's domain. | 163 // This network is shared and not managed by the user's domain. |
168 bool use_shared_proxies = profile_prefs->GetBoolean(prefs::kUseSharedProxies); | 164 bool use_shared_proxies = profile_prefs->GetBoolean(prefs::kUseSharedProxies); |
169 VLOG(1) << "Use proxy of shared network: " << use_shared_proxies; | 165 VLOG(1) << "Use proxy of shared network: " << use_shared_proxies; |
170 return !use_shared_proxies; | 166 return !use_shared_proxies; |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 if (VLOG_IS_ON(1) && !update_pending()) { // Update was successful. | 232 if (VLOG_IS_ON(1) && !update_pending()) { // Update was successful. |
237 scoped_ptr<base::DictionaryValue> config_dict(effective_config.ToValue()); | 233 scoped_ptr<base::DictionaryValue> config_dict(effective_config.ToValue()); |
238 VLOG(1) << this << ": Proxy changed: " | 234 VLOG(1) << this << ": Proxy changed: " |
239 << ProxyPrefs::ConfigStateToDebugString(active_config_state_) | 235 << ProxyPrefs::ConfigStateToDebugString(active_config_state_) |
240 << ", " << *config_dict; | 236 << ", " << *config_dict; |
241 } | 237 } |
242 } | 238 } |
243 } | 239 } |
244 | 240 |
245 } // namespace chromeos | 241 } // namespace chromeos |
OLD | NEW |