diff options
author | antrim@chromium.org <antrim@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-02-16 11:29:14 +0000 |
---|---|---|
committer | antrim@chromium.org <antrim@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-02-16 11:29:14 +0000 |
commit | 251ca36b35f7a9faef360c70acc84fc9a3ad1c40 (patch) | |
tree | 213560dd46ed36d2d5fa0b5c8ca0bb998f4c2313 /chrome/browser/chromeos/proxy_config_service_impl.cc | |
parent | 667b1dd812092dc80759c654d439e06882c74474 (diff) | |
download | chromium_src-251ca36b35f7a9faef360c70acc84fc9a3ad1c40.zip chromium_src-251ca36b35f7a9faef360c70acc84fc9a3ad1c40.tar.gz chromium_src-251ca36b35f7a9faef360c70acc84fc9a3ad1c40.tar.bz2 |
Do not explicitly store mode:direct value for proxy
in chrome/browser/prefs/proxy_config_dictionary:
Made it possible to find out current mode while having only DictionaryValue (without creating ProxyConfigDictionary on top of it)
in chrome/browser/chromeos/cros/network_library and chrome/browser/chromeos/proxy_config_service_impl:
Serialize DictionaryValue to empty string instead of {"mode":"direct"} as well as do not store ProxyConfigProperty if it is empty.
BUG=chromium-os:24550
TEST=manual check (change proxy in ui to manual with some text in HTTP proxy, then switch back to Direct Internet Connection / make sure portal is working)
Review URL: http://codereview.chromium.org/9323003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@122275 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/chromeos/proxy_config_service_impl.cc')
-rw-r--r-- | chrome/browser/chromeos/proxy_config_service_impl.cc | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/chrome/browser/chromeos/proxy_config_service_impl.cc b/chrome/browser/chromeos/proxy_config_service_impl.cc index 8480d30..f4039284 100644 --- a/chrome/browser/chromeos/proxy_config_service_impl.cc +++ b/chrome/browser/chromeos/proxy_config_service_impl.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -323,11 +323,22 @@ bool ProxyConfigServiceImpl::ProxyConfig::DeserializeForDevice( bool ProxyConfigServiceImpl::ProxyConfig::SerializeForNetwork( std::string* output) { - scoped_ptr<DictionaryValue> proxy_dict(ToPrefProxyConfig()); - if (!proxy_dict.get()) + scoped_ptr<DictionaryValue> proxy_dict_ptr(ToPrefProxyConfig()); + if (!proxy_dict_ptr.get()) return false; + + // Return empty string for direct mode for portal check to work correctly. + DictionaryValue *dict = proxy_dict_ptr.get(); + ProxyConfigDictionary proxy_dict(dict); + ProxyPrefs::ProxyMode mode; + if (proxy_dict.GetMode(&mode)) { + if (mode == ProxyPrefs::MODE_DIRECT) { + output->clear(); + return true; + } + } JSONStringValueSerializer serializer(output); - return serializer.Serialize(*proxy_dict.get()); + return serializer.Serialize(*dict); } //----------- ProxyConfigServiceImpl::ProxyConfig: private methods ------------- |