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

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

Issue 10700117: Replaced static URLRequestFileJob factory with non-static protocol handler for File jobs (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed nits Created 8 years, 4 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 471bac33c589762f02ef08c35923556d993717b7..de32055f1678a1a823616cc402d831f4649899d5 100644
--- a/chrome/browser/profiles/off_the_record_profile_io_data.cc
+++ b/chrome/browser/profiles/off_the_record_profile_io_data.cc
@@ -16,6 +16,7 @@
#include "chrome/browser/net/chrome_network_delegate.h"
#include "chrome/browser/net/chrome_url_request_context.h"
#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/ui/webui/chrome_url_data_manager_backend.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/extensions/extension.h"
#include "chrome/common/pref_names.h"
@@ -27,6 +28,7 @@
#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/file_protocol_handler.h"
#include "net/url_request/ftp_protocol_handler.h"
#include "net/url_request/url_request_job_factory.h"
#include "webkit/database/database_tracker.h"
@@ -251,6 +253,27 @@ void OffTheRecordProfileIOData::LazyInitializeInternal(
main_job_factory_.reset(new net::URLRequestJobFactory);
extensions_job_factory_.reset(new net::URLRequestJobFactory);
+ int set_protocol = main_job_factory_->SetProtocolHandler(
+ chrome::kFileScheme, new net::FileProtocolHandler(network_delegate()));
+ DCHECK(set_protocol);
+ // TODO(shalev): 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));
+ DCHECK(set_protocol);
+
+ set_protocol = main_job_factory_->SetProtocolHandler(
+ chrome::kChromeDevToolsScheme,
+ CreateDevToolsProtocolHandler(chrome_url_data_manager_backend(),
+ network_delegate()));
+ DCHECK(set_protocol);
+ set_protocol = extensions_job_factory_->SetProtocolHandler(
+ chrome::kChromeDevToolsScheme,
+ CreateDevToolsProtocolHandler(chrome_url_data_manager_backend(), NULL));
+ DCHECK(set_protocol);
+
net::URLRequestJobFactory* job_factories[2];
job_factories[0] = main_job_factory_.get();
job_factories[1] = extensions_job_factory_.get();
« no previous file with comments | « chrome/browser/extensions/extension_resource_protocols.cc ('k') | chrome/browser/profiles/profile_impl_io_data.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698