Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5280)

Unified Diff: chrome/browser/profiles/off_the_record_profile_io_data.cc

Issue 10537056: Replaced static URLRequestFtpJob factory with non-static protocol handler for FTP jobs. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fixed job factories in off_the_record Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/profiles/off_the_record_profile_io_data.cc
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 c33f78c2c4b2fbdacaa4c59c3bbeffe6e40468c9..cf1b037549250585476512ec9f9e5ba837265769 100644
--- a/chrome/browser/profiles/off_the_record_profile_io_data.cc
+++ b/chrome/browser/profiles/off_the_record_profile_io_data.cc
@@ -27,6 +27,8 @@
#include "net/ftp/ftp_network_layer.h"
#include "net/http/http_cache.h"
#include "net/http/http_server_properties_impl.h"
+#include "net/url_request/ftp_protocol_handler.h"
+#include "net/url_request/url_request_job_factory.h"
#include "webkit/database/database_tracker.h"
using content::BrowserThread;
@@ -243,11 +245,25 @@ void OffTheRecordProfileIOData::LazyInitializeInternal(
new net::FtpNetworkLayer(main_context->host_resolver()));
main_context->set_ftp_transaction_factory(ftp_factory_.get());
+ ftp_auth_cache_.reset(new net::FtpAuthCache);
+
main_context->set_chrome_url_data_manager_backend(
chrome_url_data_manager_backend());
- main_context->set_job_factory(job_factory());
- extensions_context->set_job_factory(job_factory());
+ main_job_factory_.reset(new net::URLRequestJobFactory);
+ extensions_job_factory_.reset(new net::URLRequestJobFactory);
+
+ net::URLRequestJobFactory* job_factories[2];
+ job_factories[0] = main_job_factory_.get();
+ job_factories[1] = extensions_job_factory_.get();
+
+ for (int i = 0; i < 2; i++) {
+ SetUpJobFactoryDefaults(job_factories[i]);
+ CreateFtpProtocolHandler(job_factories[i]);
mmenke 2012/06/27 17:20:07 nit: Fix indent.
shalev 2012/06/27 20:10:43 Done.
+ }
+
+ main_context->set_job_factory(main_job_factory_.get());
+ extensions_context->set_job_factory(extensions_job_factory_.get());
}
ChromeURLRequestContext*
@@ -292,3 +308,12 @@ OffTheRecordProfileIOData::AcquireIsolatedAppRequestContext(
DCHECK(app_request_context);
return app_request_context;
}
+
+void OffTheRecordProfileIOData::CreateFtpProtocolHandler(
+ net::URLRequestJobFactory* job_factory) const {
+ job_factory->SetProtocolHandler(
+ chrome::kFtpScheme,
+ new net::FtpProtocolHandler(
+ network_delegate(), ftp_factory_.get(), ftp_auth_cache_.get()));
+}
+

Powered by Google App Engine
This is Rietveld 408576698