summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/chromeos/proxy_config_service_impl.cc25
-rw-r--r--chrome/browser/chromeos/proxy_config_service_impl.h10
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();