Chromium Code Reviews| Index: chrome/browser/chromeos/proxy_cros_settings_provider.cc |
| =================================================================== |
| --- chrome/browser/chromeos/proxy_cros_settings_provider.cc (revision 106059) |
| +++ chrome/browser/chromeos/proxy_cros_settings_provider.cc (working copy) |
| @@ -7,6 +7,7 @@ |
| #include "base/string_util.h" |
| #include "chrome/browser/browser_process.h" |
| #include "chrome/browser/chromeos/cros_settings.h" |
| +#include "chrome/browser/profiles/profile.h" |
| #include "chrome/browser/ui/browser_list.h" |
| namespace chromeos { |
| @@ -45,30 +46,22 @@ |
| //------------------ ProxyCrosSettingsProvider: public methods ----------------- |
| -ProxyCrosSettingsProvider::ProxyCrosSettingsProvider() { } |
| +ProxyCrosSettingsProvider::ProxyCrosSettingsProvider(Profile* profile) |
| + : profile_(profile) { |
| +} |
| void ProxyCrosSettingsProvider::SetCurrentNetwork(const std::string& network) { |
| - if (!GetConfigService()->UISetCurrentNetwork(network)) |
| - return; |
| + GetConfigService()->UISetCurrentNetwork(network); |
| for (size_t i = 0; i < arraysize(kProxySettings); ++i) |
| CrosSettings::Get()->FireObservers(kProxySettings[i]); |
| } |
| void ProxyCrosSettingsProvider::MakeActiveNetworkCurrent() { |
| - if (!GetConfigService()->UIMakeActiveNetworkCurrent()) |
| - return; |
| + GetConfigService()->UIMakeActiveNetworkCurrent(); |
| for (size_t i = 0; i < arraysize(kProxySettings); ++i) |
| CrosSettings::Get()->FireObservers(kProxySettings[i]); |
| } |
| -bool ProxyCrosSettingsProvider::IsUsingSharedProxies() const { |
| - return GetConfigService()->use_shared_proxies(); |
| -} |
| - |
| -const std::string& ProxyCrosSettingsProvider::GetCurrentNetworkName() const { |
| - return GetConfigService()->current_network_name(); |
| -} |
| - |
| void ProxyCrosSettingsProvider::DoSet(const std::string& path, |
| Value* in_value) { |
| if (!in_value) { |
| @@ -235,6 +228,7 @@ |
| Value** out_value) const { |
| bool found = false; |
| bool managed = false; |
| + std::string controlled_by; |
| Value* data = NULL; |
| chromeos::ProxyConfigServiceImpl* config_service = GetConfigService(); |
| chromeos::ProxyConfigServiceImpl::ProxyConfig config; |
| @@ -274,6 +268,25 @@ |
| } else { |
| data = Value::CreateIntegerValue(1); |
| } |
| + switch (config.state) { |
| + case ProxyPrefs::CONFIG_POLICY: |
| + controlled_by = "policyManagedPrefsBannerText"; |
| + break; |
| + case ProxyPrefs::CONFIG_EXTENSION: |
| + controlled_by = "extensionManagedPrefsBannerText"; |
| + break; |
| + case ProxyPrefs::CONFIG_OTHER_PRECEDE: |
| + controlled_by = "unmodifiablePrefsBannerText"; |
| + break; |
| + case ProxyPrefs::CONFIG_FALLBACK: |
| + controlled_by = config.user_modifiable ? |
| + "policyManagedPrefsBannerText" : "enableSharedProxiesBannerText"; |
|
Mattias Nissler (ping if slow)
2011/10/19 19:27:36
This is for showing the banner, correct? Should we
kuan
2011/10/20 00:41:11
this is from sumit. we used to not allow proxy pa
Mattias Nissler (ping if slow)
2011/10/24 10:18:28
That is true for managed policy. For recommended p
kuan
2011/10/25 02:01:54
i'm simply implementing it according to requiremen
Mattias Nissler (ping if slow)
2011/10/25 12:43:11
I do feel strong about avoiding inconsistency to h
kuan
2011/10/25 16:01:50
Done.
|
| + break; |
| + default: |
| + if (!config.user_modifiable) |
| + controlled_by = "enableSharedProxiesBannerText"; |
| + break; |
| + } |
| found = true; |
| } else if (path == kProxySingle) { |
| data = Value::CreateBooleanValue(config.mode == |
| @@ -312,6 +325,10 @@ |
| data = Value::CreateStringValue(""); |
| dict->Set("value", data); |
| dict->SetBoolean("managed", managed); |
| + if (path == kProxyType) { |
| + dict->SetString("controlledBy", controlled_by); |
| + dict->SetBoolean("disabled", !config.user_modifiable); |
| + } |
| *out_value = dict; |
| return true; |
| } else { |
| @@ -328,7 +345,7 @@ |
| chromeos::ProxyConfigServiceImpl* |
| ProxyCrosSettingsProvider::GetConfigService() const { |
| - return g_browser_process->chromeos_proxy_config_service_impl(); |
| + return profile_->GetProxyConfigTracker(); |
| } |
| net::ProxyServer ProxyCrosSettingsProvider::CreateProxyServerFromHost( |