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

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

Issue 11896113: Add chrome-search: access from Instant overlay (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address Charlie's comments. Created 7 years, 10 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/profile_impl_io_data.cc
diff --git a/chrome/browser/profiles/profile_impl_io_data.cc b/chrome/browser/profiles/profile_impl_io_data.cc
index 5a4982299ab508af1b292797891111a79252c8db..0ab6865376ee7a56e1a6f2e369461cad277c9795 100644
--- a/chrome/browser/profiles/profile_impl_io_data.cc
+++ b/chrome/browser/profiles/profile_impl_io_data.cc
@@ -129,24 +129,16 @@ ProfileImplIOData::Handle::GetResourceContextNoInit() const {
scoped_refptr<ChromeURLRequestContextGetter>
ProfileImplIOData::Handle::CreateMainRequestContextGetter(
scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- blob_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- file_system_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
developer_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- chrome_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- chrome_devtools_protocol_handler,
+ content::ProtocolHandlerMap* protocol_handlers,
PrefService* local_state,
IOThread* io_thread) const {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
LazyInitialize();
DCHECK(!main_request_context_getter_);
main_request_context_getter_ = ChromeURLRequestContextGetter::CreateOriginal(
- profile_, io_data_, blob_protocol_handler.Pass(),
- file_system_protocol_handler.Pass(), developer_protocol_handler.Pass(),
- chrome_protocol_handler.Pass(), chrome_devtools_protocol_handler.Pass());
+ profile_, io_data_, developer_protocol_handler.Pass(),
+ protocol_handlers);
io_data_->predictor_->InitNetworkPredictor(profile_->GetPrefs(),
local_state,
@@ -189,15 +181,8 @@ ProfileImplIOData::Handle::CreateIsolatedAppRequestContextGetter(
const base::FilePath& partition_path,
bool in_memory,
scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- blob_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- file_system_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
developer_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- chrome_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- chrome_devtools_protocol_handler) const {
+ content::ProtocolHandlerMap* protocol_handlers) const {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
// Check that the partition_path is not the same as the base profile path. We
// expect isolated partition, which will never go to the default profile path.
@@ -218,10 +203,9 @@ ProfileImplIOData::Handle::CreateIsolatedAppRequestContextGetter(
ChromeURLRequestContextGetter* context =
ChromeURLRequestContextGetter::CreateOriginalForIsolatedApp(
profile_, io_data_, descriptor,
- protocol_handler_interceptor.Pass(), blob_protocol_handler.Pass(),
- file_system_protocol_handler.Pass(),
- developer_protocol_handler.Pass(), chrome_protocol_handler.Pass(),
- chrome_devtools_protocol_handler.Pass());
+ protocol_handler_interceptor.Pass(),
+ developer_protocol_handler.Pass(),
+ protocol_handlers);
app_request_context_getter_map_[descriptor] = context;
return context;
@@ -318,15 +302,8 @@ ProfileImplIOData::~ProfileImplIOData() {
void ProfileImplIOData::InitializeInternal(
ProfileParams* profile_params,
scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- blob_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- file_system_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
developer_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- chrome_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- chrome_devtools_protocol_handler) const {
+ content::ProtocolHandlerMap* protocol_handlers) const {
ChromeURLRequestContext* main_context = main_request_context();
IOThread* const io_thread = profile_params->io_thread;
@@ -447,19 +424,8 @@ void ProfileImplIOData::InitializeInternal(
scoped_ptr<net::URLRequestJobFactoryImpl> main_job_factory(
new net::URLRequestJobFactoryImpl());
- bool set_protocol = main_job_factory->SetProtocolHandler(
- chrome::kBlobScheme, blob_protocol_handler.release());
- DCHECK(set_protocol);
- set_protocol = main_job_factory->SetProtocolHandler(
- chrome::kFileSystemScheme, file_system_protocol_handler.release());
- DCHECK(set_protocol);
- set_protocol = main_job_factory->SetProtocolHandler(
- chrome::kChromeUIScheme, chrome_protocol_handler.release());
- DCHECK(set_protocol);
- set_protocol = main_job_factory->SetProtocolHandler(
- chrome::kChromeDevToolsScheme,
- chrome_devtools_protocol_handler.release());
- DCHECK(set_protocol);
+ content::ContentBrowserClient::InstallProtocolHandlers(main_job_factory.get(),
+ protocol_handlers);
main_job_factory_ = SetUpJobFactoryDefaults(
main_job_factory.Pass(),
profile_params->protocol_handler_interceptor.Pass(),
@@ -540,15 +506,8 @@ ProfileImplIOData::InitializeAppRequestContext(
scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory>
protocol_handler_interceptor,
scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- blob_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- file_system_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
developer_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- chrome_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- chrome_devtools_protocol_handler) const {
+ content::ProtocolHandlerMap* protocol_handlers) const {
// Copy most state from the main context.
AppRequestContext* context = new AppRequestContext(load_time_stats());
context->CopyFrom(main_context);
@@ -620,19 +579,8 @@ ProfileImplIOData::InitializeAppRequestContext(
scoped_ptr<net::URLRequestJobFactoryImpl> job_factory(
new net::URLRequestJobFactoryImpl());
- bool set_protocol = job_factory->SetProtocolHandler(
- chrome::kBlobScheme, blob_protocol_handler.release());
- DCHECK(set_protocol);
- set_protocol = job_factory->SetProtocolHandler(
- chrome::kFileSystemScheme, file_system_protocol_handler.release());
- DCHECK(set_protocol);
- set_protocol = job_factory->SetProtocolHandler(
- chrome::kChromeUIScheme, chrome_protocol_handler.release());
- DCHECK(set_protocol);
- set_protocol = job_factory->SetProtocolHandler(
- chrome::kChromeDevToolsScheme,
- chrome_devtools_protocol_handler.release());
- DCHECK(set_protocol);
+ content::ContentBrowserClient::InstallProtocolHandlers(job_factory.get(),
+ protocol_handlers);
scoped_ptr<net::URLRequestJobFactory> top_job_factory;
// Overwrite the job factory that we inherit from the main context so
// that we can later provide our own handlers for storage related protocols.
@@ -715,24 +663,14 @@ ProfileImplIOData::AcquireIsolatedAppRequestContext(
scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory>
protocol_handler_interceptor,
scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- blob_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- file_system_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
developer_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- chrome_protocol_handler,
- scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
- chrome_devtools_protocol_handler) const {
+ content::ProtocolHandlerMap* protocol_handlers) const {
// We create per-app contexts on demand, unlike the others above.
ChromeURLRequestContext* app_request_context =
InitializeAppRequestContext(main_context, partition_descriptor,
protocol_handler_interceptor.Pass(),
- blob_protocol_handler.Pass(),
- file_system_protocol_handler.Pass(),
developer_protocol_handler.Pass(),
- chrome_protocol_handler.Pass(),
- chrome_devtools_protocol_handler.Pass());
+ protocol_handlers);
DCHECK(app_request_context);
return app_request_context;
}

Powered by Google App Engine
This is Rietveld 408576698