summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/profile.cc12
-rw-r--r--net/build/net.vcproj68
-rw-r--r--net/build/net_unittests.vcproj12
-rw-r--r--net/http/http_cache.cc5
-rw-r--r--net/http/http_cache.h6
-rw-r--r--net/http/http_network_layer.cc14
-rw-r--r--net/http/http_network_layer.h6
-rw-r--r--net/http/http_network_session.h10
-rw-r--r--net/http/http_network_transaction.h6
-rw-r--r--net/http/http_network_transaction_unittest.cc6
-rw-r--r--net/http/http_transaction_winhttp.cc14
-rw-r--r--net/http/http_transaction_winhttp.h14
-rw-r--r--net/proxy/proxy_resolver_fixed.cc (renamed from net/http/http_proxy_resolver_fixed.cc)10
-rw-r--r--net/proxy/proxy_resolver_fixed.h (renamed from net/http/http_proxy_resolver_fixed.h)22
-rw-r--r--net/proxy/proxy_resolver_winhttp.cc (renamed from net/http/http_proxy_resolver_winhttp.cc)20
-rw-r--r--net/proxy/proxy_resolver_winhttp.h (renamed from net/http/http_proxy_resolver_winhttp.h)24
-rw-r--r--net/proxy/proxy_service.cc (renamed from net/http/http_proxy_service.cc)119
-rw-r--r--net/proxy/proxy_service.h (renamed from net/http/http_proxy_service.h)92
-rw-r--r--net/proxy/proxy_service_unittest.cc (renamed from net/http/http_proxy_service_unittest.cc)106
-rw-r--r--webkit/glue/plugins/mozilla_extensions.cc10
20 files changed, 289 insertions, 287 deletions
diff --git a/chrome/browser/profile.cc b/chrome/browser/profile.cc
index 626389b..257bbed 100644
--- a/chrome/browser/profile.cc
+++ b/chrome/browser/profile.cc
@@ -61,7 +61,7 @@
#include "net/base/cookie_monster.h"
#include "net/base/cookie_policy.h"
#include "net/http/http_cache.h"
-#include "net/http/http_proxy_service.h"
+#include "net/proxy/proxy_service.h"
#include "net/url_request/url_request_context.h"
#include "webkit/glue/webkit_glue.h"
@@ -91,11 +91,11 @@ URLRequestContext* Profile::GetDefaultRequestContext() {
// Sets up proxy info if it was specified, otherwise returns NULL. The
// returned pointer MUST be deleted by the caller if non-NULL.
-static net::HttpProxyInfo* CreateProxyInfo(const CommandLine& command_line) {
- net::HttpProxyInfo* proxy_info = NULL;
+static net::ProxyInfo* CreateProxyInfo(const CommandLine& command_line) {
+ net::ProxyInfo* proxy_info = NULL;
if (command_line.HasSwitch(switches::kProxyServer)) {
- proxy_info = new net::HttpProxyInfo();
+ proxy_info = new net::ProxyInfo();
const std::wstring& proxy_server =
command_line.GetSwitchValue(switches::kProxyServer);
proxy_info->UseNamedProxy(proxy_server);
@@ -136,7 +136,7 @@ class ProfileImpl::RequestContext : public URLRequestContext,
CommandLine command_line;
- scoped_ptr<net::HttpProxyInfo> proxy_info(CreateProxyInfo(command_line));
+ scoped_ptr<net::ProxyInfo> proxy_info(CreateProxyInfo(command_line));
net::HttpCache* cache =
new net::HttpCache(proxy_info.get(), disk_cache_path, 0);
@@ -262,7 +262,7 @@ class OffTheRecordRequestContext : public URLRequestContext,
original_context_ = profile->GetRequestContext();
CommandLine command_line;
- scoped_ptr<net::HttpProxyInfo> proxy_info(CreateProxyInfo(command_line));
+ scoped_ptr<net::ProxyInfo> proxy_info(CreateProxyInfo(command_line));
http_transaction_factory_ = new net::HttpCache(NULL, 0);
cookie_store_ = new net::CookieMonster;
diff --git a/net/build/net.vcproj b/net/build/net.vcproj
index 4fe72e1..4a2064b 100644
--- a/net/build/net.vcproj
+++ b/net/build/net.vcproj
@@ -361,6 +361,14 @@
>
</File>
<File
+ RelativePath="..\base\platform_mime_util.h"
+ >
+ </File>
+ <File
+ RelativePath="..\base\platform_mime_util_win.cc"
+ >
+ </File>
+ <File
RelativePath=".\precompiled_net.cc"
>
<FileConfiguration
@@ -385,14 +393,6 @@
>
</File>
<File
- RelativePath="..\base\platform_mime_util.h"
- >
- </File>
- <File
- RelativePath="..\base\platform_mime_util_win.cc"
- >
- </File>
- <File
RelativePath="..\base\registry_controlled_domain.cc"
>
</File>
@@ -681,30 +681,6 @@
>
</File>
<File
- RelativePath="..\http\http_proxy_resolver_fixed.cc"
- >
- </File>
- <File
- RelativePath="..\http\http_proxy_resolver_fixed.h"
- >
- </File>
- <File
- RelativePath="..\http\http_proxy_resolver_winhttp.cc"
- >
- </File>
- <File
- RelativePath="..\http\http_proxy_resolver_winhttp.h"
- >
- </File>
- <File
- RelativePath="..\http\http_proxy_service.cc"
- >
- </File>
- <File
- RelativePath="..\http\http_proxy_service.h"
- >
- </File>
- <File
RelativePath="..\http\http_request_info.h"
>
</File>
@@ -897,6 +873,34 @@
>
</File>
</Filter>
+ <Filter
+ Name="proxy"
+ >
+ <File
+ RelativePath="..\proxy\proxy_resolver_fixed.cc"
+ >
+ </File>
+ <File
+ RelativePath="..\proxy\proxy_resolver_fixed.h"
+ >
+ </File>
+ <File
+ RelativePath="..\proxy\proxy_resolver_winhttp.cc"
+ >
+ </File>
+ <File
+ RelativePath="..\proxy\proxy_resolver_winhttp.h"
+ >
+ </File>
+ <File
+ RelativePath="..\proxy\proxy_service.cc"
+ >
+ </File>
+ <File
+ RelativePath="..\proxy\proxy_service.h"
+ >
+ </File>
+ </Filter>
</Files>
<Globals>
</Globals>
diff --git a/net/build/net_unittests.vcproj b/net/build/net_unittests.vcproj
index 3426bf0..1619e5c 100644
--- a/net/build/net_unittests.vcproj
+++ b/net/build/net_unittests.vcproj
@@ -243,10 +243,6 @@
>
</File>
<File
- RelativePath="..\http\http_proxy_service_unittest.cc"
- >
- </File>
- <File
RelativePath="..\http\http_response_headers_unittest.cc"
>
</File>
@@ -375,6 +371,14 @@
>
</File>
</Filter>
+ <Filter
+ Name="proxy"
+ >
+ <File
+ RelativePath="..\proxy\proxy_service_unittest.cc"
+ >
+ </File>
+ </Filter>
</Filter>
</Files>
<Globals>
diff --git a/net/http/http_cache.cc b/net/http/http_cache.cc
index 50e6de0..a1bee69 100644
--- a/net/http/http_cache.cc
+++ b/net/http/http_cache.cc
@@ -40,7 +40,6 @@
#include "net/base/net_errors.h"
#include "net/disk_cache/disk_cache.h"
#include "net/http/http_network_layer.h"
-#include "net/http/http_proxy_service.h"
#include "net/http/http_request_info.h"
#include "net/http/http_response_info.h"
#include "net/http/http_transaction.h"
@@ -940,7 +939,7 @@ void HttpCache::Transaction::OnCacheReadCompleted(int result) {
//-----------------------------------------------------------------------------
-HttpCache::HttpCache(const HttpProxyInfo* proxy_info,
+HttpCache::HttpCache(const ProxyInfo* proxy_info,
const std::wstring& cache_dir,
int cache_size)
: disk_cache_dir_(cache_dir),
@@ -951,7 +950,7 @@ HttpCache::HttpCache(const HttpProxyInfo* proxy_info,
cache_size_(cache_size) {
}
-HttpCache::HttpCache(const HttpProxyInfo* proxy_info, int cache_size)
+HttpCache::HttpCache(const ProxyInfo* proxy_info, int cache_size)
: mode_(NORMAL),
network_layer_(HttpNetworkLayer::CreateFactory(proxy_info)),
task_factory_(this),
diff --git a/net/http/http_cache.h b/net/http/http_cache.h
index 42fbfe0..5fee2e2 100644
--- a/net/http/http_cache.h
+++ b/net/http/http_cache.h
@@ -55,9 +55,9 @@ class Entry;
namespace net {
-class HttpProxyInfo;
class HttpRequestInfo;
class HttpResponseInfo;
+class ProxyInfo;
class HttpCache : public HttpTransactionFactory {
public:
@@ -78,7 +78,7 @@ class HttpCache : public HttpTransactionFactory {
// disk cache is initialized lazily (by CreateTransaction) in this case. If
// |cache_size| is zero, a default value will be calculated automatically.
// If the proxy information is null, then the system settings will be used.
- HttpCache(const HttpProxyInfo* proxy_info,
+ HttpCache(const ProxyInfo* proxy_info,
const std::wstring& cache_dir,
int cache_size);
@@ -86,7 +86,7 @@ class HttpCache : public HttpTransactionFactory {
// (by CreateTransaction) in this case. If |cache_size| is zero, a default
// value will be calculated automatically. If the proxy information is null,
// then the system settings will be used.
- HttpCache(const HttpProxyInfo* proxy_info, int cache_size);
+ HttpCache(const ProxyInfo* proxy_info, int cache_size);
// Initialize the cache from its component parts, which is useful for
// testing. The lifetime of the network_layer and disk_cache are managed by
diff --git a/net/http/http_network_layer.cc b/net/http/http_network_layer.cc
index 426b987..9e13f11 100644
--- a/net/http/http_network_layer.cc
+++ b/net/http/http_network_layer.cc
@@ -32,9 +32,9 @@
#include "net/base/client_socket_factory.h"
#include "net/http/http_network_session.h"
#include "net/http/http_network_transaction.h"
-#include "net/http/http_proxy_resolver_fixed.h"
-#include "net/http/http_proxy_resolver_winhttp.h"
#include "net/http/http_transaction_winhttp.h"
+#include "net/proxy/proxy_resolver_fixed.h"
+#include "net/proxy/proxy_resolver_winhttp.h"
namespace net {
@@ -45,7 +45,7 @@ bool HttpNetworkLayer::use_winhttp_ = true;
// static
HttpTransactionFactory* HttpNetworkLayer::CreateFactory(
- const HttpProxyInfo* pi) {
+ const ProxyInfo* pi) {
if (use_winhttp_)
return new HttpTransactionWinHttp::Factory(pi);
@@ -59,13 +59,13 @@ void HttpNetworkLayer::UseWinHttp(bool value) {
//-----------------------------------------------------------------------------
-HttpNetworkLayer::HttpNetworkLayer(const HttpProxyInfo* pi)
+HttpNetworkLayer::HttpNetworkLayer(const ProxyInfo* pi)
: suspended_(false) {
- HttpProxyResolver* proxy_resolver;
+ ProxyResolver* proxy_resolver;
if (pi) {
- proxy_resolver = new HttpProxyResolverFixed(*pi);
+ proxy_resolver = new ProxyResolverFixed(*pi);
} else {
- proxy_resolver = new HttpProxyResolverWinHttp();
+ proxy_resolver = new ProxyResolverWinHttp();
}
session_ = new HttpNetworkSession(proxy_resolver);
}
diff --git a/net/http/http_network_layer.h b/net/http/http_network_layer.h
index db7d0d9..2b89f79 100644
--- a/net/http/http_network_layer.h
+++ b/net/http/http_network_layer.h
@@ -36,16 +36,16 @@
namespace net {
class HttpNetworkSession;
-class HttpProxyInfo;
+class ProxyInfo;
class HttpNetworkLayer : public HttpTransactionFactory {
public:
- explicit HttpNetworkLayer(const HttpProxyInfo* pi);
+ explicit HttpNetworkLayer(const ProxyInfo* pi);
~HttpNetworkLayer();
// This function hides the details of how a network layer gets instantiated
// and allows other implementations to be substituted.
- static HttpTransactionFactory* CreateFactory(const HttpProxyInfo* pi);
+ static HttpTransactionFactory* CreateFactory(const ProxyInfo* pi);
// If value is true, then WinHTTP will be used.
static void UseWinHttp(bool value);
diff --git a/net/http/http_network_session.h b/net/http/http_network_session.h
index 58cbb2f..4c430cb 100644
--- a/net/http/http_network_session.h
+++ b/net/http/http_network_session.h
@@ -33,7 +33,7 @@
#include "base/ref_counted.h"
#include "net/base/auth_cache.h"
#include "net/base/client_socket_pool.h"
-#include "net/http/http_proxy_service.h"
+#include "net/proxy/proxy_service.h"
namespace net {
@@ -45,7 +45,7 @@ class HttpNetworkSession : public base::RefCounted<HttpNetworkSession> {
MAX_SOCKETS_PER_GROUP = 6
};
- HttpNetworkSession(HttpProxyResolver* proxy_resolver)
+ HttpNetworkSession(ProxyResolver* proxy_resolver)
: connection_pool_(new ClientSocketPool(MAX_SOCKETS_PER_GROUP)),
proxy_resolver_(proxy_resolver),
proxy_service_(proxy_resolver) {
@@ -53,13 +53,13 @@ class HttpNetworkSession : public base::RefCounted<HttpNetworkSession> {
AuthCache* auth_cache() { return &auth_cache_; }
ClientSocketPool* connection_pool() { return connection_pool_; }
- HttpProxyService* proxy_service() { return &proxy_service_; }
+ ProxyService* proxy_service() { return &proxy_service_; }
private:
AuthCache auth_cache_;
scoped_refptr<ClientSocketPool> connection_pool_;
- scoped_ptr<HttpProxyResolver> proxy_resolver_;
- HttpProxyService proxy_service_;
+ scoped_ptr<ProxyResolver> proxy_resolver_;
+ ProxyService proxy_service_;
};
} // namespace net
diff --git a/net/http/http_network_transaction.h b/net/http/http_network_transaction.h
index 9948d79..79205b3 100644
--- a/net/http/http_network_transaction.h
+++ b/net/http/http_network_transaction.h
@@ -36,9 +36,9 @@
#include "net/base/address_list.h"
#include "net/base/client_socket_handle.h"
#include "net/base/host_resolver.h"
-#include "net/http/http_proxy_service.h"
#include "net/http/http_response_info.h"
#include "net/http/http_transaction.h"
+#include "net/proxy/proxy_service.h"
namespace net {
@@ -112,8 +112,8 @@ class HttpNetworkTransaction : public HttpTransaction {
const HttpRequestInfo* request_;
HttpResponseInfo response_;
- HttpProxyService::PacRequest* pac_request_;
- HttpProxyInfo proxy_info_;
+ ProxyService::PacRequest* pac_request_;
+ ProxyInfo proxy_info_;
HostResolver resolver_;
AddressList addresses_;
diff --git a/net/http/http_network_transaction_unittest.cc b/net/http/http_network_transaction_unittest.cc
index 266c30e..600b508 100644
--- a/net/http/http_network_transaction_unittest.cc
+++ b/net/http/http_network_transaction_unittest.cc
@@ -171,14 +171,14 @@ class MockClientSocketFactory : public net::ClientSocketFactory {
MockClientSocketFactory mock_socket_factory;
-class NullProxyResolver : public net::HttpProxyResolver {
+class NullProxyResolver : public net::ProxyResolver {
public:
- virtual int GetProxyConfig(net::HttpProxyConfig* config) {
+ virtual int GetProxyConfig(net::ProxyConfig* config) {
return net::ERR_FAILED;
}
virtual int GetProxyForURL(const std::wstring& query_url,
const std::wstring& pac_url,
- net::HttpProxyInfo* results) {
+ net::ProxyInfo* results) {
return net::ERR_FAILED;
}
};
diff --git a/net/http/http_transaction_winhttp.cc b/net/http/http_transaction_winhttp.cc
index 0d7fda2..5c49fc7 100644
--- a/net/http/http_transaction_winhttp.cc
+++ b/net/http/http_transaction_winhttp.cc
@@ -46,9 +46,9 @@
#include "net/base/ssl_config_service.h"
#include "net/base/upload_data_stream.h"
#include "net/http/cert_status_cache.h"
-#include "net/http/http_proxy_resolver_winhttp.h"
#include "net/http/http_request_info.h"
#include "net/http/winhttp_request_throttle.h"
+#include "net/proxy/proxy_resolver_winhttp.h"
#pragma comment(lib, "winhttp.lib")
#pragma warning(disable: 4355)
@@ -221,7 +221,7 @@ class HttpTransactionWinHttp::Session
// The message loop of the thread where the session was created.
MessageLoop* message_loop() { return message_loop_; }
- HttpProxyService* proxy_service() { return proxy_service_.get(); }
+ ProxyService* proxy_service() { return proxy_service_.get(); }
// Gets the HTTP authentication cache for the session.
AuthCache* auth_cache() { return &auth_cache_; }
@@ -265,8 +265,8 @@ class HttpTransactionWinHttp::Session
HINTERNET internet_;
HINTERNET internet_no_tls_;
MessageLoop* message_loop_;
- scoped_ptr<HttpProxyService> proxy_service_;
- scoped_ptr<HttpProxyResolver> proxy_resolver_;
+ scoped_ptr<ProxyService> proxy_service_;
+ scoped_ptr<ProxyResolver> proxy_resolver_;
AuthCache auth_cache_;
// This event object is used when destroying a transaction. It is given
@@ -353,8 +353,8 @@ bool HttpTransactionWinHttp::Session::Init() {
if (!internet_)
return false;
- proxy_resolver_.reset(new HttpProxyResolverWinHttp());
- proxy_service_.reset(new HttpProxyService(proxy_resolver_.get()));
+ proxy_resolver_.reset(new ProxyResolverWinHttp());
+ proxy_service_.reset(new ProxyService(proxy_resolver_.get()));
ConfigureSSL();
@@ -789,7 +789,7 @@ void HttpTransactionWinHttp::Factory::Suspend(bool suspend) {
// Transaction ----------------------------------------------------------------
HttpTransactionWinHttp::HttpTransactionWinHttp(Session* session,
- const HttpProxyInfo* info)
+ const ProxyInfo* info)
: session_(session),
request_(NULL),
load_flags_(0),
diff --git a/net/http/http_transaction_winhttp.h b/net/http/http_transaction_winhttp.h
index bb8ec1f..3971e09 100644
--- a/net/http/http_transaction_winhttp.h
+++ b/net/http/http_transaction_winhttp.h
@@ -37,10 +37,10 @@
#include "base/ref_counted.h"
#include "net/base/completion_callback.h"
-#include "net/http/http_proxy_service.h"
#include "net/http/http_response_info.h"
#include "net/http/http_transaction.h"
#include "net/http/http_transaction_factory.h"
+#include "net/proxy/proxy_service.h"
namespace net {
@@ -54,10 +54,10 @@ class HttpTransactionWinHttp : public HttpTransaction {
class Factory : public HttpTransactionFactory {
public:
Factory() : session_(NULL), proxy_info_(NULL), is_suspended_(false) {}
- explicit Factory(const HttpProxyInfo* info)
+ explicit Factory(const ProxyInfo* info)
: session_(NULL), proxy_info_(NULL), is_suspended_(false) {
if (info) {
- proxy_info_.reset(new HttpProxyInfo());
+ proxy_info_.reset(new ProxyInfo());
proxy_info_->Use(*info);
}
}
@@ -70,7 +70,7 @@ class HttpTransactionWinHttp : public HttpTransaction {
private:
Session* session_;
- scoped_ptr<HttpProxyInfo> proxy_info_;
+ scoped_ptr<ProxyInfo> proxy_info_;
bool is_suspended_;
DISALLOW_EVIL_CONSTRUCTORS(Factory);
};
@@ -104,7 +104,7 @@ class HttpTransactionWinHttp : public HttpTransaction {
// Methods ------------------------------------------------------------------
- HttpTransactionWinHttp(Session* session, const HttpProxyInfo* info);
+ HttpTransactionWinHttp(Session* session, const ProxyInfo* info);
~HttpTransactionWinHttp();
void DoCallback(int rv);
@@ -163,8 +163,8 @@ class HttpTransactionWinHttp : public HttpTransaction {
// WinHttp (see bug 1063336).
int64 content_length_remaining_;
- HttpProxyInfo proxy_info_;
- HttpProxyService::PacRequest* pac_request_;
+ ProxyInfo proxy_info_;
+ ProxyService::PacRequest* pac_request_;
CompletionCallbackImpl<HttpTransactionWinHttp> proxy_callback_;
HttpResponseInfo response_;
diff --git a/net/http/http_proxy_resolver_fixed.cc b/net/proxy/proxy_resolver_fixed.cc
index dd2ac8d..412cd2d 100644
--- a/net/http/http_proxy_resolver_fixed.cc
+++ b/net/proxy/proxy_resolver_fixed.cc
@@ -27,20 +27,20 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#include "net/http/http_proxy_resolver_fixed.h"
+#include "net/proxy/proxy_resolver_fixed.h"
#include "net/base/net_errors.h"
namespace net {
-int HttpProxyResolverFixed::GetProxyConfig(HttpProxyConfig* config) {
+int ProxyResolverFixed::GetProxyConfig(ProxyConfig* config) {
config->proxy_server = pi_.proxy_server();
return OK;
}
-int HttpProxyResolverFixed::GetProxyForURL(const std::wstring& query_url,
- const std::wstring& pac_url,
- HttpProxyInfo* results) {
+int ProxyResolverFixed::GetProxyForURL(const std::wstring& query_url,
+ const std::wstring& pac_url,
+ ProxyInfo* results) {
NOTREACHED() << "Should not be asked to do proxy auto config";
return ERR_FAILED;
}
diff --git a/net/http/http_proxy_resolver_fixed.h b/net/proxy/proxy_resolver_fixed.h
index 93beb33..81283e7 100644
--- a/net/http/http_proxy_resolver_fixed.h
+++ b/net/proxy/proxy_resolver_fixed.h
@@ -27,28 +27,28 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#ifndef NET_HTTP_HTTP_PROXY_RESOLVER_FIXED_H_
-#define NET_HTTP_HTTP_PROXY_RESOLVER_FIXED_H_
+#ifndef NET_PROXY_PROXY_RESOLVER_FIXED_H_
+#define NET_PROXY_PROXY_RESOLVER_FIXED_H_
-#include "net/http/http_proxy_service.h"
+#include "net/proxy/proxy_service.h"
namespace net {
-// Implementation of HttpProxyResolver that returns a fixed result.
-class HttpProxyResolverFixed : public HttpProxyResolver {
+// Implementation of ProxyResolver that returns a fixed result.
+class ProxyResolverFixed : public ProxyResolver {
public:
- HttpProxyResolverFixed(const HttpProxyInfo& pi) { pi_.Use(pi); }
+ ProxyResolverFixed(const ProxyInfo& pi) { pi_.Use(pi); }
- // HttpProxyResolver methods:
- virtual int GetProxyConfig(HttpProxyConfig* config);
+ // ProxyResolver methods:
+ virtual int GetProxyConfig(ProxyConfig* config);
virtual int GetProxyForURL(const std::wstring& query_url,
const std::wstring& pac_url,
- HttpProxyInfo* results);
+ ProxyInfo* results);
private:
- HttpProxyInfo pi_;
+ ProxyInfo pi_;
};
} // namespace net
-#endif // NET_HTTP_HTTP_PROXY_RESOLVER_FIXED_H_
+#endif // NET_PROXY_PROXY_RESOLVER_FIXED_H_
diff --git a/net/http/http_proxy_resolver_winhttp.cc b/net/proxy/proxy_resolver_winhttp.cc
index 2393245..aa1a296 100644
--- a/net/http/http_proxy_resolver_winhttp.cc
+++ b/net/proxy/proxy_resolver_winhttp.cc
@@ -27,7 +27,7 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#include "net/http/http_proxy_resolver_winhttp.h"
+#include "net/proxy/proxy_resolver_winhttp.h"
#include <windows.h>
#include <winhttp.h>
@@ -72,15 +72,15 @@ static void FreeInfo(WINHTTP_PROXY_INFO* info) {
GlobalFree(info->lpszProxyBypass);
}
-HttpProxyResolverWinHttp::HttpProxyResolverWinHttp()
+ProxyResolverWinHttp::ProxyResolverWinHttp()
: session_handle_(NULL) {
}
-HttpProxyResolverWinHttp::~HttpProxyResolverWinHttp() {
+ProxyResolverWinHttp::~ProxyResolverWinHttp() {
CloseWinHttpSession();
}
-int HttpProxyResolverWinHttp::GetProxyConfig(HttpProxyConfig* config) {
+int ProxyResolverWinHttp::GetProxyConfig(ProxyConfig* config) {
WINHTTP_CURRENT_USER_IE_PROXY_CONFIG ie_config = {0};
if (!WinHttpGetIEProxyConfigForCurrentUser(&ie_config)) {
LOG(ERROR) << "WinHttpGetIEProxyConfigForCurrentUser failed: " <<
@@ -101,9 +101,9 @@ int HttpProxyResolverWinHttp::GetProxyConfig(HttpProxyConfig* config) {
return OK;
}
-int HttpProxyResolverWinHttp::GetProxyForURL(const std::wstring& query_url,
- const std::wstring& pac_url,
- HttpProxyInfo* results) {
+int ProxyResolverWinHttp::GetProxyForURL(const std::wstring& query_url,
+ const std::wstring& pac_url,
+ ProxyInfo* results) {
// If we don't have a WinHTTP session, then create a new one.
if (!session_handle_ && !OpenWinHttpSession())
return ERR_FAILED;
@@ -155,7 +155,7 @@ int HttpProxyResolverWinHttp::GetProxyForURL(const std::wstring& query_url,
return rv;
}
-bool HttpProxyResolverWinHttp::OpenWinHttpSession() {
+bool ProxyResolverWinHttp::OpenWinHttpSession() {
DCHECK(!session_handle_);
session_handle_ = WinHttpOpen(NULL,
WINHTTP_ACCESS_TYPE_NO_PROXY,
@@ -165,7 +165,7 @@ bool HttpProxyResolverWinHttp::OpenWinHttpSession() {
if (!session_handle_)
return false;
- // Since this session handle will never be used for winhttp connections,
+ // Since this session handle will never be used for WinHTTP connections,
// these timeouts don't really mean much individually. However, WinHTTP's
// out of process PAC resolution will use a combined (sum of all timeouts)
// value to wait for an RPC reply.
@@ -175,7 +175,7 @@ bool HttpProxyResolverWinHttp::OpenWinHttpSession() {
return true;
}
-void HttpProxyResolverWinHttp::CloseWinHttpSession() {
+void ProxyResolverWinHttp::CloseWinHttpSession() {
if (session_handle_) {
WinHttpCloseHandle(session_handle_);
session_handle_ = NULL;
diff --git a/net/http/http_proxy_resolver_winhttp.h b/net/proxy/proxy_resolver_winhttp.h
index bea2bda..5d2a432 100644
--- a/net/http/http_proxy_resolver_winhttp.h
+++ b/net/proxy/proxy_resolver_winhttp.h
@@ -27,27 +27,27 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#ifndef NET_HTTP_HTTP_PROXY_RESOLVER_WINHTTP_H__
-#define NET_HTTP_HTTP_PROXY_RESOLVER_WINHTTP_H__
+#ifndef NET_PROXY_PROXY_RESOLVER_WINHTTP_H_
+#define NET_PROXY_PROXY_RESOLVER_WINHTTP_H_
-#include "net/http/http_proxy_service.h"
+#include "net/proxy/proxy_service.h"
typedef LPVOID HINTERNET; // From winhttp.h
namespace net {
-// An implementation of HttpProxyResolver that uses WinHTTP and the system
+// An implementation of ProxyResolver that uses WinHTTP and the system
// proxy settings.
-class HttpProxyResolverWinHttp : public HttpProxyResolver {
+class ProxyResolverWinHttp : public ProxyResolver {
public:
- HttpProxyResolverWinHttp();
- ~HttpProxyResolverWinHttp();
+ ProxyResolverWinHttp();
+ ~ProxyResolverWinHttp();
- // HttpProxyResolver implementation:
- virtual int GetProxyConfig(HttpProxyConfig* config);
+ // ProxyResolver implementation:
+ virtual int GetProxyConfig(ProxyConfig* config);
virtual int GetProxyForURL(const std::wstring& query_url,
const std::wstring& pac_url,
- HttpProxyInfo* results);
+ ProxyInfo* results);
private:
bool OpenWinHttpSession();
@@ -56,9 +56,9 @@ class HttpProxyResolverWinHttp : public HttpProxyResolver {
// Proxy configuration is cached on the session handle.
HINTERNET session_handle_;
- DISALLOW_EVIL_CONSTRUCTORS(HttpProxyResolverWinHttp);
+ DISALLOW_COPY_AND_ASSIGN(ProxyResolverWinHttp);
};
} // namespace net
-#endif // NET_HTTP_HTTP_PROXY_RESOLVER_WINHTTP_H__
+#endif // NET_PROXY_PROXY_RESOLVER_WINHTTP_H_
diff --git a/net/http/http_proxy_service.cc b/net/proxy/proxy_service.cc
index 148fa83a..6007909 100644
--- a/net/http/http_proxy_service.cc
+++ b/net/proxy/proxy_service.cc
@@ -27,7 +27,7 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#include "net/http/http_proxy_service.h"
+#include "net/proxy/proxy_service.h"
#include <windows.h>
#include <winhttp.h>
@@ -42,17 +42,17 @@
namespace net {
-// HttpProxyConfig ------------------------------------------------------------
+// ProxyConfig ----------------------------------------------------------------
// static
-HttpProxyConfig::ID HttpProxyConfig::last_id_ = HttpProxyConfig::INVALID_ID;
+ProxyConfig::ID ProxyConfig::last_id_ = ProxyConfig::INVALID_ID;
-HttpProxyConfig::HttpProxyConfig()
+ProxyConfig::ProxyConfig()
: auto_detect(false),
id_(++last_id_) {
}
-bool HttpProxyConfig::Equals(const HttpProxyConfig& other) const {
+bool ProxyConfig::Equals(const ProxyConfig& other) const {
// The two configs can have different IDs. We are just interested in if they
// have the same settings.
return auto_detect == other.auto_detect &&
@@ -61,8 +61,8 @@ bool HttpProxyConfig::Equals(const HttpProxyConfig& other) const {
proxy_bypass == other.proxy_bypass;
}
-// HttpProxyList --------------------------------------------------------------
-void HttpProxyList::SetVector(const std::vector<std::wstring>& proxies) {
+// ProxyList ------------------------------------------------------------------
+void ProxyList::SetVector(const std::vector<std::wstring>& proxies) {
proxies_.clear();
std::vector<std::wstring>::const_iterator iter = proxies.begin();
for (; iter != proxies.end(); ++iter) {
@@ -72,21 +72,20 @@ void HttpProxyList::SetVector(const std::vector<std::wstring>& proxies) {
}
}
-void HttpProxyList::Set(const std::wstring& proxy_list) {
+void ProxyList::Set(const std::wstring& proxy_list) {
// Extract the different proxies from the list.
std::vector<std::wstring> proxies;
SplitString(proxy_list, L';', &proxies);
SetVector(proxies);
}
-void HttpProxyList::RemoveBadProxies(const HttpProxyRetryInfoMap&
- http_proxy_retry_info) {
+void ProxyList::RemoveBadProxies(const ProxyRetryInfoMap& proxy_retry_info) {
std::vector<std::wstring> new_proxy_list;
std::vector<std::wstring>::const_iterator iter = proxies_.begin();
for (; iter != proxies_.end(); ++iter) {
- HttpProxyRetryInfoMap::const_iterator bad_proxy =
- http_proxy_retry_info.find(*iter);
- if (bad_proxy != http_proxy_retry_info.end()) {
+ ProxyRetryInfoMap::const_iterator bad_proxy =
+ proxy_retry_info.find(*iter);
+ if (bad_proxy != proxy_retry_info.end()) {
// This proxy is bad. Check if it's time to retry.
if (bad_proxy->second.bad_until >= TimeTicks::Now()) {
// still invalid.
@@ -99,14 +98,14 @@ void HttpProxyList::RemoveBadProxies(const HttpProxyRetryInfoMap&
proxies_ = new_proxy_list;
}
-std::wstring HttpProxyList::Get() const {
+std::wstring ProxyList::Get() const {
if (!proxies_.empty())
return proxies_[0];
return std::wstring();
}
-std::wstring HttpProxyList::GetList() const {
+std::wstring ProxyList::GetList() const {
std::wstring proxy_list;
std::vector<std::wstring>::const_iterator iter = proxies_.begin();
for (; iter != proxies_.end(); ++iter) {
@@ -119,7 +118,7 @@ std::wstring HttpProxyList::GetList() const {
return proxy_list;
}
-bool HttpProxyList::Fallback(HttpProxyRetryInfoMap* http_proxy_retry_info) {
+bool ProxyList::Fallback(ProxyRetryInfoMap* proxy_retry_info) {
// Number of minutes to wait before retrying a bad proxy server.
const TimeDelta kProxyRetryDelay = TimeDelta::FromMinutes(5);
@@ -129,17 +128,16 @@ bool HttpProxyList::Fallback(HttpProxyRetryInfoMap* http_proxy_retry_info) {
}
// Mark this proxy as bad.
- HttpProxyRetryInfoMap::iterator iter =
- http_proxy_retry_info->find(proxies_[0]);
- if (iter != http_proxy_retry_info->end()) {
+ ProxyRetryInfoMap::iterator iter = proxy_retry_info->find(proxies_[0]);
+ if (iter != proxy_retry_info->end()) {
// TODO(nsylvain): This is not the first time we get this. We should
// double the retry time. Bug 997660.
iter->second.bad_until = TimeTicks::Now() + iter->second.current_delay;
} else {
- HttpProxyRetryInfo retry_info;
+ ProxyRetryInfo retry_info;
retry_info.current_delay = kProxyRetryDelay;
retry_info.bad_until = TimeTicks().Now() + retry_info.current_delay;
- (*http_proxy_retry_info)[proxies_[0]] = retry_info;
+ (*proxy_retry_info)[proxies_[0]] = retry_info;
}
// Remove this proxy from our list.
@@ -148,26 +146,26 @@ bool HttpProxyList::Fallback(HttpProxyRetryInfoMap* http_proxy_retry_info) {
return !proxies_.empty();
}
-// HttpProxyInfo --------------------------------------------------------------
+// ProxyInfo ------------------------------------------------------------------
-HttpProxyInfo::HttpProxyInfo()
- : config_id_(HttpProxyConfig::INVALID_ID),
+ProxyInfo::ProxyInfo()
+ : config_id_(ProxyConfig::INVALID_ID),
config_was_tried_(false) {
}
-void HttpProxyInfo::Use(const HttpProxyInfo& other) {
+void ProxyInfo::Use(const ProxyInfo& other) {
proxy_list_ = other.proxy_list_;
}
-void HttpProxyInfo::UseDirect() {
+void ProxyInfo::UseDirect() {
proxy_list_.Set(std::wstring());
}
-void HttpProxyInfo::UseNamedProxy(const std::wstring& proxy_server) {
+void ProxyInfo::UseNamedProxy(const std::wstring& proxy_server) {
proxy_list_.Set(proxy_server);
}
-void HttpProxyInfo::Apply(HINTERNET request_handle) {
+void ProxyInfo::Apply(HINTERNET request_handle) {
WINHTTP_PROXY_INFO pi;
std::wstring proxy; // We need to declare this variable here because
// lpszProxy needs to be valid in WinHttpSetOption.
@@ -185,15 +183,15 @@ void HttpProxyInfo::Apply(HINTERNET request_handle) {
WinHttpSetOption(request_handle, WINHTTP_OPTION_PROXY, &pi, sizeof(pi));
}
-// HttpProxyService::PacRequest -----------------------------------------------
+// ProxyService::PacRequest ---------------------------------------------------
// We rely on the fact that the origin thread (and its message loop) will not
// be destroyed until after the PAC thread is destroyed.
-class HttpProxyService::PacRequest :
- public base::RefCountedThreadSafe<HttpProxyService::PacRequest> {
+class ProxyService::PacRequest :
+ public base::RefCountedThreadSafe<ProxyService::PacRequest> {
public:
- PacRequest(HttpProxyService* service,
+ PacRequest(ProxyService* service,
const std::wstring& pac_url,
CompletionCallback* callback)
: service_(service),
@@ -207,17 +205,14 @@ class HttpProxyService::PacRequest :
origin_loop_ = MessageLoop::current();
}
- void Query(const std::wstring& url, HttpProxyInfo* results) {
+ void Query(const std::wstring& url, ProxyInfo* results) {
results_ = results;
// If we have a valid callback then execute Query asynchronously
if (callback_) {
AddRef(); // balanced in QueryComplete
service_->pac_thread()->message_loop()->PostTask(FROM_HERE,
- NewRunnableMethod(this,
- &HttpProxyService::PacRequest::DoQuery,
- service_->resolver(),
- url,
- pac_url_));
+ NewRunnableMethod(this, &ProxyService::PacRequest::DoQuery,
+ service_->resolver(), url, pac_url_));
} else {
DoQuery(service_->resolver(), url, pac_url_);
}
@@ -233,7 +228,7 @@ class HttpProxyService::PacRequest :
private:
// Runs on the PAC thread if a valid callback is provided.
- void DoQuery(HttpProxyResolver* resolver,
+ void DoQuery(ProxyResolver* resolver,
const std::wstring& query_url,
const std::wstring& pac_url) {
int rv = resolver->GetProxyForURL(query_url, pac_url, &results_buf_);
@@ -253,7 +248,7 @@ class HttpProxyService::PacRequest :
if (result_code == OK && results_) {
results_->Use(results_buf_);
- results_->RemoveBadProxies(service_->http_proxy_retry_info_);
+ results_->RemoveBadProxies(service_->proxy_retry_info_);
}
if (callback_)
@@ -266,28 +261,28 @@ class HttpProxyService::PacRequest :
}
// Must only be used on the "origin" thread.
- HttpProxyService* service_;
+ ProxyService* service_;
CompletionCallback* callback_;
- HttpProxyInfo* results_;
- HttpProxyConfig::ID config_id_;
+ ProxyInfo* results_;
+ ProxyConfig::ID config_id_;
// Usable from within DoQuery on the PAC thread.
- HttpProxyInfo results_buf_;
+ ProxyInfo results_buf_;
std::wstring pac_url_;
MessageLoop* origin_loop_;
};
-// HttpProxyService -----------------------------------------------------------
+// ProxyService ---------------------------------------------------------------
-HttpProxyService::HttpProxyService(HttpProxyResolver* resolver)
+ProxyService::ProxyService(ProxyResolver* resolver)
: resolver_(resolver),
config_is_bad_(false) {
UpdateConfig();
}
-int HttpProxyService::ResolveProxy(const GURL& url, HttpProxyInfo* result,
- CompletionCallback* callback,
- PacRequest** pac_request) {
+int ProxyService::ResolveProxy(const GURL& url, ProxyInfo* result,
+ CompletionCallback* callback,
+ PacRequest** pac_request) {
// The overhead of calling WinHttpGetIEProxyConfigForCurrentUser is very low.
const TimeDelta kProxyConfigMaxAge = TimeDelta::FromSeconds(5);
@@ -299,7 +294,7 @@ int HttpProxyService::ResolveProxy(const GURL& url, HttpProxyInfo* result,
// Fallback to a "direct" (no proxy) connection if the current configuration
// is known to be bad.
if (config_is_bad_) {
- // Reset this flag to false in case the HttpProxyInfo object is being
+ // Reset this flag to false in case the ProxyInfo object is being
// re-used by the caller.
result->config_was_tried_ = false;
} else {
@@ -377,10 +372,10 @@ int HttpProxyService::ResolveProxy(const GURL& url, HttpProxyInfo* result,
return OK;
}
-int HttpProxyService::ReconsiderProxyAfterError(const GURL& url,
- HttpProxyInfo* result,
- CompletionCallback* callback,
- PacRequest** pac_request) {
+int ProxyService::ReconsiderProxyAfterError(const GURL& url,
+ ProxyInfo* result,
+ CompletionCallback* callback,
+ PacRequest** pac_request) {
// Check to see if we have a new config since ResolveProxy was called. We
// want to re-run ResolveProxy in two cases: 1) we have a new config, or 2) a
// direct connection failed and we never tried the current config.
@@ -402,14 +397,14 @@ int HttpProxyService::ReconsiderProxyAfterError(const GURL& url,
if (re_resolve) {
// If we have a new config or the config was never tried, we delete the
// list of bad proxies and we try again.
- http_proxy_retry_info_.clear();
+ proxy_retry_info_.clear();
return ResolveProxy(url, result, callback, pac_request);
}
// We don't have new proxy settings to try, fallback to the next proxy
// in the list.
bool was_direct = result->is_direct();
- if (!was_direct && result->Fallback(&http_proxy_retry_info_))
+ if (!was_direct && result->Fallback(&proxy_retry_info_))
return OK;
if (!config_.auto_detect && !config_.proxy_server.empty()) {
@@ -427,11 +422,11 @@ int HttpProxyService::ReconsiderProxyAfterError(const GURL& url,
return OK;
}
-void HttpProxyService::CancelPacRequest(PacRequest* pac_request) {
+void ProxyService::CancelPacRequest(PacRequest* pac_request) {
pac_request->Cancel();
}
-void HttpProxyService::DidCompletePacRequest(int config_id, int result_code) {
+void ProxyService::DidCompletePacRequest(int config_id, int result_code) {
// If we get an error that indicates a bad PAC config, then we should
// remember that, and not try the PAC config again for a while.
@@ -443,8 +438,8 @@ void HttpProxyService::DidCompletePacRequest(int config_id, int result_code) {
config_is_bad_ = true;
}
-void HttpProxyService::UpdateConfig() {
- HttpProxyConfig latest;
+void ProxyService::UpdateConfig() {
+ ProxyConfig latest;
if (resolver_->GetProxyConfig(&latest) != OK)
return;
config_last_update_time_ = TimeTicks::Now();
@@ -456,10 +451,10 @@ void HttpProxyService::UpdateConfig() {
config_is_bad_ = false;
// We have a new config, we should clear the list of bad proxies.
- http_proxy_retry_info_.clear();
+ proxy_retry_info_.clear();
}
-bool HttpProxyService::ShouldBypassProxyForURL(const GURL& url) {
+bool ProxyService::ShouldBypassProxyForURL(const GURL& url) {
std::wstring url_domain = ASCIIToWide(url.scheme());
if (!url_domain.empty())
url_domain += L"://";
diff --git a/net/http/http_proxy_service.h b/net/proxy/proxy_service.h
index 6e87505..c52926e 100644
--- a/net/http/http_proxy_service.h
+++ b/net/proxy/proxy_service.h
@@ -27,8 +27,8 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#ifndef NET_HTTP_HTTP_PROXY_SERVICE_H__
-#define NET_HTTP_HTTP_PROXY_SERVICE_H__
+#ifndef NET_PROXY_PROXY_SERVICE_H_
+#define NET_PROXY_PROXY_SERVICE_H_
#include <map>
#include <vector>
@@ -46,18 +46,18 @@ class GURL;
namespace net {
-class HttpProxyInfo;
-class HttpProxyResolver;
+class ProxyInfo;
+class ProxyResolver;
-// Proxy configuration used to by the HttpProxyService.
-class HttpProxyConfig {
+// Proxy configuration used to by the ProxyService.
+class ProxyConfig {
public:
typedef int ID;
// Indicates an invalid proxy config.
enum { INVALID_ID = 0 };
- HttpProxyConfig();
+ ProxyConfig();
// Default copy-constructor an assignment operator are OK!
// Used to numerically identify this configuration.
@@ -78,7 +78,7 @@ class HttpProxyConfig {
std::wstring proxy_bypass;
// Returns true if the given config is equivalent to this config.
- bool Equals(const HttpProxyConfig& other) const;
+ bool Equals(const ProxyConfig& other) const;
private:
static int last_id_;
@@ -86,7 +86,7 @@ class HttpProxyConfig {
};
// Contains the information about when to retry a proxy server.
-struct HttpProxyRetryInfo {
+struct ProxyRetryInfo {
// We should not retry until this time.
TimeTicks bad_until;
@@ -96,16 +96,16 @@ struct HttpProxyRetryInfo {
};
// Map of proxy servers with the associated RetryInfo structures.
-typedef std::map<std::wstring, HttpProxyRetryInfo> HttpProxyRetryInfoMap;
+typedef std::map<std::wstring, ProxyRetryInfo> ProxyRetryInfoMap;
// This class can be used to resolve the proxy server to use when loading a
-// HTTP(S) URL. It uses to the given HttpProxyResolver to handle the actual
-// proxy resolution. See HttpProxyResolverWinHttp for example. The consumer
-// of this class is responsible for ensuring that the HttpProxyResolver
-// instance remains valid for the lifetime of the HttpProxyService.
-class HttpProxyService {
+// HTTP(S) URL. It uses to the given ProxyResolver to handle the actual proxy
+// resolution. See ProxyResolverWinHttp for example. The consumer of this
+// class is responsible for ensuring that the ProxyResolver instance remains
+// valid for the lifetime of the ProxyService.
+class ProxyService {
public:
- explicit HttpProxyService(HttpProxyResolver* resolver);
+ explicit ProxyService(ProxyResolver* resolver);
// Used internally to handle PAC queries.
class PacRequest;
@@ -128,7 +128,7 @@ class HttpProxyService {
// 3. WPAD auto-detection
//
int ResolveProxy(const GURL& url,
- HttpProxyInfo* results,
+ ProxyInfo* results,
CompletionCallback* callback,
PacRequest** pac_request);
@@ -141,7 +141,7 @@ class HttpProxyService {
// Returns ERR_FAILED if there is not another proxy config to try.
//
int ReconsiderProxyAfterError(const GURL& url,
- HttpProxyInfo* results,
+ ProxyInfo* results,
CompletionCallback* callback,
PacRequest** pac_request);
@@ -151,11 +151,11 @@ class HttpProxyService {
private:
friend class PacRequest;
- HttpProxyResolver* resolver() { return resolver_; }
+ ProxyResolver* resolver() { return resolver_; }
Thread* pac_thread() { return pac_thread_.get(); }
// Identifies the proxy configuration.
- HttpProxyConfig::ID config_id() const { return config_.id(); }
+ ProxyConfig::ID config_id() const { return config_.id(); }
// Checks to see if the proxy configuration changed, and then updates config_
// to reference the new configuration.
@@ -173,12 +173,12 @@ class HttpProxyService {
// 2. The URL matches one of the entities in the proxy bypass list.
bool ShouldBypassProxyForURL(const GURL& url);
- HttpProxyResolver* resolver_;
+ ProxyResolver* resolver_;
scoped_ptr<Thread> pac_thread_;
// We store the IE proxy config and a counter that is incremented each time
// the config changes.
- HttpProxyConfig config_;
+ ProxyConfig config_;
// Indicates that the configuration is bad and should be ignored.
bool config_is_bad_;
@@ -187,15 +187,15 @@ class HttpProxyService {
TimeTicks config_last_update_time_;
// Map of the known bad proxies and the information about the retry time.
- HttpProxyRetryInfoMap http_proxy_retry_info_;
+ ProxyRetryInfoMap proxy_retry_info_;
- DISALLOW_EVIL_CONSTRUCTORS(HttpProxyService);
+ DISALLOW_COPY_AND_ASSIGN(ProxyService);
};
// 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 HttpProxyList {
+class ProxyList {
public:
// Initializes the proxy list to a string containing one or more proxy servers
// delimited by a semicolon.
@@ -206,7 +206,7 @@ class HttpProxyList {
void SetVector(const std::vector<std::wstring>& proxy_list);
// Remove all proxies known to be bad from the proxy list.
- void RemoveBadProxies(const HttpProxyRetryInfoMap& http_proxy_retry_info);
+ void RemoveBadProxies(const ProxyRetryInfoMap& proxy_retry_info);
// Returns the first valid proxy server in the list.
std::wstring Get() const;
@@ -214,10 +214,10 @@ class HttpProxyList {
// Returns all the valid proxies, delimited by a semicolon.
std::wstring GetList() const;
- // Marks the current proxy server as bad and deletes it from the list.
- // The list of known bad proxies is given by http_proxy_retry_info.
- // Returns true if there is another server available in the list.
- bool Fallback(HttpProxyRetryInfoMap* http_proxy_retry_info);
+ // Marks the current proxy server as bad and deletes it from the list. The
+ // list of known bad proxies is given by proxy_retry_info. Returns true if
+ // there is another server available in the list.
+ bool Fallback(ProxyRetryInfoMap* proxy_retry_info);
private:
// List of proxies.
@@ -225,12 +225,12 @@ class HttpProxyList {
};
// This object holds proxy information returned by ResolveProxy.
-class HttpProxyInfo {
+class ProxyInfo {
public:
- HttpProxyInfo();
+ ProxyInfo();
// Use the same proxy server as the given |proxy_info|.
- void Use(const HttpProxyInfo& proxy_info);
+ void Use(const ProxyInfo& proxy_info);
// Use a direct connection.
void UseDirect();
@@ -252,23 +252,23 @@ class HttpProxyInfo {
// Marks the current proxy as bad. Returns true if there is another proxy
// available to try in proxy list_.
- bool Fallback(HttpProxyRetryInfoMap* http_proxy_retry_info) {
- return proxy_list_.Fallback(http_proxy_retry_info);
+ bool Fallback(ProxyRetryInfoMap* proxy_retry_info) {
+ return proxy_list_.Fallback(proxy_retry_info);
}
// Remove all proxies known to be bad from the proxy list.
- void RemoveBadProxies(const HttpProxyRetryInfoMap& http_proxy_retry_info) {
- proxy_list_.RemoveBadProxies(http_proxy_retry_info);
+ void RemoveBadProxies(const ProxyRetryInfoMap& proxy_retry_info) {
+ proxy_list_.RemoveBadProxies(proxy_retry_info);
}
private:
- friend class HttpProxyService;
+ friend class ProxyService;
// If proxy_list_ is set to empty, then a "direct" connection is indicated.
- HttpProxyList proxy_list_;
+ ProxyList proxy_list_;
// This value identifies the proxy config used to initialize this object.
- HttpProxyConfig::ID config_id_;
+ ProxyConfig::ID config_id_;
// This flag is false when the proxy configuration was known to be bad when
// this proxy info was initialized. In such cases, we know that if this
@@ -276,28 +276,28 @@ class HttpProxyInfo {
// the proxy config given by config_id_.
bool config_was_tried_;
- DISALLOW_EVIL_CONSTRUCTORS(HttpProxyInfo);
+ DISALLOW_COPY_AND_ASSIGN(ProxyInfo);
};
// This interface provides the low-level functions to access the proxy
// configuration and resolve proxies for given URLs synchronously.
-class HttpProxyResolver {
+class ProxyResolver {
public:
- virtual ~HttpProxyResolver() {}
+ virtual ~ProxyResolver() {}
// Get the proxy configuration. Returns OK if successful or an error code if
// otherwise. |config| should be in its initial state when this method is
// called.
- virtual int GetProxyConfig(HttpProxyConfig* config) = 0;
+ virtual int GetProxyConfig(ProxyConfig* config) = 0;
// Query the proxy auto-config file (specified by |pac_url|) for the proxy to
// use to load the given |query_url|. Returns OK if successful or an error
// code if otherwise.
virtual int GetProxyForURL(const std::wstring& query_url,
const std::wstring& pac_url,
- HttpProxyInfo* results) = 0;
+ ProxyInfo* results) = 0;
};
} // namespace net
-#endif // NET_HTTP_HTTP_PROXY_SERVICE_H__
+#endif // NET_PROXY_PROXY_SERVICE_H_
diff --git a/net/http/http_proxy_service_unittest.cc b/net/proxy/proxy_service_unittest.cc
index 10e3c74..f4b9292 100644
--- a/net/http/http_proxy_service_unittest.cc
+++ b/net/proxy/proxy_service_unittest.cc
@@ -29,23 +29,23 @@
#include "googleurl/src/gurl.h"
#include "net/base/net_errors.h"
-#include "net/http/http_proxy_service.h"
+#include "net/proxy/proxy_service.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace {
-class MockProxyResolver : public net::HttpProxyResolver {
+class MockProxyResolver : public net::ProxyResolver {
public:
MockProxyResolver() : fail_get_proxy_for_url(false) {
- config.reset(new net::HttpProxyConfig);
+ config.reset(new net::ProxyConfig);
}
- virtual int GetProxyConfig(net::HttpProxyConfig* results) {
+ virtual int GetProxyConfig(net::ProxyConfig* results) {
*results = *(config.get());
return net::OK;
}
virtual int GetProxyForURL(const std::wstring& query_url,
const std::wstring& pac_url,
- net::HttpProxyInfo* results) {
+ net::ProxyInfo* results) {
if (pac_url != config->pac_url)
return net::ERR_INVALID_ARGUMENT;
if (fail_get_proxy_for_url)
@@ -57,8 +57,8 @@ class MockProxyResolver : public net::HttpProxyResolver {
}
return net::OK;
}
- scoped_ptr<net::HttpProxyConfig> config;
- net::HttpProxyInfo info;
+ scoped_ptr<net::ProxyConfig> config;
+ net::ProxyInfo info;
// info is only returned if query_url in GetProxyForURL matches this:
std::string info_predicate_query_host;
@@ -70,46 +70,46 @@ class MockProxyResolver : public net::HttpProxyResolver {
} // namespace
-TEST(HttpProxyServiceTest, Direct) {
+TEST(ProxyServiceTest, Direct) {
MockProxyResolver resolver;
- net::HttpProxyService service(&resolver);
+ net::ProxyService service(&resolver);
GURL url("http://www.google.com/");
- net::HttpProxyInfo info;
+ net::ProxyInfo info;
int rv = service.ResolveProxy(url, &info, NULL, NULL);
EXPECT_EQ(rv, net::OK);
EXPECT_TRUE(info.is_direct());
}
-TEST(HttpProxyServiceTest, PAC) {
+TEST(ProxyServiceTest, PAC) {
MockProxyResolver resolver;
resolver.config->pac_url = L"http://foopy/proxy.pac";
resolver.info.UseNamedProxy(L"foopy");
resolver.info_predicate_query_host = "www.google.com";
- net::HttpProxyService service(&resolver);
+ net::ProxyService service(&resolver);
GURL url("http://www.google.com/");
- net::HttpProxyInfo info;
+ net::ProxyInfo info;
int rv = service.ResolveProxy(url, &info, NULL, NULL);
EXPECT_EQ(rv, net::OK);
EXPECT_FALSE(info.is_direct());
EXPECT_EQ(info.proxy_server(), L"foopy");
}
-TEST(HttpProxyServiceTest, PAC_FailoverToDirect) {
+TEST(ProxyServiceTest, PAC_FailoverToDirect) {
MockProxyResolver resolver;
resolver.config->pac_url = L"http://foopy/proxy.pac";
resolver.info.UseNamedProxy(L"foopy:8080");
resolver.info_predicate_query_host = "www.google.com";
- net::HttpProxyService service(&resolver);
+ net::ProxyService service(&resolver);
GURL url("http://www.google.com/");
- net::HttpProxyInfo info;
+ net::ProxyInfo info;
int rv = service.ResolveProxy(url, &info, NULL, NULL);
EXPECT_EQ(rv, net::OK);
EXPECT_FALSE(info.is_direct());
@@ -121,7 +121,7 @@ TEST(HttpProxyServiceTest, PAC_FailoverToDirect) {
EXPECT_TRUE(info.is_direct());
}
-TEST(HttpProxyServiceTest, PAC_FailsToDownload) {
+TEST(ProxyServiceTest, PAC_FailsToDownload) {
// Test what happens when we fail to download the PAC URL.
MockProxyResolver resolver;
@@ -130,10 +130,10 @@ TEST(HttpProxyServiceTest, PAC_FailsToDownload) {
resolver.info_predicate_query_host = "www.google.com";
resolver.fail_get_proxy_for_url = true;
- net::HttpProxyService service(&resolver);
+ net::ProxyService service(&resolver);
GURL url("http://www.google.com/");
- net::HttpProxyInfo info;
+ net::ProxyInfo info;
int rv = service.ResolveProxy(url, &info, NULL, NULL);
EXPECT_EQ(rv, net::OK);
EXPECT_TRUE(info.is_direct());
@@ -153,7 +153,7 @@ TEST(HttpProxyServiceTest, PAC_FailsToDownload) {
EXPECT_EQ(info.proxy_server(), L"foopy_valid:8080");
}
-TEST(HttpProxyServiceTest, ProxyFallback) {
+TEST(ProxyServiceTest, ProxyFallback) {
// Test what happens when we specify multiple proxy servers and some of them
// are bad.
@@ -163,12 +163,12 @@ TEST(HttpProxyServiceTest, ProxyFallback) {
resolver.info_predicate_query_host = "www.google.com";
resolver.fail_get_proxy_for_url = false;
- net::HttpProxyService service(&resolver);
+ net::ProxyService service(&resolver);
GURL url("http://www.google.com/");
// Get the proxy information.
- net::HttpProxyInfo info;
+ net::ProxyInfo info;
int rv = service.ResolveProxy(url, &info, NULL, NULL);
EXPECT_EQ(rv, net::OK);
EXPECT_FALSE(info.is_direct());
@@ -212,7 +212,7 @@ TEST(HttpProxyServiceTest, ProxyFallback) {
// TODO(nsylvain): Test that the proxy can be retried after the delay.
}
-TEST(HttpProxyServiceTest, ProxyFallback_NewSettings) {
+TEST(ProxyServiceTest, ProxyFallback_NewSettings) {
// Test proxy failover when new settings are available.
MockProxyResolver resolver;
@@ -221,12 +221,12 @@ TEST(HttpProxyServiceTest, ProxyFallback_NewSettings) {
resolver.info_predicate_query_host = "www.google.com";
resolver.fail_get_proxy_for_url = false;
- net::HttpProxyService service(&resolver);
+ net::ProxyService service(&resolver);
GURL url("http://www.google.com/");
// Get the proxy information.
- net::HttpProxyInfo info;
+ net::ProxyInfo info;
int rv = service.ResolveProxy(url, &info, NULL, NULL);
EXPECT_EQ(rv, net::OK);
EXPECT_FALSE(info.is_direct());
@@ -235,7 +235,7 @@ TEST(HttpProxyServiceTest, ProxyFallback_NewSettings) {
EXPECT_EQ(info.proxy_server(), L"foopy1:8080");
// Fake an error on the proxy, and also a new configuration on the proxy.
- resolver.config.reset(new net::HttpProxyConfig);
+ resolver.config.reset(new net::ProxyConfig);
resolver.config->pac_url = L"http://foopy-new/proxy.pac";
rv = service.ReconsiderProxyAfterError(url, &info, NULL, NULL);
@@ -250,7 +250,7 @@ TEST(HttpProxyServiceTest, ProxyFallback_NewSettings) {
EXPECT_EQ(info.proxy_server(), L"foopy2:9090");
// We simulate a new configuration.
- resolver.config.reset(new net::HttpProxyConfig);
+ resolver.config.reset(new net::ProxyConfig);
resolver.config->pac_url = L"http://foopy-new2/proxy.pac";
// We fake anothe error. It should go back to the first proxy.
@@ -259,7 +259,7 @@ TEST(HttpProxyServiceTest, ProxyFallback_NewSettings) {
EXPECT_EQ(info.proxy_server(), L"foopy1:8080");
}
-TEST(HttpProxyServiceTest, ProxyFallback_BadConfig) {
+TEST(ProxyServiceTest, ProxyFallback_BadConfig) {
// Test proxy failover when the configuration is bad.
MockProxyResolver resolver;
@@ -268,12 +268,12 @@ TEST(HttpProxyServiceTest, ProxyFallback_BadConfig) {
resolver.info_predicate_query_host = "www.google.com";
resolver.fail_get_proxy_for_url = false;
- net::HttpProxyService service(&resolver);
+ net::ProxyService service(&resolver);
GURL url("http://www.google.com/");
// Get the proxy information.
- net::HttpProxyInfo info;
+ net::ProxyInfo info;
int rv = service.ResolveProxy(url, &info, NULL, NULL);
EXPECT_EQ(rv, net::OK);
EXPECT_FALSE(info.is_direct());
@@ -290,7 +290,7 @@ TEST(HttpProxyServiceTest, ProxyFallback_BadConfig) {
EXPECT_EQ(info.proxy_server(), L"foopy2:9090");
// Fake a PAC failure.
- net::HttpProxyInfo info2;
+ net::ProxyInfo info2;
resolver.fail_get_proxy_for_url = true;
rv = service.ResolveProxy(url, &info2, NULL, NULL);
EXPECT_EQ(rv, net::OK);
@@ -304,7 +304,7 @@ TEST(HttpProxyServiceTest, ProxyFallback_BadConfig) {
// Try to resolve, it will still return "direct" because we have no reason
// to check the config since everything works.
- net::HttpProxyInfo info3;
+ net::ProxyInfo info3;
rv = service.ResolveProxy(url, &info3, NULL, NULL);
EXPECT_EQ(rv, net::OK);
EXPECT_TRUE(info3.is_direct());
@@ -320,7 +320,7 @@ TEST(HttpProxyServiceTest, ProxyFallback_BadConfig) {
EXPECT_EQ(info3.proxy_server(), L"foopy1:8080");
}
-TEST(HttpProxyServiceTest, ProxyBypassList) {
+TEST(ProxyServiceTest, ProxyBypassList) {
// Test what happens when a proxy bypass list is specified.
MockProxyResolver resolver;
@@ -328,81 +328,81 @@ TEST(HttpProxyServiceTest, ProxyBypassList) {
resolver.config->auto_detect = false;
resolver.config->proxy_bypass = L"<local>";
- net::HttpProxyService service(&resolver);
+ net::ProxyService service(&resolver);
GURL url("http://www.google.com/");
// Get the proxy information.
- net::HttpProxyInfo info;
+ net::ProxyInfo info;
int rv = service.ResolveProxy(url, &info, NULL, NULL);
EXPECT_EQ(rv, net::OK);
EXPECT_FALSE(info.is_direct());
- net::HttpProxyService service1(&resolver);
+ net::ProxyService service1(&resolver);
GURL test_url1("local");
- net::HttpProxyInfo info1;
+ net::ProxyInfo info1;
rv = service1.ResolveProxy(test_url1, &info1, NULL, NULL);
EXPECT_EQ(rv, net::OK);
EXPECT_TRUE(info1.is_direct());
resolver.config->proxy_bypass = L"<local>;*.org";
- net::HttpProxyService service2(&resolver);
+ net::ProxyService service2(&resolver);
GURL test_url2("http://www.webkit.org");
- net::HttpProxyInfo info2;
+ net::ProxyInfo info2;
rv = service2.ResolveProxy(test_url2, &info2, NULL, NULL);
EXPECT_EQ(rv, net::OK);
EXPECT_TRUE(info2.is_direct());
resolver.config->proxy_bypass = L"<local>;*.org;7*";
- net::HttpProxyService service3(&resolver);
+ net::ProxyService service3(&resolver);
GURL test_url3("http://74.125.19.147");
- net::HttpProxyInfo info3;
+ net::ProxyInfo info3;
rv = service3.ResolveProxy(test_url3, &info3, NULL, NULL);
EXPECT_EQ(rv, net::OK);
EXPECT_TRUE(info3.is_direct());
resolver.config->proxy_bypass = L"<local>;*.org;";
- net::HttpProxyService service4(&resolver);
+ net::ProxyService service4(&resolver);
GURL test_url4("http://www.msn.com");
- net::HttpProxyInfo info4;
+ net::ProxyInfo info4;
rv = service4.ResolveProxy(test_url4, &info4, NULL, NULL);
EXPECT_EQ(rv, net::OK);
EXPECT_FALSE(info4.is_direct());
}
-TEST(HttpProxyServiceTest, PerProtocolProxyTests) {
+TEST(ProxyServiceTest, PerProtocolProxyTests) {
MockProxyResolver resolver;
resolver.config->proxy_server = L"http=foopy1:8080;https=foopy2:8080";
resolver.config->auto_detect = false;
- net::HttpProxyService service1(&resolver);
+ net::ProxyService service1(&resolver);
GURL test_url1("http://www.msn.com");
- net::HttpProxyInfo info1;
+ net::ProxyInfo info1;
int rv = service1.ResolveProxy(test_url1, &info1, NULL, NULL);
EXPECT_EQ(rv, net::OK);
EXPECT_FALSE(info1.is_direct());
EXPECT_TRUE(info1.proxy_server() == L"foopy1:8080");
- net::HttpProxyService service2(&resolver);
+ net::ProxyService service2(&resolver);
GURL test_url2("ftp://ftp.google.com");
- net::HttpProxyInfo info2;
+ net::ProxyInfo info2;
rv = service2.ResolveProxy(test_url2, &info2, NULL, NULL);
EXPECT_EQ(rv, net::OK);
EXPECT_TRUE(info2.is_direct());
EXPECT_TRUE(info2.proxy_server() == L"");
- net::HttpProxyService service3(&resolver);
+ net::ProxyService service3(&resolver);
GURL test_url3("https://webbranch.techcu.com");
- net::HttpProxyInfo info3;
+ net::ProxyInfo info3;
rv = service3.ResolveProxy(test_url3, &info3, NULL, NULL);
EXPECT_EQ(rv, net::OK);
EXPECT_FALSE(info3.is_direct());
EXPECT_TRUE(info3.proxy_server() == L"foopy2:8080");
resolver.config->proxy_server = L"foopy1:8080";
- net::HttpProxyService service4(&resolver);
+ net::ProxyService service4(&resolver);
GURL test_url4("www.microsoft.com");
- net::HttpProxyInfo info4;
+ net::ProxyInfo info4;
rv = service4.ResolveProxy(test_url4, &info4, NULL, NULL);
EXPECT_EQ(rv, net::OK);
EXPECT_FALSE(info4.is_direct());
EXPECT_TRUE(info4.proxy_server() == L"foopy1:8080");
-} \ No newline at end of file
+}
diff --git a/webkit/glue/plugins/mozilla_extensions.cc b/webkit/glue/plugins/mozilla_extensions.cc
index efda1df..9b336c3 100644
--- a/webkit/glue/plugins/mozilla_extensions.cc
+++ b/webkit/glue/plugins/mozilla_extensions.cc
@@ -38,8 +38,8 @@
#include "base/string_util.h"
#include "googleurl/src/gurl.h"
#include "net/base/net_errors.h"
-#include "net/http/http_proxy_service.h"
-#include "net/http/http_proxy_resolver_winhttp.h"
+#include "net/proxy/proxy_service.h"
+#include "net/proxy/proxy_resolver_winhttp.h"
#include "third_party/npapi/bindings/npapi.h"
#include "webkit/glue/webkit_glue.h"
#include "webkit/glue/plugins/plugin_instance.h"
@@ -70,9 +70,9 @@ bool MozillaExtensionApi::FindProxyForUrl(const char* url,
return result;
}
- net::HttpProxyResolverWinHttp proxy_resolver;
- net::HttpProxyService proxy_service(&proxy_resolver);
- net::HttpProxyInfo proxy_info;
+ net::ProxyResolverWinHttp proxy_resolver;
+ net::ProxyService proxy_service(&proxy_resolver);
+ net::ProxyInfo proxy_info;
if (proxy_service.ResolveProxy(GURL(std::string(url)),
&proxy_info,