diff options
author | willchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-24 00:22:50 +0000 |
---|---|---|
committer | willchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-24 00:22:50 +0000 |
commit | 0651b818c7122d319954ff5bc30dff68ba8b9013 (patch) | |
tree | d18a681545594c17175a584b7d56a6ee9abd10b6 /net/http | |
parent | 26616172ccaeae9842d7e52b556bc49e16751455 (diff) | |
download | chromium_src-0651b818c7122d319954ff5bc30dff68ba8b9013.zip chromium_src-0651b818c7122d319954ff5bc30dff68ba8b9013.tar.gz chromium_src-0651b818c7122d319954ff5bc30dff68ba8b9013.tar.bz2 |
Refactor of NetworkDelegate.
* Renames HttpNetworkDelegate to NetworkDelegate, moves to net/base/network_delegate.h. NOTE: this is a layering violation. wtc/eroman/willchan have agreed to this exception because the other solutions are less palatable.
* Move the virtuals in NetworkDelegate to the private section. Use non-virtual public interface as the network stack's interface for notifying the delegate. Add sanity checking to the implmentation in NetworkDelegate. The private virtual interface is for consumers to receive notifications.
* Remove ExtensionIOEventRouter from ChromeURLRequestContext, it is only used by the ChromeNetworkDelegate. Pass it directly to the ChromeNetworkDelegate's constructor.
* Introduce a SystemNetworkDelegate. It does nothing right now.
BUG=67232
TEST=none
Review URL: http://codereview.chromium.org/6580002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@75822 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/http')
-rw-r--r-- | net/http/http_cache.cc | 4 | ||||
-rw-r--r-- | net/http/http_cache.h | 4 | ||||
-rw-r--r-- | net/http/http_network_delegate.h | 34 | ||||
-rw-r--r-- | net/http/http_network_layer.h | 2 | ||||
-rw-r--r-- | net/http/http_network_session.h | 8 | ||||
-rw-r--r-- | net/http/http_network_transaction.cc | 4 |
6 files changed, 11 insertions, 45 deletions
diff --git a/net/http/http_cache.cc b/net/http/http_cache.cc index a821a30..830fbaa 100644 --- a/net/http/http_cache.cc +++ b/net/http/http_cache.cc @@ -48,7 +48,7 @@ HttpNetworkSession* CreateNetworkSession( SSLHostInfoFactory* ssl_host_info_factory, SSLConfigService* ssl_config_service, HttpAuthHandlerFactory* http_auth_handler_factory, - HttpNetworkDelegate* network_delegate, + NetworkDelegate* network_delegate, NetLog* net_log) { HttpNetworkSession::Params params; params.host_resolver = host_resolver; @@ -316,7 +316,7 @@ HttpCache::HttpCache(HostResolver* host_resolver, ProxyService* proxy_service, SSLConfigService* ssl_config_service, HttpAuthHandlerFactory* http_auth_handler_factory, - HttpNetworkDelegate* network_delegate, + NetworkDelegate* network_delegate, NetLog* net_log, BackendFactory* backend_factory) : net_log_(net_log), diff --git a/net/http/http_cache.h b/net/http/http_cache.h index ba7a18e..b33689d 100644 --- a/net/http/http_cache.h +++ b/net/http/http_cache.h @@ -46,12 +46,12 @@ class DnsCertProvenanceChecker; class DnsRRResolver; class HostResolver; class HttpAuthHandlerFactory; -class HttpNetworkDelegate; class HttpNetworkSession; struct HttpRequestInfo; class HttpResponseInfo; class IOBuffer; class NetLog; +class NetworkDelegate; class ProxyService; class SSLConfigService; class ViewCacheHelper; @@ -124,7 +124,7 @@ class HttpCache : public HttpTransactionFactory, ProxyService* proxy_service, SSLConfigService* ssl_config_service, HttpAuthHandlerFactory* http_auth_handler_factory, - HttpNetworkDelegate* network_delegate, + NetworkDelegate* network_delegate, NetLog* net_log, BackendFactory* backend_factory); diff --git a/net/http/http_network_delegate.h b/net/http/http_network_delegate.h deleted file mode 100644 index a4b217a..0000000 --- a/net/http/http_network_delegate.h +++ /dev/null @@ -1,34 +0,0 @@ -// 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. - -#ifndef NET_HTTP_HTTP_NETWORK_DELEGATE_H_ -#define NET_HTTP_HTTP_NETWORK_DELEGATE_H_ -#pragma once - -namespace net { - -class HttpRequestHeaders; -class URLRequest; - -class HttpNetworkDelegate { - public: - virtual ~HttpNetworkDelegate() {} - - // Called before a request is sent. - virtual void OnBeforeURLRequest(URLRequest* request) = 0; - - // Called right before the HTTP headers are sent. Allows the delegate to - // read/write |headers| before they get sent out. - virtual void OnSendHttpRequest(HttpRequestHeaders* headers) = 0; - - // This corresponds to URLRequestDelegate::OnResponseStarted. - virtual void OnResponseStarted(URLRequest* request) = 0; - - // This corresponds to URLRequestDelegate::OnReadCompleted. - virtual void OnReadCompleted(URLRequest* request, int bytes_read) = 0; -}; - -} // namespace net - -#endif // NET_HTTP_HTTP_NETWORK_DELEGATE_H_ diff --git a/net/http/http_network_layer.h b/net/http/http_network_layer.h index da92761..db3d809 100644 --- a/net/http/http_network_layer.h +++ b/net/http/http_network_layer.h @@ -21,9 +21,9 @@ class DnsCertProvenanceChecker; class DnsRRResolver; class HostResolver; class HttpAuthHandlerFactory; -class HttpNetworkDelegate; class HttpNetworkSession; class NetLog; +class NetworkDelegate; class ProxyService; class SpdySessionPool; class SSLConfigService; diff --git a/net/http/http_network_session.h b/net/http/http_network_session.h index 5c8f705..9a4b85c 100644 --- a/net/http/http_network_session.h +++ b/net/http/http_network_session.h @@ -29,11 +29,11 @@ class DnsCertProvenanceChecker; class DnsRRResolver; class HostResolver; class HttpAuthHandlerFactory; -class HttpNetworkDelegate; class HttpNetworkSessionPeer; class HttpProxyClientSocketPool; class HttpResponseBodyDrainer; class NetLog; +class NetworkDelegate; class ProxyService; class SSLConfigService; class SSLHostInfoFactory; @@ -65,7 +65,7 @@ class HttpNetworkSession : public base::RefCounted<HttpNetworkSession>, SSLHostInfoFactory* ssl_host_info_factory; SSLConfigService* ssl_config_service; HttpAuthHandlerFactory* http_auth_handler_factory; - HttpNetworkDelegate* network_delegate; + NetworkDelegate* network_delegate; NetLog* net_log; }; @@ -117,7 +117,7 @@ class HttpNetworkSession : public base::RefCounted<HttpNetworkSession>, HttpAuthHandlerFactory* http_auth_handler_factory() { return http_auth_handler_factory_; } - HttpNetworkDelegate* network_delegate() { + NetworkDelegate* network_delegate() { return network_delegate_; } @@ -156,7 +156,7 @@ class HttpNetworkSession : public base::RefCounted<HttpNetworkSession>, ~HttpNetworkSession(); NetLog* const net_log_; - HttpNetworkDelegate* const network_delegate_; + NetworkDelegate* const network_delegate_; CertVerifier* const cert_verifier_; HttpAuthHandlerFactory* const http_auth_handler_factory_; diff --git a/net/http/http_network_transaction.cc b/net/http/http_network_transaction.cc index 98b9cd7..d3ed391 100644 --- a/net/http/http_network_transaction.cc +++ b/net/http/http_network_transaction.cc @@ -24,6 +24,7 @@ #include "net/base/load_flags.h" #include "net/base/net_errors.h" #include "net/base/net_util.h" +#include "net/base/network_delegate.h" #include "net/base/ssl_cert_request_info.h" #include "net/base/ssl_connection_status_flags.h" #include "net/base/upload_data_stream.h" @@ -33,7 +34,6 @@ #include "net/http/http_basic_stream.h" #include "net/http/http_chunked_decoder.h" #include "net/http/http_net_log_params.h" -#include "net/http/http_network_delegate.h" #include "net/http/http_network_session.h" #include "net/http/http_proxy_client_socket.h" #include "net/http/http_proxy_client_socket_pool.h" @@ -685,7 +685,7 @@ int HttpNetworkTransaction::DoSendRequest() { &request_headers_); if (session_->network_delegate()) - session_->network_delegate()->OnSendHttpRequest(&request_headers_); + session_->network_delegate()->NotifySendHttpRequest(&request_headers_); } headers_valid_ = false; |