summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
authorshalev@chromium.org <shalev@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-08-24 01:06:58 +0000
committershalev@chromium.org <shalev@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-08-24 01:06:58 +0000
commit9f170464e1ab4f1f75802a391db76408bc8998f2 (patch)
tree50ecf1c9c893ab12c59ee653d57732572128b7ed /chrome/browser
parent3dc4019ef862889073cf16e875050a512e93aa3a (diff)
downloadchromium_src-9f170464e1ab4f1f75802a391db76408bc8998f2.zip
chromium_src-9f170464e1ab4f1f75802a391db76408bc8998f2.tar.gz
chromium_src-9f170464e1ab4f1f75802a391db76408bc8998f2.tar.bz2
Refactoring: ProtocolHandler::MaybeCreateJob and other functions take NetworkDelegate as argument
This change goes a long way to prepare for removing NetworkDelegate from URLRequestContext. TBR=sky@chromium.org, michaeln@chromium.org, benjhayden@chromium.org, brettw@chromium.org, ben@chromium.org, davemoore@chromium.org, zelidrag@chromium.org, mnissler@chromium.org, thestig@chromium.org, asargent@chromium.org, jhawkins@chromium.org, bulach@chromium.org BUG=crbug.com/142945 Review URL: https://chromiumcodereview.appspot.com/10855209 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@153133 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/android/android_protocol_adapter.cc7
-rw-r--r--chrome/browser/android/android_stream_reader_url_request_job.cc4
-rw-r--r--chrome/browser/android/android_stream_reader_url_request_job.h6
-rw-r--r--chrome/browser/automation/url_request_automation_job.cc11
-rw-r--r--chrome/browser/automation/url_request_automation_job.h5
-rw-r--r--chrome/browser/captive_portal/captive_portal_browsertest.cc18
-rw-r--r--chrome/browser/chromeos/gdata/gdata_protocol_handler.cc13
-rw-r--r--chrome/browser/chromeos/gdata/gdata_protocol_handler.h3
-rw-r--r--chrome/browser/chromeos/gview_request_interceptor.cc9
-rw-r--r--chrome/browser/chromeos/gview_request_interceptor.h9
-rw-r--r--chrome/browser/chromeos/gview_request_interceptor_unittest.cc10
-rw-r--r--chrome/browser/chromeos/login/registration_screen.cc8
-rw-r--r--chrome/browser/chromeos/login/registration_screen.h2
-rw-r--r--chrome/browser/component_updater/component_updater_interceptor.cc4
-rw-r--r--chrome/browser/component_updater/component_updater_interceptor.h4
-rw-r--r--chrome/browser/custom_handlers/protocol_handler_registry.cc22
-rw-r--r--chrome/browser/custom_handlers/protocol_handler_registry_unittest.cc3
-rw-r--r--chrome/browser/extensions/api/downloads/downloads_api_unittest.cc4
-rw-r--r--chrome/browser/extensions/autoupdate_interceptor.cc7
-rw-r--r--chrome/browser/extensions/autoupdate_interceptor.h4
-rw-r--r--chrome/browser/extensions/extension_protocols.cc47
-rw-r--r--chrome/browser/extensions/extension_resource_protocols.cc17
-rw-r--r--chrome/browser/extensions/user_script_listener_unittest.cc14
-rw-r--r--chrome/browser/net/about_protocol_handler.cc4
-rw-r--r--chrome/browser/net/about_protocol_handler.h3
-rw-r--r--chrome/browser/net/connect_interceptor.cc7
-rw-r--r--chrome/browser/net/connect_interceptor.h10
-rw-r--r--chrome/browser/net/url_request_mock_link_doctor_job.cc7
-rw-r--r--chrome/browser/net/url_request_mock_link_doctor_job.h3
-rw-r--r--chrome/browser/policy/device_management_service_browsertest.cc4
-rw-r--r--chrome/browser/printing/print_dialog_cloud_interative_uitest.cc23
-rw-r--r--chrome/browser/profiles/off_the_record_profile_io_data.cc10
-rw-r--r--chrome/browser/profiles/profile_impl_io_data.cc12
-rw-r--r--chrome/browser/ui/webui/chrome_url_data_manager_backend.cc21
34 files changed, 213 insertions, 122 deletions
diff --git a/chrome/browser/android/android_protocol_adapter.cc b/chrome/browser/android/android_protocol_adapter.cc
index 3229ee4..aea7092 100644
--- a/chrome/browser/android/android_protocol_adapter.cc
+++ b/chrome/browser/android/android_protocol_adapter.cc
@@ -74,7 +74,9 @@ static bool InitJNIBindings(JNIEnv* env) {
// static
net::URLRequestJob* AndroidProtocolAdapter::Factory(
- net::URLRequest* request, const std::string& scheme) {
+ net::URLRequest* request,
+ net::NetworkDelegate* network_delegate,
+ const std::string& scheme) {
DCHECK(scheme == chrome::kFileScheme ||
scheme == chrome::kContentScheme);
JNIEnv* env = AttachCurrentThread();
@@ -90,11 +92,12 @@ net::URLRequestJob* AndroidProtocolAdapter::Factory(
if (scheme == chrome::kFileScheme &&
!StartsWithASCII(url, assetPrefix, /*case_sensitive=*/ true) &&
!StartsWithASCII(url, resourcePrefix, /*case_sensitive=*/ true)) {
- return net::URLRequestFileJob::Factory(request, scheme);
+ return net::URLRequestFileJob::Factory(request, network_delegate, scheme);
}
return new AndroidStreamReaderURLRequestJob(
request,
+ network_delegate,
scoped_ptr<AndroidStreamReaderURLRequestJob::Delegate>(
new AndroidStreamReaderURLRequestJobDelegateImpl()));
}
diff --git a/chrome/browser/android/android_stream_reader_url_request_job.cc b/chrome/browser/android/android_stream_reader_url_request_job.cc
index 1c67b69..49c1d6b 100644
--- a/chrome/browser/android/android_stream_reader_url_request_job.cc
+++ b/chrome/browser/android/android_stream_reader_url_request_job.cc
@@ -12,7 +12,6 @@
#include "net/base/net_util.h"
#include "net/http/http_util.h"
#include "net/url_request/url_request.h"
-#include "net/url_request/url_request_context.h"
#include "net/url_request/url_request_error_job.h"
#include "net/url_request/url_request_file_job.h"
#include "net/url_request/url_request_job_manager.h"
@@ -41,8 +40,9 @@ const int kBufferSize = 4096;
AndroidStreamReaderURLRequestJob::AndroidStreamReaderURLRequestJob(
net::URLRequest* request,
+ net::NetworkDelegate* network_delegate,
scoped_ptr<Delegate> delegate)
- : URLRequestJob(request, request->context()->network_delegate()),
+ : URLRequestJob(request, network_delegate),
delegate_(delegate.Pass()) {
DCHECK(delegate_.get());
}
diff --git a/chrome/browser/android/android_stream_reader_url_request_job.h b/chrome/browser/android/android_stream_reader_url_request_job.h
index 9200701..06394f8 100644
--- a/chrome/browser/android/android_stream_reader_url_request_job.h
+++ b/chrome/browser/android/android_stream_reader_url_request_job.h
@@ -43,8 +43,10 @@ class AndroidStreamReaderURLRequestJob : public net::URLRequestJob {
virtual ~Delegate() {}
};
- explicit AndroidStreamReaderURLRequestJob(net::URLRequest* request,
- scoped_ptr<Delegate> delegate);
+ explicit AndroidStreamReaderURLRequestJob(
+ net::URLRequest* request,
+ net::NetworkDelegate* network_delegate,
+ scoped_ptr<Delegate> delegate);
// Register JNI methods.
static bool InitJNIBindings(JNIEnv* env);
diff --git a/chrome/browser/automation/url_request_automation_job.cc b/chrome/browser/automation/url_request_automation_job.cc
index 8b41e57..f7cd433 100644
--- a/chrome/browser/automation/url_request_automation_job.cc
+++ b/chrome/browser/automation/url_request_automation_job.cc
@@ -52,11 +52,12 @@ net::URLRequest::ProtocolFactory* URLRequestAutomationJob::old_https_factory_
URLRequestAutomationJob::URLRequestAutomationJob(
net::URLRequest* request,
+ net::NetworkDelegate* network_delegate,
int tab,
int request_id,
AutomationResourceMessageFilter* filter,
bool is_pending)
- : net::URLRequestJob(request, request->context()->network_delegate()),
+ : net::URLRequestJob(request, network_delegate),
id_(0),
tab_(tab),
message_filter_(filter),
@@ -95,6 +96,7 @@ void URLRequestAutomationJob::EnsureProtocolFactoryRegistered() {
net::URLRequestJob* URLRequestAutomationJob::Factory(
net::URLRequest* request,
+ net::NetworkDelegate* network_delegate,
const std::string& scheme) {
bool scheme_is_http = request->url().SchemeIs("http");
bool scheme_is_https = request->url().SchemeIs("https");
@@ -108,7 +110,8 @@ net::URLRequestJob* URLRequestAutomationJob::Factory(
AutomationResourceMessageFilter::AutomationDetails details;
if (AutomationResourceMessageFilter::LookupRegisteredRenderView(
child_id, route_id, &details)) {
- URLRequestAutomationJob* job = new URLRequestAutomationJob(request,
+ URLRequestAutomationJob* job = new URLRequestAutomationJob(
+ request, network_delegate,
details.tab_handle, info->GetRequestID(), details.filter,
details.is_pending_render_view);
return job;
@@ -116,9 +119,9 @@ net::URLRequestJob* URLRequestAutomationJob::Factory(
}
if (scheme_is_http && old_http_factory_)
- return old_http_factory_(request, scheme);
+ return old_http_factory_(request, network_delegate, scheme);
else if (scheme_is_https && old_https_factory_)
- return old_https_factory_(request, scheme);
+ return old_https_factory_(request, network_delegate, scheme);
}
return NULL;
}
diff --git a/chrome/browser/automation/url_request_automation_job.h b/chrome/browser/automation/url_request_automation_job.h
index 6fedd07..ec7cce7 100644
--- a/chrome/browser/automation/url_request_automation_job.h
+++ b/chrome/browser/automation/url_request_automation_job.h
@@ -28,7 +28,10 @@ class Message;
// automation.
class URLRequestAutomationJob : public net::URLRequestJob {
public:
- URLRequestAutomationJob(net::URLRequest* request, int tab, int request_id,
+ URLRequestAutomationJob(net::URLRequest* request,
+ net::NetworkDelegate* network_delegate,
+ int tab,
+ int request_id,
AutomationResourceMessageFilter* filter,
bool is_pending);
diff --git a/chrome/browser/captive_portal/captive_portal_browsertest.cc b/chrome/browser/captive_portal/captive_portal_browsertest.cc
index 09b3460..3077621 100644
--- a/chrome/browser/captive_portal/captive_portal_browsertest.cc
+++ b/chrome/browser/captive_portal/captive_portal_browsertest.cc
@@ -134,7 +134,8 @@ class URLRequestTimeoutOnDemandJob : public net::URLRequestJob,
ABANDON_JOBS,
};
- explicit URLRequestTimeoutOnDemandJob(net::URLRequest* request);
+ URLRequestTimeoutOnDemandJob(net::URLRequest* request,
+ net::NetworkDelegate* network_delegate);
virtual ~URLRequestTimeoutOnDemandJob();
// Attempts to removes |this| from |jobs_|. Returns true if it was removed
@@ -226,8 +227,8 @@ void URLRequestTimeoutOnDemandJob::AbandonJobs(int expected_num_jobs) {
}
URLRequestTimeoutOnDemandJob::URLRequestTimeoutOnDemandJob(
- net::URLRequest* request)
- : net::URLRequestJob(request, request->context()->network_delegate()),
+ net::URLRequest* request, net::NetworkDelegate* network_delegate)
+ : net::URLRequestJob(request, network_delegate),
next_job_(NULL) {
}
@@ -343,6 +344,7 @@ class URLRequestMockCaptivePortalJobFactory {
// kMockHttpsQuickTimeoutUrl. See documentation of individual URLs for
// actual behavior.
static net::URLRequestJob* Factory(net::URLRequest* request,
+ net::NetworkDelegate* network_delegate,
const std::string& scheme);
static bool behind_captive_portal_;
@@ -398,6 +400,7 @@ void URLRequestMockCaptivePortalJobFactory::SetBehindCaptivePortalOnIOThread(
// static
net::URLRequestJob* URLRequestMockCaptivePortalJobFactory::Factory(
net::URLRequest* request,
+ net::NetworkDelegate* network_delegate,
const std::string& scheme) {
EXPECT_TRUE(BrowserThread::CurrentlyOn(BrowserThread::IO));
@@ -408,19 +411,22 @@ net::URLRequestJob* URLRequestMockCaptivePortalJobFactory::Factory(
if (request->url() == GURL(kMockHttpsUrl) ||
request->url() == GURL(kMockHttpsUrl2)) {
if (behind_captive_portal_)
- return new URLRequestTimeoutOnDemandJob(request);
+ return new URLRequestTimeoutOnDemandJob(request, network_delegate);
// Once logged in to the portal, HTTPS requests return the page that was
// actually requested.
return new URLRequestMockHTTPJob(
request,
+ network_delegate,
root_http.Append(FILE_PATH_LITERAL("title2.html")));
} else if (request->url() == GURL(kMockHttpsQuickTimeoutUrl)) {
if (behind_captive_portal_)
- return new URLRequestFailedJob(request, net::ERR_CONNECTION_TIMED_OUT);
+ return new URLRequestFailedJob(
+ request, network_delegate, net::ERR_CONNECTION_TIMED_OUT);
// Once logged in to the portal, HTTPS requests return the page that was
// actually requested.
return new URLRequestMockHTTPJob(
request,
+ network_delegate,
root_http.Append(FILE_PATH_LITERAL("title2.html")));
} else {
// The URL should be the captive portal test URL.
@@ -430,12 +436,14 @@ net::URLRequestJob* URLRequestMockCaptivePortalJobFactory::Factory(
// Prior to logging in to the portal, HTTP requests go to the login page.
return new URLRequestMockHTTPJob(
request,
+ network_delegate,
root_http.Append(FILE_PATH_LITERAL("captive_portal/login.html")));
}
// After logging in to the portal, the test URL returns a 204 response.
return new URLRequestMockHTTPJob(
request,
+ network_delegate,
root_http.Append(FILE_PATH_LITERAL("captive_portal/page204.html")));
}
}
diff --git a/chrome/browser/chromeos/gdata/gdata_protocol_handler.cc b/chrome/browser/chromeos/gdata/gdata_protocol_handler.cc
index c45ae80..079b111 100644
--- a/chrome/browser/chromeos/gdata/gdata_protocol_handler.cc
+++ b/chrome/browser/chromeos/gdata/gdata_protocol_handler.cc
@@ -34,7 +34,6 @@
#include "net/http/http_response_headers.h"
#include "net/http/http_response_info.h"
#include "net/url_request/url_request.h"
-#include "net/url_request/url_request_context.h"
#include "net/url_request/url_request_job.h"
using content::BrowserThread;
@@ -130,7 +129,8 @@ void CancelGDataDownloadOnUIThread(const FilePath& gdata_file_path) {
// formatted as drive://<resource-id>.
class GDataURLRequestJob : public net::URLRequestJob {
public:
- explicit GDataURLRequestJob(net::URLRequest* request);
+ GDataURLRequestJob(net::URLRequest* request,
+ net::NetworkDelegate* network_delegate);
// net::URLRequestJob overrides:
virtual void Start() OVERRIDE;
@@ -224,8 +224,9 @@ class GDataURLRequestJob : public net::URLRequestJob {
DISALLOW_COPY_AND_ASSIGN(GDataURLRequestJob);
};
-GDataURLRequestJob::GDataURLRequestJob(net::URLRequest* request)
- : net::URLRequestJob(request, request->context()->network_delegate()),
+GDataURLRequestJob::GDataURLRequestJob(net::URLRequest* request,
+ net::NetworkDelegate* network_delegate)
+ : net::URLRequestJob(request, network_delegate),
weak_ptr_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(
new base::WeakPtrFactory<GDataURLRequestJob>(this))),
file_system_(NULL),
@@ -934,9 +935,9 @@ GDataProtocolHandler::~GDataProtocolHandler() {
}
net::URLRequestJob* GDataProtocolHandler::MaybeCreateJob(
- net::URLRequest* request) const {
+ net::URLRequest* request, net::NetworkDelegate* network_delegate) const {
DVLOG(1) << "Handling url: " << request->url().spec();
- return new GDataURLRequestJob(request);
+ return new GDataURLRequestJob(request, network_delegate);
}
} // namespace gdata
diff --git a/chrome/browser/chromeos/gdata/gdata_protocol_handler.h b/chrome/browser/chromeos/gdata/gdata_protocol_handler.h
index 90b9bcd..5396716 100644
--- a/chrome/browser/chromeos/gdata/gdata_protocol_handler.h
+++ b/chrome/browser/chromeos/gdata/gdata_protocol_handler.h
@@ -15,7 +15,8 @@ class GDataProtocolHandler : public net::URLRequestJobFactory::ProtocolHandler {
virtual ~GDataProtocolHandler();
// Creates URLRequestJobs for drive:// URLs.
virtual net::URLRequestJob* MaybeCreateJob(
- net::URLRequest* request) const OVERRIDE;
+ net::URLRequest* request,
+ net::NetworkDelegate* network_delegate) const OVERRIDE;
};
} // namespace gdata
diff --git a/chrome/browser/chromeos/gview_request_interceptor.cc b/chrome/browser/chromeos/gview_request_interceptor.cc
index 67aa267..530e2a9 100644
--- a/chrome/browser/chromeos/gview_request_interceptor.cc
+++ b/chrome/browser/chromeos/gview_request_interceptor.cc
@@ -51,7 +51,7 @@ GViewRequestInterceptor::~GViewRequestInterceptor() {
}
net::URLRequestJob* GViewRequestInterceptor::MaybeIntercept(
- net::URLRequest* request) const {
+ net::URLRequest* request, net::NetworkDelegate* network_delegate) const {
// Don't attempt to intercept here as we want to wait until the mime
// type is fully determined.
return NULL;
@@ -59,7 +59,8 @@ net::URLRequestJob* GViewRequestInterceptor::MaybeIntercept(
net::URLRequestJob* GViewRequestInterceptor::MaybeInterceptRedirect(
const GURL& location,
- net::URLRequest* request) const {
+ net::URLRequest* request,
+ net::NetworkDelegate* network_delegate) const {
return NULL;
}
@@ -87,7 +88,7 @@ bool GViewRequestInterceptor::ShouldInterceptScheme(
}
net::URLRequestJob* GViewRequestInterceptor::MaybeInterceptResponse(
- net::URLRequest* request) const {
+ net::URLRequest* request, net::NetworkDelegate* network_delegate) const {
// Do not intercept this request if it is a download.
if (request->load_flags() & net::LOAD_IS_DOWNLOAD) {
return NULL;
@@ -112,7 +113,7 @@ net::URLRequestJob* GViewRequestInterceptor::MaybeInterceptResponse(
if (supported_mime_types_.count(mime_type) > 0) {
std::string url(kGViewUrlPrefix);
url += net::EscapePath(request->url().spec());
- return new net::URLRequestRedirectJob(request, GURL(url));
+ return new net::URLRequestRedirectJob(request, network_delegate, GURL(url));
}
return NULL;
}
diff --git a/chrome/browser/chromeos/gview_request_interceptor.h b/chrome/browser/chromeos/gview_request_interceptor.h
index 6b2ca83..41b7947 100644
--- a/chrome/browser/chromeos/gview_request_interceptor.h
+++ b/chrome/browser/chromeos/gview_request_interceptor.h
@@ -26,18 +26,21 @@ class GViewRequestInterceptor : public net::URLRequestJobFactory::Interceptor {
// Always returns NULL because we don't want to attempt a redirect
// before seeing the detected mime type of the request.
virtual net::URLRequestJob* MaybeIntercept(
- net::URLRequest* request) const OVERRIDE;
+ net::URLRequest* request,
+ net::NetworkDelegate* network_delegate) const OVERRIDE;
// Always returns NULL.
virtual net::URLRequestJob* MaybeInterceptRedirect(
const GURL& location,
- net::URLRequest* request) const OVERRIDE;
+ net::URLRequest* request,
+ net::NetworkDelegate* network_delegate) const OVERRIDE;
// Determines if the requested document can be viewed by the Google
// Document Viewer. If it can, returns a net::URLRequestJob that
// redirects the browser to the view URL.
virtual net::URLRequestJob* MaybeInterceptResponse(
- net::URLRequest* request) const OVERRIDE;
+ net::URLRequest* request,
+ net::NetworkDelegate* network_delegate) const OVERRIDE;
private:
bool ShouldUsePdfPlugin(net::URLRequest* request) const;
diff --git a/chrome/browser/chromeos/gview_request_interceptor_unittest.cc b/chrome/browser/chromeos/gview_request_interceptor_unittest.cc
index 76c0c0c..ca074a9 100644
--- a/chrome/browser/chromeos/gview_request_interceptor_unittest.cc
+++ b/chrome/browser/chromeos/gview_request_interceptor_unittest.cc
@@ -45,8 +45,9 @@ const char kPptUrlIntercepted[] =
class GViewURLRequestTestJob : public net::URLRequestTestJob {
public:
- explicit GViewURLRequestTestJob(net::URLRequest* request)
- : net::URLRequestTestJob(request, true) {
+ GViewURLRequestTestJob(net::URLRequest* request,
+ net::NetworkDelegate* network_delegate)
+ : net::URLRequestTestJob(request, network_delegate, true) {
}
virtual bool GetMimeType(std::string* mime_type) const {
@@ -79,8 +80,9 @@ class GViewRequestProtocolFactory
GViewRequestProtocolFactory() {}
virtual ~GViewRequestProtocolFactory() {}
- virtual net::URLRequestJob* MaybeCreateJob(net::URLRequest* request) const {
- return new GViewURLRequestTestJob(request);
+ virtual net::URLRequestJob* MaybeCreateJob(
+ net::URLRequest* request, net::NetworkDelegate* network_delegate) const {
+ return new GViewURLRequestTestJob(request, network_delegate);
}
};
diff --git a/chrome/browser/chromeos/login/registration_screen.cc b/chrome/browser/chromeos/login/registration_screen.cc
index 913aada..c156159 100644
--- a/chrome/browser/chromeos/login/registration_screen.cc
+++ b/chrome/browser/chromeos/login/registration_screen.cc
@@ -138,10 +138,12 @@ void RegistrationScreen::CloseScreen(ScreenObserver::ExitCodes code) {
}
// static
-net::URLRequestJob* RegistrationScreen::Factory(net::URLRequest* request,
- const std::string& scheme) {
+net::URLRequestJob* RegistrationScreen::Factory(
+ net::URLRequest* request,
+ net::NetworkDelegate* network_delegate,
+ const std::string& scheme) {
VLOG(1) << "Handling url: " << request->url().spec().c_str();
- return new net::URLRequestAboutJob(request);
+ return new net::URLRequestAboutJob(request, network_delegate);
}
} // namespace chromeos
diff --git a/chrome/browser/chromeos/login/registration_screen.h b/chrome/browser/chromeos/login/registration_screen.h
index 3ba1af2..31bde9b 100644
--- a/chrome/browser/chromeos/login/registration_screen.h
+++ b/chrome/browser/chromeos/login/registration_screen.h
@@ -18,6 +18,7 @@ class GURL;
class Profile;
namespace net {
+class NetworkDelegate;
class URLRequest;
class URLRequestJob;
} // namespace net
@@ -57,6 +58,7 @@ class RegistrationScreen : public ViewScreen<RegistrationView>,
// Handler factory for net::URLRequestFilter::AddHostnameHandler.
static net::URLRequestJob* Factory(net::URLRequest* request,
+ net::NetworkDelegate* network_delegate,
const std::string& scheme);
private:
diff --git a/chrome/browser/component_updater/component_updater_interceptor.cc b/chrome/browser/component_updater/component_updater_interceptor.cc
index afd7b0d..41d7eae 100644
--- a/chrome/browser/component_updater/component_updater_interceptor.cc
+++ b/chrome/browser/component_updater/component_updater_interceptor.cc
@@ -6,6 +6,7 @@
#include "base/file_util.h"
#include "base/threading/thread_restrictions.h"
#include "content/public/browser/browser_thread.h"
+#include "net/url_request/url_request.h"
#include "net/url_request/url_request_test_job.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -21,7 +22,7 @@ ComponentUpdateInterceptor::~ComponentUpdateInterceptor() {
}
net::URLRequestJob* ComponentUpdateInterceptor::MaybeIntercept(
- net::URLRequest* request) {
+ net::URLRequest* request, net::NetworkDelegate* network_delegate) {
EXPECT_TRUE(BrowserThread::CurrentlyOn(BrowserThread::IO));
if (request->url().scheme() != "http" ||
request->url().host() != "localhost") {
@@ -43,6 +44,7 @@ net::URLRequestJob* ComponentUpdateInterceptor::MaybeIntercept(
EXPECT_TRUE(file_util::ReadFileToString(response.data_path, &contents));
return new net::URLRequestTestJob(request,
+ network_delegate,
response.headers,
contents,
true);
diff --git a/chrome/browser/component_updater/component_updater_interceptor.h b/chrome/browser/component_updater/component_updater_interceptor.h
index 9f310a4..67b9199 100644
--- a/chrome/browser/component_updater/component_updater_interceptor.h
+++ b/chrome/browser/component_updater/component_updater_interceptor.h
@@ -37,7 +37,9 @@ class ComponentUpdateInterceptor
private:
// When computing matches, this ignores the query parameters of the url.
- virtual net::URLRequestJob* MaybeIntercept(net::URLRequest* request) OVERRIDE;
+ virtual net::URLRequestJob* MaybeIntercept(
+ net::URLRequest* request,
+ net::NetworkDelegate* network_delegate) OVERRIDE;
friend class base::RefCountedThreadSafe<ComponentUpdateInterceptor>;
diff --git a/chrome/browser/custom_handlers/protocol_handler_registry.cc b/chrome/browser/custom_handlers/protocol_handler_registry.cc
index 518be11..12ca2f2 100644
--- a/chrome/browser/custom_handlers/protocol_handler_registry.cc
+++ b/chrome/browser/custom_handlers/protocol_handler_registry.cc
@@ -90,7 +90,8 @@ class ProtocolHandlerRegistry::Core
// Creates a URL request job for the given request if there is a matching
// protocol handler, returns NULL otherwise.
- net::URLRequestJob* MaybeCreateJob(net::URLRequest* request) const;
+ net::URLRequestJob* MaybeCreateJob(
+ net::URLRequest* request, net::NetworkDelegate* network_delegate) const;
// Indicate that the registry has been enabled in the IO thread's
// copy of the data.
@@ -137,7 +138,7 @@ void ProtocolHandlerRegistry::Core::SetDefault(const ProtocolHandler& handler) {
// is registered and the associated handler is able to interpret
// the url from |request|.
net::URLRequestJob* ProtocolHandlerRegistry::Core::MaybeCreateJob(
- net::URLRequest* request) const {
+ net::URLRequest* request, net::NetworkDelegate* network_delegate) const {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
ProtocolHandler handler = LookupHandler(default_handlers_,
@@ -149,7 +150,8 @@ net::URLRequestJob* ProtocolHandlerRegistry::Core::MaybeCreateJob(
if (!translated_url.is_valid())
return NULL;
- return new net::URLRequestRedirectJob(request, translated_url);
+ return new net::URLRequestRedirectJob(
+ request, network_delegate, translated_url);
}
// URLInterceptor ------------------------------------------------------------
@@ -165,17 +167,21 @@ class ProtocolHandlerRegistry::URLInterceptor
virtual ~URLInterceptor();
virtual net::URLRequestJob* MaybeIntercept(
- net::URLRequest* request) const OVERRIDE;
+ net::URLRequest* request,
+ net::NetworkDelegate* network_delegate) const OVERRIDE;
virtual bool WillHandleProtocol(const std::string& protocol) const OVERRIDE;
virtual net::URLRequestJob* MaybeInterceptRedirect(
- const GURL& url, net::URLRequest* request) const OVERRIDE {
+ const GURL& url,
+ net::URLRequest* request,
+ net::NetworkDelegate* network_delegate) const OVERRIDE {
return NULL;
}
virtual net::URLRequestJob* MaybeInterceptResponse(
- net::URLRequest* request) const OVERRIDE {
+ net::URLRequest* request,
+ net::NetworkDelegate* network_delegate) const OVERRIDE {
return NULL;
}
@@ -193,10 +199,10 @@ ProtocolHandlerRegistry::URLInterceptor::~URLInterceptor() {
}
net::URLRequestJob* ProtocolHandlerRegistry::URLInterceptor::MaybeIntercept(
- net::URLRequest* request) const {
+ net::URLRequest* request, net::NetworkDelegate* network_delegate) const {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
- return core_->MaybeCreateJob(request);
+ return core_->MaybeCreateJob(request, network_delegate);
}
bool ProtocolHandlerRegistry::URLInterceptor::WillHandleProtocol(
diff --git a/chrome/browser/custom_handlers/protocol_handler_registry_unittest.cc b/chrome/browser/custom_handlers/protocol_handler_registry_unittest.cc
index 784e134..26a2fb4 100644
--- a/chrome/browser/custom_handlers/protocol_handler_registry_unittest.cc
+++ b/chrome/browser/custom_handlers/protocol_handler_registry_unittest.cc
@@ -34,7 +34,8 @@ void AssertInterceptedIO(
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
net::URLRequestContext context;
net::URLRequest request(url, NULL, &context);
- scoped_refptr<net::URLRequestJob> job = interceptor->MaybeIntercept(&request);
+ scoped_refptr<net::URLRequestJob> job = interceptor->MaybeIntercept(
+ &request, context.network_delegate());
ASSERT_TRUE(job.get() != NULL);
}
diff --git a/chrome/browser/extensions/api/downloads/downloads_api_unittest.cc b/chrome/browser/extensions/api/downloads/downloads_api_unittest.cc
index d4cd8d3..88be724 100644
--- a/chrome/browser/extensions/api/downloads/downloads_api_unittest.cc
+++ b/chrome/browser/extensions/api/downloads/downloads_api_unittest.cc
@@ -626,9 +626,11 @@ class TestProtocolHandler : public net::URLRequestJobFactory::ProtocolHandler {
virtual ~TestProtocolHandler() {}
virtual net::URLRequestJob* MaybeCreateJob(
- net::URLRequest* request) const OVERRIDE {
+ net::URLRequest* request,
+ net::NetworkDelegate* network_delegate) const OVERRIDE {
return new webkit_blob::BlobURLRequestJob(
request,
+ network_delegate,
blob_storage_controller_->GetBlobDataFromUrl(request->url()),
base::MessageLoopProxy::current());
}
diff --git a/chrome/browser/extensions/autoupdate_interceptor.cc b/chrome/browser/extensions/autoupdate_interceptor.cc
index 34e01b6..febc9cf 100644
--- a/chrome/browser/extensions/autoupdate_interceptor.cc
+++ b/chrome/browser/extensions/autoupdate_interceptor.cc
@@ -8,6 +8,7 @@
#include "base/file_util.h"
#include "base/threading/thread_restrictions.h"
#include "content/public/browser/browser_thread.h"
+#include "net/url_request/url_request.h"
#include "net/url_request/url_request_test_job.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -21,8 +22,10 @@ namespace extensions {
class AutoUpdateTestRequestJob : public net::URLRequestTestJob {
public:
AutoUpdateTestRequestJob(net::URLRequest* request,
+ net::NetworkDelegate* network_delegate,
const std::string& response_data)
: net::URLRequestTestJob(request,
+ network_delegate,
net::URLRequestTestJob::test_headers(),
response_data,
true) {
@@ -44,7 +47,7 @@ AutoUpdateInterceptor::~AutoUpdateInterceptor() {
}
net::URLRequestJob* AutoUpdateInterceptor::MaybeIntercept(
- net::URLRequest* request) {
+ net::URLRequest* request, net::NetworkDelegate* network_delegate) {
EXPECT_TRUE(BrowserThread::CurrentlyOn(BrowserThread::IO));
if (request->url().scheme() != "http" ||
request->url().host() != "localhost") {
@@ -69,7 +72,7 @@ net::URLRequestJob* AutoUpdateInterceptor::MaybeIntercept(
std::string contents;
EXPECT_TRUE(file_util::ReadFileToString(i->second, &contents));
- return new AutoUpdateTestRequestJob(request, contents);
+ return new AutoUpdateTestRequestJob(request, network_delegate, contents);
}
diff --git a/chrome/browser/extensions/autoupdate_interceptor.h b/chrome/browser/extensions/autoupdate_interceptor.h
index 36dd7c9..cfc06590 100644
--- a/chrome/browser/extensions/autoupdate_interceptor.h
+++ b/chrome/browser/extensions/autoupdate_interceptor.h
@@ -23,7 +23,9 @@ class AutoUpdateInterceptor
// When computing matches, this ignores query parameters (since the autoupdate
// fetch code appends a bunch of them to manifest fetches).
- virtual net::URLRequestJob* MaybeIntercept(net::URLRequest* request) OVERRIDE;
+ virtual net::URLRequestJob* MaybeIntercept(
+ net::URLRequest* request,
+ net::NetworkDelegate* network_delegate) OVERRIDE;
// When requests for |url| arrive, respond with the contents of |path|. The
// hostname of |url| must be "localhost" to avoid DNS lookups, and the scheme
diff --git a/chrome/browser/extensions/extension_protocols.cc b/chrome/browser/extensions/extension_protocols.cc
index 8dc1af8..70af6bf 100644
--- a/chrome/browser/extensions/extension_protocols.cc
+++ b/chrome/browser/extensions/extension_protocols.cc
@@ -31,7 +31,6 @@
#include "net/base/net_errors.h"
#include "net/http/http_response_headers.h"
#include "net/http/http_response_info.h"
-#include "net/url_request/url_request_context.h"
#include "net/url_request/url_request_error_job.h"
#include "net/url_request/url_request_file_job.h"
#include "net/url_request/url_request_simple_job.h"
@@ -69,10 +68,13 @@ void ReadMimeTypeFromFile(const FilePath& filename,
class URLRequestResourceBundleJob : public net::URLRequestSimpleJob {
public:
- URLRequestResourceBundleJob(
- net::URLRequest* request, const FilePath& filename, int resource_id,
- const std::string& content_security_policy, bool send_cors_header)
- : net::URLRequestSimpleJob(request),
+ URLRequestResourceBundleJob(net::URLRequest* request,
+ net::NetworkDelegate* network_delegate,
+ const FilePath& filename,
+ int resource_id,
+ const std::string& content_security_policy,
+ bool send_cors_header)
+ : net::URLRequestSimpleJob(request, network_delegate),
filename_(filename),
resource_id_(resource_id),
weak_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) {
@@ -146,9 +148,10 @@ class URLRequestResourceBundleJob : public net::URLRequestSimpleJob {
class GeneratedBackgroundPageJob : public net::URLRequestSimpleJob {
public:
GeneratedBackgroundPageJob(net::URLRequest* request,
+ net::NetworkDelegate* network_delegate,
const scoped_refptr<const Extension> extension,
const std::string& content_security_policy)
- : net::URLRequestSimpleJob(request),
+ : net::URLRequestSimpleJob(request, network_delegate),
extension_(extension) {
const bool send_cors_headers = false;
response_info_.headers = BuildHttpHeaders(content_security_policy,
@@ -192,13 +195,12 @@ void ReadResourceFilePath(const ExtensionResource& resource,
class URLRequestExtensionJob : public net::URLRequestFileJob {
public:
URLRequestExtensionJob(net::URLRequest* request,
+ net::NetworkDelegate* network_delegate,
const std::string& extension_id,
const FilePath& directory_path,
const std::string& content_security_policy,
bool send_cors_header)
- : net::URLRequestFileJob(request,
- FilePath(),
- request->context()->network_delegate()),
+ : net::URLRequestFileJob(request, network_delegate, FilePath()),
// TODO(tc): Move all of these files into resources.pak so we don't break
// when updating on Linux.
resource_(extension_id, directory_path,
@@ -306,7 +308,8 @@ class ExtensionProtocolHandler
virtual ~ExtensionProtocolHandler() {}
virtual net::URLRequestJob* MaybeCreateJob(
- net::URLRequest* request) const OVERRIDE;
+ net::URLRequest* request,
+ net::NetworkDelegate* network_delegate) const OVERRIDE;
private:
const bool is_incognito_;
@@ -316,11 +319,13 @@ class ExtensionProtocolHandler
// Creates URLRequestJobs for extension:// URLs.
net::URLRequestJob*
-ExtensionProtocolHandler::MaybeCreateJob(net::URLRequest* request) const {
+ExtensionProtocolHandler::MaybeCreateJob(
+ net::URLRequest* request, net::NetworkDelegate* network_delegate) const {
// TODO(mpcomplete): better error code.
if (!AllowExtensionResourceLoad(
request, is_incognito_, extension_info_map_)) {
- return new net::URLRequestErrorJob(request, net::ERR_ADDRESS_UNREACHABLE);
+ return new net::URLRequestErrorJob(
+ request, network_delegate, net::ERR_ADDRESS_UNREACHABLE);
}
// chrome-extension://extension-id/resource/path.js
@@ -357,7 +362,7 @@ ExtensionProtocolHandler::MaybeCreateJob(net::URLRequest* request) const {
if (path.size() > 1 &&
path.substr(1) == extension_filenames::kGeneratedBackgroundPageFilename) {
return new GeneratedBackgroundPageJob(
- request, extension, content_security_policy);
+ request, network_delegate, extension, content_security_policy);
}
FilePath resources_path;
@@ -382,15 +387,23 @@ ExtensionProtocolHandler::MaybeCreateJob(net::URLRequest* request) const {
FilePath().AppendASCII(kComponentExtensionResources[i].name);
bm_resource_path = bm_resource_path.NormalizePathSeparators();
if (relative_path == bm_resource_path) {
- return new URLRequestResourceBundleJob(request, relative_path,
- kComponentExtensionResources[i].value, content_security_policy,
+ return new URLRequestResourceBundleJob(
+ request,
+ network_delegate,
+ relative_path,
+ kComponentExtensionResources[i].value,
+ content_security_policy,
send_cors_header);
}
}
}
- return new URLRequestExtensionJob(request, extension_id, directory_path,
- content_security_policy, send_cors_header);
+ return new URLRequestExtensionJob(request,
+ network_delegate,
+ extension_id,
+ directory_path,
+ content_security_policy,
+ send_cors_header);
}
} // namespace
diff --git a/chrome/browser/extensions/extension_resource_protocols.cc b/chrome/browser/extensions/extension_resource_protocols.cc
index 91a9b02..cb3d2cc 100644
--- a/chrome/browser/extensions/extension_resource_protocols.cc
+++ b/chrome/browser/extensions/extension_resource_protocols.cc
@@ -9,18 +9,16 @@
#include "chrome/common/chrome_paths.h"
#include "chrome/common/extensions/extension_file_util.h"
#include "content/public/browser/browser_thread.h"
-#include "net/url_request/url_request_context.h"
#include "net/url_request/url_request_file_job.h"
namespace {
class ExtensionResourcesJob : public net::URLRequestFileJob {
public:
- explicit ExtensionResourcesJob(net::URLRequest* request)
- : net::URLRequestFileJob(request,
- FilePath(),
- request->context()->network_delegate()),
- thread_id_(content::BrowserThread::UI) {
+ ExtensionResourcesJob(net::URLRequest* request,
+ net::NetworkDelegate* network_delegate)
+ : net::URLRequestFileJob(request, network_delegate, FilePath()),
+ thread_id_(content::BrowserThread::UI) {
}
virtual void Start() OVERRIDE;
@@ -65,7 +63,8 @@ class ExtensionResourceProtocolHandler
virtual ~ExtensionResourceProtocolHandler() {}
virtual net::URLRequestJob* MaybeCreateJob(
- net::URLRequest* request) const OVERRIDE;
+ net::URLRequest* request,
+ net::NetworkDelegate* network_delegate) const OVERRIDE;
private:
DISALLOW_COPY_AND_ASSIGN(ExtensionResourceProtocolHandler);
@@ -74,8 +73,8 @@ class ExtensionResourceProtocolHandler
// Creates URLRequestJobs for chrome-extension-resource:// URLs.
net::URLRequestJob*
ExtensionResourceProtocolHandler::MaybeCreateJob(
- net::URLRequest* request) const {
- return new ExtensionResourcesJob(request);
+ net::URLRequest* request, net::NetworkDelegate* network_delegate) const {
+ return new ExtensionResourcesJob(request, network_delegate);
}
} // namespace
diff --git a/chrome/browser/extensions/user_script_listener_unittest.cc b/chrome/browser/extensions/user_script_listener_unittest.cc
index 93d7c0b..42d2011 100644
--- a/chrome/browser/extensions/user_script_listener_unittest.cc
+++ b/chrome/browser/extensions/user_script_listener_unittest.cc
@@ -58,8 +58,13 @@ class ThrottleController : public base::SupportsUserData::Data,
// whether it starts and finishes.
class SimpleTestJob : public net::URLRequestTestJob {
public:
- explicit SimpleTestJob(net::URLRequest* request)
- : net::URLRequestTestJob(request, test_headers(), kTestData, true) {}
+ SimpleTestJob(net::URLRequest* request,
+ net::NetworkDelegate* network_delegate)
+ : net::URLRequestTestJob(request,
+ network_delegate,
+ test_headers(),
+ kTestData,
+ true) {}
private:
~SimpleTestJob() {}
};
@@ -116,8 +121,9 @@ class UserScriptListenerTest
}
// net::URLRequest::Interceptor
- virtual net::URLRequestJob* MaybeIntercept(net::URLRequest* request) {
- return new SimpleTestJob(request);
+ virtual net::URLRequestJob* MaybeIntercept(
+ net::URLRequest* request, net::NetworkDelegate* network_delegate) {
+ return new SimpleTestJob(request, network_delegate);
}
protected:
diff --git a/chrome/browser/net/about_protocol_handler.cc b/chrome/browser/net/about_protocol_handler.cc
index 9eea3d5..20a8f1f 100644
--- a/chrome/browser/net/about_protocol_handler.cc
+++ b/chrome/browser/net/about_protocol_handler.cc
@@ -12,9 +12,9 @@ AboutProtocolHandler::AboutProtocolHandler() {
}
URLRequestJob* AboutProtocolHandler::MaybeCreateJob(
- URLRequest* request) const {
+ URLRequest* request, NetworkDelegate* network_delegate) const {
DCHECK(false);
- return new URLRequestAboutJob(request);
+ return new URLRequestAboutJob(request, network_delegate);
}
} // namespace net
diff --git a/chrome/browser/net/about_protocol_handler.h b/chrome/browser/net/about_protocol_handler.h
index 6e1c5da..46bbe6f 100644
--- a/chrome/browser/net/about_protocol_handler.h
+++ b/chrome/browser/net/about_protocol_handler.h
@@ -17,7 +17,8 @@ class URLRequestJob;
class AboutProtocolHandler : public URLRequestJobFactory::ProtocolHandler {
public:
AboutProtocolHandler();
- virtual URLRequestJob* MaybeCreateJob(URLRequest* request) const OVERRIDE;
+ virtual URLRequestJob* MaybeCreateJob(
+ URLRequest* request, NetworkDelegate* network_delegate) const OVERRIDE;
private:
DISALLOW_COPY_AND_ASSIGN(AboutProtocolHandler);
diff --git a/chrome/browser/net/connect_interceptor.cc b/chrome/browser/net/connect_interceptor.cc
index 0ea6dbd..c1d6dea 100644
--- a/chrome/browser/net/connect_interceptor.cc
+++ b/chrome/browser/net/connect_interceptor.cc
@@ -28,7 +28,7 @@ ConnectInterceptor::~ConnectInterceptor() {
}
net::URLRequestJob* ConnectInterceptor::MaybeIntercept(
- net::URLRequest* request) const {
+ net::URLRequest* request, net::NetworkDelegate* network_delegate) const {
GURL request_scheme_host(Predictor::CanonicalizeUrl(request->url()));
if (request_scheme_host == GURL::EmptyGURL())
return NULL;
@@ -88,13 +88,14 @@ net::URLRequestJob* ConnectInterceptor::MaybeIntercept(
}
net::URLRequestJob* ConnectInterceptor::MaybeInterceptResponse(
- net::URLRequest* request) const {
+ net::URLRequest* request, net::NetworkDelegate* network_delegate) const {
return NULL;
}
net::URLRequestJob* ConnectInterceptor::MaybeInterceptRedirect(
const GURL& location,
- net::URLRequest* request) const {
+ net::URLRequest* request,
+ net::NetworkDelegate* network_delegate) const {
return NULL;
}
diff --git a/chrome/browser/net/connect_interceptor.h b/chrome/browser/net/connect_interceptor.h
index 5fb3da7..1cef9fe 100644
--- a/chrome/browser/net/connect_interceptor.h
+++ b/chrome/browser/net/connect_interceptor.h
@@ -28,11 +28,15 @@ class ConnectInterceptor : public net::URLRequestJobFactory::Interceptor {
// Overridden from net::URLRequest::Interceptor:
// Learn about referrers, and optionally preconnect based on history.
virtual net::URLRequestJob* MaybeIntercept(
- net::URLRequest* request) const OVERRIDE;
+ net::URLRequest* request,
+ net::NetworkDelegate* network_delegate) const OVERRIDE;
virtual net::URLRequestJob* MaybeInterceptResponse(
- net::URLRequest* request) const OVERRIDE;
+ net::URLRequest* request,
+ net::NetworkDelegate* network_delegate) const OVERRIDE;
virtual net::URLRequestJob* MaybeInterceptRedirect(
- const GURL& location, net::URLRequest* request) const OVERRIDE;
+ const GURL& location,
+ net::URLRequest* request,
+ net::NetworkDelegate* network_delegate) const OVERRIDE;
private:
// Provide access to local class TimedCache for testing.
diff --git a/chrome/browser/net/url_request_mock_link_doctor_job.cc b/chrome/browser/net/url_request_mock_link_doctor_job.cc
index fb6563e..d68122b 100644
--- a/chrome/browser/net/url_request_mock_link_doctor_job.cc
+++ b/chrome/browser/net/url_request_mock_link_doctor_job.cc
@@ -24,8 +24,9 @@ FilePath GetMockFilePath() {
// static
net::URLRequestJob* URLRequestMockLinkDoctorJob::Factory(
net::URLRequest* request,
+ net::NetworkDelegate* network_delegate,
const std::string& scheme) {
- return new URLRequestMockLinkDoctorJob(request);
+ return new URLRequestMockLinkDoctorJob(request, network_delegate);
}
// static
@@ -37,6 +38,6 @@ void URLRequestMockLinkDoctorJob::AddUrlHandler() {
}
URLRequestMockLinkDoctorJob::URLRequestMockLinkDoctorJob(
- net::URLRequest* request)
- : URLRequestMockHTTPJob(request, GetMockFilePath()) {
+ net::URLRequest* request, net::NetworkDelegate* network_delegate)
+ : URLRequestMockHTTPJob(request, network_delegate, GetMockFilePath()) {
}
diff --git a/chrome/browser/net/url_request_mock_link_doctor_job.h b/chrome/browser/net/url_request_mock_link_doctor_job.h
index eba6c57..c559d06 100644
--- a/chrome/browser/net/url_request_mock_link_doctor_job.h
+++ b/chrome/browser/net/url_request_mock_link_doctor_job.h
@@ -11,7 +11,8 @@
class URLRequestMockLinkDoctorJob : public URLRequestMockHTTPJob {
public:
- explicit URLRequestMockLinkDoctorJob(net::URLRequest* request);
+ URLRequestMockLinkDoctorJob(net::URLRequest* request,
+ net::NetworkDelegate* network_delegate);
static net::URLRequest::ProtocolFactory Factory;
diff --git a/chrome/browser/policy/device_management_service_browsertest.cc b/chrome/browser/policy/device_management_service_browsertest.cc
index ff532ba..e01cc0a 100644
--- a/chrome/browser/policy/device_management_service_browsertest.cc
+++ b/chrome/browser/policy/device_management_service_browsertest.cc
@@ -42,7 +42,8 @@ class CannedResponseInterceptor : public net::URLRequest::Interceptor {
// net::URLRequest::Interceptor overrides.
virtual net::URLRequestJob* MaybeIntercept(
- net::URLRequest* request) OVERRIDE {
+ net::URLRequest* request,
+ net::NetworkDelegate* network_delegate) OVERRIDE {
em::DeviceManagementRequest dm_request;
net::UploadData* upload = request->get_upload_mutable();
if (request->url().GetOrigin() == service_url_.GetOrigin() &&
@@ -54,6 +55,7 @@ class CannedResponseInterceptor : public net::URLRequest::Interceptor {
upload->elements()->at(0).bytes_length(),
&response_data);
return new net::URLRequestTestJob(request,
+ network_delegate,
net::URLRequestTestJob::test_headers(),
response_data,
true);
diff --git a/chrome/browser/printing/print_dialog_cloud_interative_uitest.cc b/chrome/browser/printing/print_dialog_cloud_interative_uitest.cc
index cb71eaa..fabc49e 100644
--- a/chrome/browser/printing/print_dialog_cloud_interative_uitest.cc
+++ b/chrome/browser/printing/print_dialog_cloud_interative_uitest.cc
@@ -29,6 +29,7 @@
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/web_contents.h"
#include "content/public/test/test_browser_thread.h"
+#include "net/url_request/url_request.h"
#include "net/url_request/url_request_filter.h"
#include "net/url_request/url_request_test_job.h"
#include "net/url_request/url_request_test_util.h"
@@ -70,9 +71,13 @@ class TestData {
// whether it starts and finishes.
class SimpleTestJob : public net::URLRequestTestJob {
public:
- explicit SimpleTestJob(net::URLRequest* request)
- : net::URLRequestTestJob(request, test_headers(),
- TestData::GetInstance()->GetTestData(), true) {}
+ SimpleTestJob(net::URLRequest* request,
+ net::NetworkDelegate* network_delegate)
+ : net::URLRequestTestJob(request,
+ network_delegate,
+ test_headers(),
+ TestData::GetInstance()->GetTestData(),
+ true) {}
virtual void GetResponseInfo(net::HttpResponseInfo* info) {
net::URLRequestTestJob::GetResponseInfo(info);
@@ -220,18 +225,22 @@ class PrintDialogCloudTest : public InProcessBrowserTest {
AutoQuitDelegate delegate_;
};
-net::URLRequestJob* PrintDialogCloudTest::Factory(net::URLRequest* request,
- const std::string& scheme) {
+net::URLRequestJob* PrintDialogCloudTest::Factory(
+ net::URLRequest* request,
+ net::NetworkDelegate* network_delegate,
+ const std::string& scheme) {
if (request &&
(request->url() == TestController::GetInstance()->expected_url())) {
if (TestController::GetInstance()->use_delegate())
request->set_delegate(TestController::GetInstance()->delegate());
TestController::GetInstance()->set_result(true);
- return new SimpleTestJob(request);
+ return new SimpleTestJob(request, network_delegate);
}
return new net::URLRequestTestJob(request,
+ network_delegate,
net::URLRequestTestJob::test_headers(),
- "", true);
+ "",
+ true);
}
#if defined(OS_WIN)
diff --git a/chrome/browser/profiles/off_the_record_profile_io_data.cc b/chrome/browser/profiles/off_the_record_profile_io_data.cc
index eca2df4..2e0b896 100644
--- a/chrome/browser/profiles/off_the_record_profile_io_data.cc
+++ b/chrome/browser/profiles/off_the_record_profile_io_data.cc
@@ -256,14 +256,15 @@ void OffTheRecordProfileIOData::LazyInitializeInternal(
extensions_job_factory_.reset(new net::URLRequestJobFactory);
int set_protocol = main_job_factory_->SetProtocolHandler(
- chrome::kFileScheme, new net::FileProtocolHandler(network_delegate()));
+ chrome::kFileScheme, new net::FileProtocolHandler());
DCHECK(set_protocol);
- // TODO(shalev): Without a network_delegate this protocol handler will never
+ // TODO(shalev): The extension_job_factory_ has a NULL NetworkDelegate.
+ // Without a network_delegate, this protocol handler will never
// handle file: requests, but as a side effect it makes
// job_factory::IsHandledProtocol return true, which prevents attempts to
// handle the protocol externally.
set_protocol = extensions_job_factory_->SetProtocolHandler(
- chrome::kFileScheme, new net::FileProtocolHandler(NULL));
+ chrome::kFileScheme, new net::FileProtocolHandler());
DCHECK(set_protocol);
set_protocol = main_job_factory_->SetProtocolHandler(
@@ -359,8 +360,7 @@ void OffTheRecordProfileIOData::CreateFtpProtocolHandler(
net::FtpAuthCache* ftp_auth_cache) const {
job_factory->SetProtocolHandler(
chrome::kFtpScheme,
- new net::FtpProtocolHandler(
- network_delegate(), ftp_factory_.get(), ftp_auth_cache));
+ new net::FtpProtocolHandler(ftp_factory_.get(), ftp_auth_cache));
}
chrome_browser_net::LoadTimeStats* OffTheRecordProfileIOData::GetLoadTimeStats(
diff --git a/chrome/browser/profiles/profile_impl_io_data.cc b/chrome/browser/profiles/profile_impl_io_data.cc
index 60a349f..d2afc28 100644
--- a/chrome/browser/profiles/profile_impl_io_data.cc
+++ b/chrome/browser/profiles/profile_impl_io_data.cc
@@ -456,17 +456,18 @@ void ProfileImplIOData::LazyInitializeInternal(
extensions_job_factory_.reset(new net::URLRequestJobFactory);
int set_protocol = main_job_factory_->SetProtocolHandler(
- chrome::kFileScheme, new net::FileProtocolHandler(network_delegate()));
+ chrome::kFileScheme, new net::FileProtocolHandler());
DCHECK(set_protocol);
set_protocol = media_request_job_factory_->SetProtocolHandler(
- chrome::kFileScheme, new net::FileProtocolHandler(network_delegate()));
+ chrome::kFileScheme, new net::FileProtocolHandler());
DCHECK(set_protocol);
- // TODO(shalev): Without a network_delegate this protocol handler will never
+ // TODO(shalev): The extensions_job_factory has a NULL NetworkDelegate.
+ // Without a network_delegate, this protocol handler will never
// handle file: requests, but as a side effect it makes
// job_factory::IsHandledProtocol return true, which prevents attempts to
// handle the protocol externally.
set_protocol = extensions_job_factory_->SetProtocolHandler(
- chrome::kFileScheme, new net::FileProtocolHandler(NULL));
+ chrome::kFileScheme, new net::FileProtocolHandler());
DCHECK(set_protocol);
set_protocol = main_job_factory_->SetProtocolHandler(
@@ -662,8 +663,7 @@ void ProfileImplIOData::CreateFtpProtocolHandler(
net::FtpAuthCache* ftp_auth_cache) const {
job_factory->SetProtocolHandler(
chrome::kFtpScheme,
- new net::FtpProtocolHandler(network_delegate(),
- ftp_factory_.get(),
+ new net::FtpProtocolHandler(ftp_factory_.get(),
ftp_auth_cache));
}
diff --git a/chrome/browser/ui/webui/chrome_url_data_manager_backend.cc b/chrome/browser/ui/webui/chrome_url_data_manager_backend.cc
index b11da17..aa1a7e0 100644
--- a/chrome/browser/ui/webui/chrome_url_data_manager_backend.cc
+++ b/chrome/browser/ui/webui/chrome_url_data_manager_backend.cc
@@ -162,6 +162,7 @@ class URLRequestChromeJob : public net::URLRequestJob,
public base::SupportsWeakPtr<URLRequestChromeJob> {
public:
URLRequestChromeJob(net::URLRequest* request,
+ net::NetworkDelegate* network_delegate,
ChromeURLDataManagerBackend* backend);
// net::URLRequestJob implementation.
@@ -223,8 +224,9 @@ class URLRequestChromeJob : public net::URLRequestJob,
};
URLRequestChromeJob::URLRequestChromeJob(net::URLRequest* request,
+ net::NetworkDelegate* network_delegate,
ChromeURLDataManagerBackend* backend)
- : net::URLRequestJob(request, request->context()->network_delegate()),
+ : net::URLRequestJob(request, network_delegate),
data_offset_(0),
pending_buf_size_(0),
allow_caching_(true),
@@ -361,7 +363,8 @@ class ChromeProtocolHandler
~ChromeProtocolHandler();
virtual net::URLRequestJob* MaybeCreateJob(
- net::URLRequest* request) const OVERRIDE;
+ net::URLRequest* request,
+ net::NetworkDelegate* network_delegate) const OVERRIDE;
private:
// These members are owned by ProfileIOData, which owns this ProtocolHandler.
@@ -377,11 +380,11 @@ ChromeProtocolHandler::ChromeProtocolHandler(
ChromeProtocolHandler::~ChromeProtocolHandler() {}
net::URLRequestJob* ChromeProtocolHandler::MaybeCreateJob(
- net::URLRequest* request) const {
+ net::URLRequest* request, net::NetworkDelegate* network_delegate) const {
DCHECK(request);
// Fall back to using a custom handler
- return new URLRequestChromeJob(request, backend_);
+ return new URLRequestChromeJob(request, network_delegate, backend_);
}
} // namespace
@@ -573,7 +576,8 @@ class DevToolsJobFactory
virtual ~DevToolsJobFactory();
virtual net::URLRequestJob* MaybeCreateJob(
- net::URLRequest* request) const OVERRIDE;
+ net::URLRequest* request,
+ net::NetworkDelegate* network_delegate) const OVERRIDE;
private:
// |backend_| and |network_delegate_| are owned by ProfileIOData, which owns
@@ -594,14 +598,15 @@ DevToolsJobFactory::DevToolsJobFactory(ChromeURLDataManagerBackend* backend,
DevToolsJobFactory::~DevToolsJobFactory() {}
net::URLRequestJob*
-DevToolsJobFactory::MaybeCreateJob(net::URLRequest* request) const {
+DevToolsJobFactory::MaybeCreateJob(
+ net::URLRequest* request, net::NetworkDelegate* network_delegate) const {
if (ShouldLoadFromDisk()) {
FilePath path;
if (IsSupportedURL(request->url(), &path))
- return new net::URLRequestFileJob(request, path, network_delegate_);
+ return new net::URLRequestFileJob(request, network_delegate, path);
}
- return new URLRequestChromeJob(request, backend_);
+ return new URLRequestChromeJob(request, network_delegate, backend_);
}
} // namespace