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/login/users/user_manager.h" | |
16 #include "chrome/browser/chromeos/net/proxy_config_handler.h" | 15 #include "chrome/browser/chromeos/net/proxy_config_handler.h" |
17 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" | 16 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" |
18 #include "chrome/browser/prefs/proxy_config_dictionary.h" | 17 #include "chrome/browser/prefs/proxy_config_dictionary.h" |
19 #include "chrome/browser/prefs/proxy_prefs.h" | 18 #include "chrome/browser/prefs/proxy_prefs.h" |
20 #include "chrome/common/pref_names.h" | 19 #include "chrome/common/pref_names.h" |
21 #include "chromeos/network/network_profile.h" | 20 #include "chromeos/network/network_profile.h" |
22 #include "chromeos/network/network_profile_handler.h" | 21 #include "chromeos/network/network_profile_handler.h" |
23 #include "chromeos/network/network_state.h" | 22 #include "chromeos/network/network_state.h" |
24 #include "chromeos/network/network_state_handler.h" | 23 #include "chromeos/network/network_state_handler.h" |
25 #include "chromeos/network/onc/onc_utils.h" | 24 #include "chromeos/network/onc/onc_utils.h" |
26 #include "components/policy/core/common/cloud/cloud_policy_constants.h" | 25 #include "components/policy/core/common/cloud/cloud_policy_constants.h" |
| 26 #include "components/user_manager/user_manager.h" |
27 | 27 |
28 namespace chromeos { | 28 namespace chromeos { |
29 | 29 |
30 namespace { | 30 namespace { |
31 | 31 |
32 // Writes the proxy config of |network| to |proxy_config|. Set |onc_source| to | 32 // Writes the proxy config of |network| to |proxy_config|. Set |onc_source| to |
33 // the source of this configuration. Returns false if no | 33 // the source of this configuration. Returns false if no |
34 // proxy was configured for this network. | 34 // proxy was configured for this network. |
35 bool GetProxyConfig(const PrefService* profile_prefs, | 35 bool GetProxyConfig(const PrefService* profile_prefs, |
36 const PrefService* local_state_prefs, | 36 const PrefService* local_state_prefs, |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 return true; | 137 return true; |
138 } | 138 } |
139 if (profile->type() == NetworkProfile::TYPE_USER) { | 139 if (profile->type() == NetworkProfile::TYPE_USER) { |
140 VLOG(1) << "Respect proxy of not-shared networks."; | 140 VLOG(1) << "Respect proxy of not-shared networks."; |
141 return false; | 141 return false; |
142 } | 142 } |
143 if (onc_source == ::onc::ONC_SOURCE_DEVICE_POLICY) { | 143 if (onc_source == ::onc::ONC_SOURCE_DEVICE_POLICY) { |
144 policy::BrowserPolicyConnectorChromeOS* connector = | 144 policy::BrowserPolicyConnectorChromeOS* connector = |
145 g_browser_process->platform_part()->browser_policy_connector_chromeos(); | 145 g_browser_process->platform_part()->browser_policy_connector_chromeos(); |
146 const user_manager::User* logged_in_user = | 146 const user_manager::User* logged_in_user = |
147 UserManager::Get()->GetLoggedInUser(); | 147 user_manager::UserManager::Get()->GetLoggedInUser(); |
148 if (connector->GetUserAffiliation(logged_in_user->email()) == | 148 if (connector->GetUserAffiliation(logged_in_user->email()) == |
149 policy::USER_AFFILIATION_MANAGED) { | 149 policy::USER_AFFILIATION_MANAGED) { |
150 VLOG(1) << "Respecting proxy for network, as logged-in user belongs to " | 150 VLOG(1) << "Respecting proxy for network, as logged-in user belongs to " |
151 << "the domain the device is enrolled to."; | 151 << "the domain the device is enrolled to."; |
152 return false; | 152 return false; |
153 } | 153 } |
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); |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 if (VLOG_IS_ON(1) && !update_pending()) { // Update was successful. | 225 if (VLOG_IS_ON(1) && !update_pending()) { // Update was successful. |
226 scoped_ptr<base::DictionaryValue> config_dict(effective_config.ToValue()); | 226 scoped_ptr<base::DictionaryValue> config_dict(effective_config.ToValue()); |
227 VLOG(1) << this << ": Proxy changed: " | 227 VLOG(1) << this << ": Proxy changed: " |
228 << ProxyPrefs::ConfigStateToDebugString(active_config_state_) | 228 << ProxyPrefs::ConfigStateToDebugString(active_config_state_) |
229 << ", " << *config_dict; | 229 << ", " << *config_dict; |
230 } | 230 } |
231 } | 231 } |
232 } | 232 } |
233 | 233 |
234 } // namespace chromeos | 234 } // namespace chromeos |
OLD | NEW |