diff options
author | pneubeck@chromium.org <pneubeck@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-28 21:24:57 +0000 |
---|---|---|
committer | pneubeck@chromium.org <pneubeck@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-28 21:24:57 +0000 |
commit | 25414cf2d4549f480245d98b9dbceda3f5dfcaf6 (patch) | |
tree | bd979586be6f5b9cc0a701a097e50507cbc1007c /chrome/browser/chromeos | |
parent | 452b4a958d55f8824b0ca9a1397249bfe95ebff3 (diff) | |
download | chromium_src-25414cf2d4549f480245d98b9dbceda3f5dfcaf6.zip chromium_src-25414cf2d4549f480245d98b9dbceda3f5dfcaf6.tar.gz chromium_src-25414cf2d4549f480245d98b9dbceda3f5dfcaf6.tar.bz2 |
For managed users, enforce proxy settings of device policy configured networks.
Previously, these users had to check 'Allow proxies for shared networks' which has the side-effect of allowing proxies also for networks shared with other device users.
Now, these users get the proxies of the device policy automatically without requiring any action.
BUG=221795
TEST=Setup a device policy network with proxy settings. Log in. Connect to that network. Check the proxy settings on net-internals. Do the same with a non-managed user and ensure that proxy is not active.
Review URL: https://chromiumcodereview.appspot.com/13004008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@191211 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/chromeos')
-rw-r--r-- | chrome/browser/chromeos/proxy_config_service_impl.cc | 25 | ||||
-rw-r--r-- | chrome/browser/chromeos/proxy_config_service_impl.h | 10 |
2 files changed, 29 insertions, 6 deletions
diff --git a/chrome/browser/chromeos/proxy_config_service_impl.cc b/chrome/browser/chromeos/proxy_config_service_impl.cc index 9a7c9f2..71155f0 100644 --- a/chrome/browser/chromeos/proxy_config_service_impl.cc +++ b/chrome/browser/chromeos/proxy_config_service_impl.cc @@ -12,11 +12,15 @@ #include "base/prefs/pref_registry_simple.h" #include "base/prefs/pref_service.h" #include "base/string_util.h" +#include "chrome/browser/browser_process.h" #include "chrome/browser/chromeos/cros/cros_library.h" +#include "chrome/browser/chromeos/cros/network_ui_data.h" #include "chrome/browser/chromeos/login/user_manager.h" #include "chrome/browser/chromeos/policy/proto/chrome_device_policy.pb.h" #include "chrome/browser/chromeos/settings/cros_settings.h" #include "chrome/browser/chromeos/settings/cros_settings_names.h" +#include "chrome/browser/policy/browser_policy_connector.h" +#include "chrome/browser/policy/cloud/cloud_policy_constants.h" #include "chrome/browser/prefs/proxy_config_dictionary.h" #include "chrome/browser/prefs/proxy_prefs.h" #include "chrome/browser/profiles/profile_manager.h" @@ -709,6 +713,27 @@ bool ProxyConfigServiceImpl::GetUseSharedProxies() { return use_shared_proxies_.GetValue(); } +bool ProxyConfigServiceImpl::IgnoreProxy(const Network* network) { + if (network->profile_type() == PROFILE_USER) + return false; + + if (network->ui_data().onc_source() == onc::ONC_SOURCE_DEVICE_POLICY && + UserManager::Get()->IsUserLoggedIn()) { + policy::BrowserPolicyConnector* connector = + g_browser_process->browser_policy_connector(); + const User* logged_in_user = UserManager::Get()->GetLoggedInUser(); + if (connector->GetUserAffiliation(logged_in_user->email()) == + policy::USER_AFFILIATION_MANAGED) { + VLOG(1) << "Respecting proxy for network " << network->name() + << ", as logged-in user belongs to the domain the device " + << "is enrolled to."; + return false; + } + } + + return !GetUseSharedProxies(); +} + void ProxyConfigServiceImpl::DetermineEffectiveConfig(const Network* network, bool activate) { // Get prefs proxy config if available. diff --git a/chrome/browser/chromeos/proxy_config_service_impl.h b/chrome/browser/chromeos/proxy_config_service_impl.h index 53c71d8..873af93 100644 --- a/chrome/browser/chromeos/proxy_config_service_impl.h +++ b/chrome/browser/chromeos/proxy_config_service_impl.h @@ -241,6 +241,10 @@ class ProxyConfigServiceImpl // returns false if user is logged in and true otherwise. bool GetUseSharedProxies(); + // Returns true if proxy is to be ignored for network, which happens if + // network is shared and use-shared-proxies is turned off. + bool IgnoreProxy(const Network* network); + // Determines effective proxy config based on prefs from config tracker, // |network| and if user is using shared proxies. // If |activate| is true, effective config is stored in |active_config_| and @@ -253,12 +257,6 @@ class ProxyConfigServiceImpl // UISetCurrentNetwork and UIMakeActiveNetworkActive. void OnUISetCurrentNetwork(const Network* network); - // Returns true if proxy is to be ignored for network, which happens if - // network is shared and use-shared-proxies is turned off. - bool IgnoreProxy(const Network* network) { - return network->profile_type() == PROFILE_SHARED && !GetUseSharedProxies(); - } - // Reset UI cache variables that keep track of UI activities. void ResetUICache(); |