diff options
author | eroman@chromium.org <eroman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-23 06:02:40 +0000 |
---|---|---|
committer | eroman@chromium.org <eroman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-23 06:02:40 +0000 |
commit | 119655003d8f225282179043e990df879062e529 (patch) | |
tree | 4ee907ddfb8e308a00b5bb9b624e072b028623b6 /net/proxy/proxy_config_service_mac.cc | |
parent | dacc2c255ae3f823e4a39d975e97c067a76dacf9 (diff) | |
download | chromium_src-119655003d8f225282179043e990df879062e529.zip chromium_src-119655003d8f225282179043e990df879062e529.tar.gz chromium_src-119655003d8f225282179043e990df879062e529.tar.bz2 |
Change the ProxyConfigService interface to be asynchronous, and support observers.
The Windows implementation is still using a polling mechanism under the hood, however that polling has been moved to the worker pool so it won't block the IO thread in case WinHttpGetIEProxyConfigForCurrentUser is slow (crbug.com/12189).
BUG=12189
Review URL: http://codereview.chromium.org/3056011
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@53442 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/proxy/proxy_config_service_mac.cc')
-rw-r--r-- | net/proxy/proxy_config_service_mac.cc | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/net/proxy/proxy_config_service_mac.cc b/net/proxy/proxy_config_service_mac.cc index 1e04ff0..27a0426 100644 --- a/net/proxy/proxy_config_service_mac.cc +++ b/net/proxy/proxy_config_service_mac.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 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. @@ -16,8 +16,12 @@ #include "net/proxy/proxy_info.h" #include "net/proxy/proxy_server.h" +namespace net { + namespace { +const int kPollIntervalSec = 5; + // Utility function to pull out a boolean value from a dictionary and return it, // returning a default value if the key is not present. bool GetBoolFromDictionary(CFDictionaryRef dict, @@ -35,11 +39,7 @@ bool GetBoolFromDictionary(CFDictionaryRef dict, return default_value; } -} // namespace - -namespace net { - -int ProxyConfigServiceMac::GetProxyConfig(ProxyConfig* config) { +void GetCurrentProxyConfig(ProxyConfig* config) { scoped_cftyperef<CFDictionaryRef> config_dict( SCDynamicStoreCopyProxies(NULL)); DCHECK(config_dict); @@ -157,8 +157,13 @@ int ProxyConfigServiceMac::GetProxyConfig(ProxyConfig* config) { false)) { config->proxy_rules().bypass_rules.AddRuleToBypassLocal(); } +} + +} // namespace - return OK; +ProxyConfigServiceMac::ProxyConfigServiceMac() + : PollingProxyConfigService(base::TimeDelta::FromSeconds(kPollIntervalSec), + &GetCurrentProxyConfig) { } } // namespace net |