diff options
author | rvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-19 21:23:00 +0000 |
---|---|---|
committer | rvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-19 21:23:00 +0000 |
commit | f4ffb7a7159a9cc23ca8c634d764865ed208a5f2 (patch) | |
tree | 481139baefa1715a50aee942fb7822aea0033e2f /net/proxy | |
parent | cfc81e114d5fc3de7761537350c4e015ab894700 (diff) | |
download | chromium_src-f4ffb7a7159a9cc23ca8c634d764865ed208a5f2.zip chromium_src-f4ffb7a7159a9cc23ca8c634d764865ed208a5f2.tar.gz chromium_src-f4ffb7a7159a9cc23ca8c634d764865ed208a5f2.tar.bz2 |
net: Add net_api to the proxy code.
BUG=76997
TEST=NONE
Review URL: http://codereview.chromium.org/7011055
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@85974 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/proxy')
-rw-r--r-- | net/proxy/init_proxy_resolver.h | 3 | ||||
-rw-r--r-- | net/proxy/multi_threaded_proxy_resolver.h | 6 | ||||
-rw-r--r-- | net/proxy/network_delegate_error_observer.h | 3 | ||||
-rw-r--r-- | net/proxy/polling_proxy_config_service.h | 4 | ||||
-rw-r--r-- | net/proxy/proxy_bypass_rules.h | 5 | ||||
-rw-r--r-- | net/proxy/proxy_config.h | 5 | ||||
-rw-r--r-- | net/proxy/proxy_config_service.h | 6 | ||||
-rw-r--r-- | net/proxy/proxy_config_service_fixed.h | 2 | ||||
-rw-r--r-- | net/proxy/proxy_config_service_win.h | 7 | ||||
-rw-r--r-- | net/proxy/proxy_info.h | 5 | ||||
-rw-r--r-- | net/proxy/proxy_list.h | 5 | ||||
-rw-r--r-- | net/proxy/proxy_resolver.h | 3 | ||||
-rw-r--r-- | net/proxy/proxy_resolver_error_observer.h | 3 | ||||
-rw-r--r-- | net/proxy/proxy_resolver_js_bindings.h | 3 | ||||
-rw-r--r-- | net/proxy/proxy_resolver_script_data.h | 3 | ||||
-rw-r--r-- | net/proxy/proxy_resolver_v8.h | 3 | ||||
-rw-r--r-- | net/proxy/proxy_resolver_winhttp.h | 4 | ||||
-rw-r--r-- | net/proxy/proxy_script_fetcher.h | 3 | ||||
-rw-r--r-- | net/proxy/proxy_script_fetcher_impl.h | 4 | ||||
-rw-r--r-- | net/proxy/proxy_server.h | 5 | ||||
-rw-r--r-- | net/proxy/proxy_service.h | 10 | ||||
-rw-r--r-- | net/proxy/sync_host_resolver_bridge.h | 2 |
22 files changed, 57 insertions, 37 deletions
diff --git a/net/proxy/init_proxy_resolver.h b/net/proxy/init_proxy_resolver.h index ffb1b83..89e20c3 100644 --- a/net/proxy/init_proxy_resolver.h +++ b/net/proxy/init_proxy_resolver.h @@ -14,6 +14,7 @@ #include "base/scoped_ptr.h" #include "googleurl/src/gurl.h" #include "net/base/completion_callback.h" +#include "net/base/net_api.h" #include "net/base/net_log.h" namespace net { @@ -41,7 +42,7 @@ class URLRequestContext; // Deleting InitProxyResolver while Init() is in progress, will // cancel the request. // -class InitProxyResolver { +class NET_TEST InitProxyResolver { public: // |resolver|, |proxy_script_fetcher|, |dhcp_proxy_script_fetcher| and // |net_log| must remain valid for the lifespan of InitProxyResolver. diff --git a/net/proxy/multi_threaded_proxy_resolver.h b/net/proxy/multi_threaded_proxy_resolver.h index 00c3dbe..0a0ab63 100644 --- a/net/proxy/multi_threaded_proxy_resolver.h +++ b/net/proxy/multi_threaded_proxy_resolver.h @@ -13,6 +13,7 @@ #include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" #include "base/threading/non_thread_safe.h" +#include "net/base/net_api.h" #include "net/proxy/proxy_resolver.h" namespace base { @@ -71,8 +72,9 @@ class ProxyResolverFactory { // a global counter and using that to make a decision. In the // multi-threaded model, each thread may have a different value for this // counter, so it won't globally be seen as monotonically increasing! -class MultiThreadedProxyResolver : public ProxyResolver, - public base::NonThreadSafe { +class NET_TEST MultiThreadedProxyResolver + : public ProxyResolver, + NON_EXPORTED_BASE(public base::NonThreadSafe) { public: // Creates an asynchronous ProxyResolver that runs requests on up to // |max_num_threads|. diff --git a/net/proxy/network_delegate_error_observer.h b/net/proxy/network_delegate_error_observer.h index 8ece647..8279007 100644 --- a/net/proxy/network_delegate_error_observer.h +++ b/net/proxy/network_delegate_error_observer.h @@ -19,7 +19,8 @@ class NetworkDelegate; // An implementation of ProxyResolverErrorObserver that forwards PAC script // errors to a NetworkDelegate object on the thread it lives on. -class NetworkDelegateErrorObserver : public ProxyResolverErrorObserver { +class NET_TEST NetworkDelegateErrorObserver + : public ProxyResolverErrorObserver { public: NetworkDelegateErrorObserver(NetworkDelegate* network_delegate, base::MessageLoopProxy* origin_loop); diff --git a/net/proxy/polling_proxy_config_service.h b/net/proxy/polling_proxy_config_service.h index 6cd1244..044241d 100644 --- a/net/proxy/polling_proxy_config_service.h +++ b/net/proxy/polling_proxy_config_service.h @@ -17,7 +17,7 @@ namespace net { // // It runs code to get the current proxy settings on a background worker // thread, and notifies registered observers when the value changes. -class PollingProxyConfigService : public ProxyConfigService { +class NET_TEST PollingProxyConfigService : public ProxyConfigService { public: // ProxyConfigService implementation: virtual void AddObserver(Observer* observer); @@ -46,6 +46,8 @@ class PollingProxyConfigService : public ProxyConfigService { private: class Core; scoped_refptr<Core> core_; + + DISALLOW_COPY_AND_ASSIGN(PollingProxyConfigService); }; } // namespace net diff --git a/net/proxy/proxy_bypass_rules.h b/net/proxy/proxy_bypass_rules.h index c0f5df3..212ee5f 100644 --- a/net/proxy/proxy_bypass_rules.h +++ b/net/proxy/proxy_bypass_rules.h @@ -10,16 +10,17 @@ #include <vector> #include "googleurl/src/gurl.h" +#include "net/base/net_api.h" namespace net { // ProxyBypassRules describes the set of URLs that should bypass the proxy // settings, as a list of rules. A URL is said to match the bypass rules // if it matches any one of these rules. -class ProxyBypassRules { +class NET_API ProxyBypassRules { public: // Interface for an individual proxy bypass rule. - class Rule { + class NET_API Rule { public: Rule(); virtual ~Rule(); diff --git a/net/proxy/proxy_config.h b/net/proxy/proxy_config.h index dc0fd71..be5e2fb 100644 --- a/net/proxy/proxy_config.h +++ b/net/proxy/proxy_config.h @@ -9,6 +9,7 @@ #include <string> #include "googleurl/src/gurl.h" +#include "net/base/net_api.h" #include "net/proxy/proxy_bypass_rules.h" #include "net/proxy/proxy_server.h" @@ -29,11 +30,11 @@ class ProxyInfo; // // For more details see: // http://www.chromium.org/developers/design-documents/proxy-settings-fallback -class ProxyConfig { +class NET_API ProxyConfig { public: // ProxyRules describes the "manual" proxy settings. // TODO(eroman): Turn this into a class. - struct ProxyRules { + struct NET_API ProxyRules { enum Type { TYPE_NO_RULES, TYPE_SINGLE_PROXY, diff --git a/net/proxy/proxy_config_service.h b/net/proxy/proxy_config_service.h index f194ca0..157745e 100644 --- a/net/proxy/proxy_config_service.h +++ b/net/proxy/proxy_config_service.h @@ -6,12 +6,14 @@ #define NET_PROXY_PROXY_CONFIG_SERVICE_H_ #pragma once +#include "net/base/net_api.h" + namespace net { class ProxyConfig; // Service for watching when the proxy settings have changed. -class ProxyConfigService { +class NET_API ProxyConfigService { public: // Indicates whether proxy configuration is valid, and if not, why. enum ConfigAvailability { @@ -24,7 +26,7 @@ class ProxyConfigService { }; // Observer for being notified when the proxy settings have changed. - class Observer { + class NET_API Observer { public: virtual ~Observer() {} // Notification callback that should be invoked by ProxyConfigService diff --git a/net/proxy/proxy_config_service_fixed.h b/net/proxy/proxy_config_service_fixed.h index 54baa56..33b2c8e 100644 --- a/net/proxy/proxy_config_service_fixed.h +++ b/net/proxy/proxy_config_service_fixed.h @@ -13,7 +13,7 @@ namespace net { // Implementation of ProxyConfigService that returns a fixed result. -class ProxyConfigServiceFixed : public ProxyConfigService { +class NET_API ProxyConfigServiceFixed : public ProxyConfigService { public: explicit ProxyConfigServiceFixed(const ProxyConfig& pc); virtual ~ProxyConfigServiceFixed(); diff --git a/net/proxy/proxy_config_service_win.h b/net/proxy/proxy_config_service_win.h index dc1da12..dd21dbe 100644 --- a/net/proxy/proxy_config_service_win.h +++ b/net/proxy/proxy_config_service_win.h @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 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. @@ -39,8 +39,9 @@ namespace net { // implementation details of WinHttpGetIEProxyConfigForCurrentUser() ever // change, or in case we got it wrong (and are not checking all possible // registry dependencies). -class ProxyConfigServiceWin : public PollingProxyConfigService, - public base::win::ObjectWatcher::Delegate { +class NET_TEST ProxyConfigServiceWin + : public PollingProxyConfigService, + public base::win::ObjectWatcher::Delegate { public: ProxyConfigServiceWin(); virtual ~ProxyConfigServiceWin(); diff --git a/net/proxy/proxy_info.h b/net/proxy/proxy_info.h index 1194752..ecea5efc 100644 --- a/net/proxy/proxy_info.h +++ b/net/proxy/proxy_info.h @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 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. @@ -8,6 +8,7 @@ #include <string> +#include "net/base/net_api.h" #include "net/proxy/proxy_config.h" #include "net/proxy/proxy_list.h" #include "net/proxy/proxy_retry_info.h" @@ -16,7 +17,7 @@ namespace net { // This object holds proxy information returned by ResolveProxy. -class ProxyInfo { +class NET_API ProxyInfo { public: ProxyInfo(); ~ProxyInfo(); diff --git a/net/proxy/proxy_list.h b/net/proxy/proxy_list.h index e5c41c6..c03c262 100644 --- a/net/proxy/proxy_list.h +++ b/net/proxy/proxy_list.h @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 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. @@ -9,6 +9,7 @@ #include <string> #include <vector> +#include "net/base/net_api.h" #include "net/proxy/proxy_retry_info.h" namespace net { @@ -18,7 +19,7 @@ class ProxyServer; // This class is used to hold a list of proxies returned by GetProxyForUrl or // manually configured. It handles proxy fallback if multiple servers are // specified. -class ProxyList { +class NET_TEST ProxyList { public: ProxyList(); ~ProxyList(); diff --git a/net/proxy/proxy_resolver.h b/net/proxy/proxy_resolver.h index acdc253..3e31e9f 100644 --- a/net/proxy/proxy_resolver.h +++ b/net/proxy/proxy_resolver.h @@ -11,6 +11,7 @@ #include "base/string16.h" #include "googleurl/src/gurl.h" #include "net/base/completion_callback.h" +#include "net/base/net_api.h" #include "net/proxy/proxy_resolver_script_data.h" namespace net { @@ -22,7 +23,7 @@ class ProxyInfo; // to use for a particular URL. Generally the backend for a ProxyResolver is // a PAC script, but it doesn't need to be. ProxyResolver can service multiple // requests at a time. -class ProxyResolver { +class NET_TEST ProxyResolver { public: // Opaque pointer type, to return a handle to cancel outstanding requests. typedef void* RequestHandle; diff --git a/net/proxy/proxy_resolver_error_observer.h b/net/proxy/proxy_resolver_error_observer.h index 3bc8f62..d2d183c 100644 --- a/net/proxy/proxy_resolver_error_observer.h +++ b/net/proxy/proxy_resolver_error_observer.h @@ -8,6 +8,7 @@ #include "base/basictypes.h" #include "base/string16.h" +#include "net/base/net_api.h" namespace net { @@ -15,7 +16,7 @@ namespace net { // default implementation of the ProxyResolverJSBindings takes a class // implementing this interface and forwards all JavaScript errors related to // PAC scripts. -class ProxyResolverErrorObserver { +class NET_TEST ProxyResolverErrorObserver { public: ProxyResolverErrorObserver() {} virtual ~ProxyResolverErrorObserver() {} diff --git a/net/proxy/proxy_resolver_js_bindings.h b/net/proxy/proxy_resolver_js_bindings.h index 3b4719e..d2a53d1 100644 --- a/net/proxy/proxy_resolver_js_bindings.h +++ b/net/proxy/proxy_resolver_js_bindings.h @@ -9,6 +9,7 @@ #include <string> #include "base/string16.h" +#include "net/base/net_api.h" namespace net { @@ -18,7 +19,7 @@ class ProxyResolverErrorObserver; struct ProxyResolverRequestContext; // Interface for the javascript bindings. -class ProxyResolverJSBindings { +class NET_TEST ProxyResolverJSBindings { public: ProxyResolverJSBindings() : current_request_context_(NULL) {} diff --git a/net/proxy/proxy_resolver_script_data.h b/net/proxy/proxy_resolver_script_data.h index d8195bb..46710e4 100644 --- a/net/proxy/proxy_resolver_script_data.h +++ b/net/proxy/proxy_resolver_script_data.h @@ -9,6 +9,7 @@ #include "base/memory/ref_counted.h" #include "base/string16.h" #include "googleurl/src/gurl.h" +#include "net/base/net_api.h" namespace net { @@ -18,7 +19,7 @@ namespace net { // // This is thread-safe so it can be used by multi-threaded implementations of // ProxyResolver to share the data between threads. -class ProxyResolverScriptData +class NET_TEST ProxyResolverScriptData : public base::RefCountedThreadSafe<ProxyResolverScriptData> { public: enum Type { diff --git a/net/proxy/proxy_resolver_v8.h b/net/proxy/proxy_resolver_v8.h index 795944e..e6b5b2f 100644 --- a/net/proxy/proxy_resolver_v8.h +++ b/net/proxy/proxy_resolver_v8.h @@ -7,6 +7,7 @@ #pragma once #include "base/memory/scoped_ptr.h" +#include "net/base/net_api.h" #include "net/proxy/proxy_resolver.h" namespace net { @@ -31,7 +32,7 @@ class ProxyResolverJSBindings; // This is the case with the V8 instance used by chromium's renderer -- it runs // on a different thread from ProxyResolver (renderer thread vs PAC thread), // and does not use locking since it expects to be alone. -class ProxyResolverV8 : public ProxyResolver { +class NET_TEST ProxyResolverV8 : public ProxyResolver { public: // Constructs a ProxyResolverV8 with custom bindings. ProxyResolverV8 takes // ownership of |custom_js_bindings| and deletes it when ProxyResolverV8 diff --git a/net/proxy/proxy_resolver_winhttp.h b/net/proxy/proxy_resolver_winhttp.h index 9784672..64f5928 100644 --- a/net/proxy/proxy_resolver_winhttp.h +++ b/net/proxy/proxy_resolver_winhttp.h @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 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. @@ -15,7 +15,7 @@ namespace net { // An implementation of ProxyResolver that uses WinHTTP and the system // proxy settings. -class ProxyResolverWinHttp : public ProxyResolver { +class NET_TEST ProxyResolverWinHttp : public ProxyResolver { public: ProxyResolverWinHttp(); virtual ~ProxyResolverWinHttp(); diff --git a/net/proxy/proxy_script_fetcher.h b/net/proxy/proxy_script_fetcher.h index d488375..778c6b1 100644 --- a/net/proxy/proxy_script_fetcher.h +++ b/net/proxy/proxy_script_fetcher.h @@ -12,6 +12,7 @@ #include "base/string16.h" #include "net/base/completion_callback.h" +#include "net/base/net_api.h" class GURL; @@ -21,7 +22,7 @@ class URLRequestContext; // Interface for downloading a PAC script. Implementations can enforce // timeouts, maximum size constraints, content encoding, etc.. -class ProxyScriptFetcher { +class NET_TEST ProxyScriptFetcher { public: // Destruction should cancel any outstanding requests. virtual ~ProxyScriptFetcher() {} diff --git a/net/proxy/proxy_script_fetcher_impl.h b/net/proxy/proxy_script_fetcher_impl.h index 8e9ca3b..8cff42f 100644 --- a/net/proxy/proxy_script_fetcher_impl.h +++ b/net/proxy/proxy_script_fetcher_impl.h @@ -24,8 +24,8 @@ class URLRequestContext; // Implementation of ProxyScriptFetcher that downloads scripts using the // specified request context. -class ProxyScriptFetcherImpl : public ProxyScriptFetcher, - public URLRequest::Delegate { +class NET_API ProxyScriptFetcherImpl : public ProxyScriptFetcher, + public URLRequest::Delegate { public: // Creates a ProxyScriptFetcher that issues requests through // |url_request_context|. |url_request_context| must remain valid for the diff --git a/net/proxy/proxy_server.h b/net/proxy/proxy_server.h index c127aad..cfcd41a 100644 --- a/net/proxy/proxy_server.h +++ b/net/proxy/proxy_server.h @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 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. @@ -14,12 +14,13 @@ #include <string> #include "net/base/host_port_pair.h" +#include "net/base/net_api.h" namespace net { // ProxyServer encodes the {type, host, port} of a proxy server. // ProxyServer is immutable. -class ProxyServer { +class NET_API ProxyServer { public: // The type of proxy. These are defined as bit flags so they can be ORed // together to pass as the |scheme_bit_field| argument to diff --git a/net/proxy/proxy_service.h b/net/proxy/proxy_service.h index cee7ef6..0ad7080 100644 --- a/net/proxy/proxy_service.h +++ b/net/proxy/proxy_service.h @@ -14,6 +14,7 @@ #include "base/synchronization/waitable_event.h" #include "base/threading/non_thread_safe.h" #include "net/base/completion_callback.h" +#include "net/base/net_api.h" #include "net/base/net_log.h" #include "net/base/network_change_notifier.h" #include "net/proxy/proxy_config_service.h" @@ -36,9 +37,9 @@ class URLRequestContext; // This class can be used to resolve the proxy server to use when loading a // HTTP(S) URL. It uses the given ProxyResolver to handle the actual proxy // resolution. See ProxyResolverV8 for example. -class ProxyService : public NetworkChangeNotifier::IPAddressObserver, - public ProxyConfigService::Observer, - public base::NonThreadSafe { +class NET_API ProxyService : public NetworkChangeNotifier::IPAddressObserver, + public ProxyConfigService::Observer, + NON_EXPORTED_BASE(public base::NonThreadSafe) { public: // The instance takes ownership of |config_service| and |resolver|. // |net_log| is a possibly NULL destination to send log events to. It must @@ -221,11 +222,10 @@ class ProxyService : public NetworkChangeNotifier::IPAddressObserver, static ProxyConfigService* CreateSystemProxyConfigService( MessageLoop* io_loop, MessageLoop* file_loop); -#if UNIT_TEST + // This method should only be used by unit tests. void set_stall_proxy_auto_config_delay(base::TimeDelta delay) { stall_proxy_auto_config_delay_ = delay; } -#endif private: FRIEND_TEST_ALL_PREFIXES(ProxyServiceTest, UpdateConfigAfterFailedAutodetect); diff --git a/net/proxy/sync_host_resolver_bridge.h b/net/proxy/sync_host_resolver_bridge.h index 0e8e049..e39c6eed 100644 --- a/net/proxy/sync_host_resolver_bridge.h +++ b/net/proxy/sync_host_resolver_bridge.h @@ -15,7 +15,7 @@ namespace net { // Wrapper around HostResolver to give a sync API while running the resolver // in async mode on |host_resolver_loop|. -class SyncHostResolverBridge : public HostResolver { +class NET_TEST SyncHostResolverBridge : public HostResolver { public: SyncHostResolverBridge(HostResolver* host_resolver, MessageLoop* host_resolver_loop); |