summaryrefslogtreecommitdiffstats
path: root/chrome/browser/io_thread.cc
diff options
context:
space:
mode:
authorwillchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-02-24 00:22:50 +0000
committerwillchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-02-24 00:22:50 +0000
commit0651b818c7122d319954ff5bc30dff68ba8b9013 (patch)
treed18a681545594c17175a584b7d56a6ee9abd10b6 /chrome/browser/io_thread.cc
parent26616172ccaeae9842d7e52b556bc49e16751455 (diff)
downloadchromium_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 'chrome/browser/io_thread.cc')
-rw-r--r--chrome/browser/io_thread.cc20
1 files changed, 19 insertions, 1 deletions
diff --git a/chrome/browser/io_thread.cc b/chrome/browser/io_thread.cc
index e966707..139bf9e 100644
--- a/chrome/browser/io_thread.cc
+++ b/chrome/browser/io_thread.cc
@@ -37,6 +37,7 @@
#include "net/base/host_resolver_impl.h"
#include "net/base/mapped_host_resolver.h"
#include "net/base/net_util.h"
+#include "net/base/network_delegate.h"
#include "net/http/http_auth_filter.h"
#include "net/http/http_auth_handler_factory.h"
#include "net/http/http_network_layer.h"
@@ -178,6 +179,22 @@ class LoggingNetworkChangeObserver
DISALLOW_COPY_AND_ASSIGN(LoggingNetworkChangeObserver);
};
+class SystemNetworkDelegate : public net::NetworkDelegate {
+ public:
+ SystemNetworkDelegate() {}
+ ~SystemNetworkDelegate() {}
+
+ // NetworkDelegate methods:
+ // TODO(willchan): Implement these functions!
+ virtual void OnBeforeURLRequest(net::URLRequest* request) {}
+ virtual void OnSendHttpRequest(net::HttpRequestHeaders* headers) {}
+ virtual void OnResponseStarted(net::URLRequest* request) {}
+ virtual void OnReadCompleted(net::URLRequest* request, int bytes_read) {}
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(SystemNetworkDelegate);
+};
+
scoped_refptr<net::URLRequestContext>
ConstructProxyScriptFetcherContext(IOThread::Globals* globals,
net::NetLog* net_log) {
@@ -327,6 +344,7 @@ void IOThread::Init() {
network_change_observer_.reset(
new LoggingNetworkChangeObserver(net_log_));
+ globals_->system_network_delegate.reset(new SystemNetworkDelegate);
globals_->host_resolver.reset(
CreateGlobalHostResolver(net_log_));
globals_->cert_verifier.reset(new net::CertVerifier);
@@ -347,7 +365,7 @@ void IOThread::Init() {
session_params.http_auth_handler_factory =
globals_->http_auth_handler_factory.get();
// TODO(willchan): Enable for proxy script fetcher context.
- session_params.network_delegate = NULL;
+ session_params.network_delegate = globals_->system_network_delegate.get();
session_params.net_log = net_log_;
session_params.ssl_config_service = globals_->ssl_config_service;
scoped_refptr<net::HttpNetworkSession> network_session(