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

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

Issue 11896113: Add chrome-search: access from Instant overlay (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: include nit 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_io_data.cc
diff --git a/chrome/browser/profiles/profile_io_data.cc b/chrome/browser/profiles/profile_io_data.cc
index ad50def0b5cf1d9756805df9ef71b53ed862c35d..e80e83c3cdcc831b7c450821d6ba9d41fe653d76 100644
--- a/chrome/browser/profiles/profile_io_data.cc
+++ b/chrome/browser/profiles/profile_io_data.cc
@@ -428,6 +428,7 @@ bool ProfileIOData::IsHandledProtocol(const std::string& scheme) {
chrome::kBlobScheme,
chrome::kFileSystemScheme,
chrome::kExtensionResourceScheme,
+ chrome::kChromeSearchScheme,
};
for (size_t i = 0; i < arraysize(kProtocolList); ++i) {
if (scheme == kProtocolList[i])
@@ -436,6 +437,7 @@ bool ProfileIOData::IsHandledProtocol(const std::string& scheme) {
return net::URLRequest::IsHandledProtocol(scheme);
}
+// static
bool ProfileIOData::IsHandledURL(const GURL& url) {
if (!url.is_valid()) {
// We handle error cases.
@@ -445,6 +447,21 @@ bool ProfileIOData::IsHandledURL(const GURL& url) {
return IsHandledProtocol(url.scheme());
}
+// static
+void ProfileIOData::InstallProtocolHandlers(
+ net::URLRequestJobFactoryImpl* job_factory,
+ content::ProtocolHandlerMap* protocol_handlers) {
+ for (content::ProtocolHandlerMap::iterator it =
+ protocol_handlers->begin();
+ it != protocol_handlers->end();
+ ++it) {
+ bool set_protocol = job_factory->SetProtocolHandler(
+ it->first, it->second.release());
+ DCHECK(set_protocol);
+ }
+ protocol_handlers->clear();
+}
+
content::ResourceContext* ProfileIOData::GetResourceContext() const {
return resource_context_.get();
}
@@ -471,16 +488,7 @@ ChromeURLRequestContext* ProfileIOData::GetIsolatedAppRequestContext(
const StoragePartitionDescriptor& partition_descriptor,
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 {
DCHECK(initialized_);
ChromeURLRequestContext* context = NULL;
if (ContainsKey(app_request_context_map_, partition_descriptor)) {
@@ -488,9 +496,7 @@ ChromeURLRequestContext* ProfileIOData::GetIsolatedAppRequestContext(
} else {
context = AcquireIsolatedAppRequestContext(
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);
app_request_context_map_[partition_descriptor] = context;
}
DCHECK(context);
@@ -600,17 +606,7 @@ std::string ProfileIOData::GetSSLSessionCacheShard() {
return StringPrintf("profile/%u", ssl_session_cache_instance++);
}
-void ProfileIOData::Init(
- 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 {
+void ProfileIOData::Init(content::ProtocolHandlerMap* protocol_handlers) const {
// The basic logic is implemented here. The specific initialization
// is done in InitializeInternal(), implemented by subtypes. Static helper
// functions have been provided to assist in common operations.
@@ -692,12 +688,7 @@ void ProfileIOData::Init(
managed_mode_url_filter_ = profile_params_->managed_mode_url_filter;
#endif
- InitializeInternal(profile_params_.get(),
- blob_protocol_handler.Pass(),
- file_system_protocol_handler.Pass(),
- developer_protocol_handler.Pass(),
- chrome_protocol_handler.Pass(),
- chrome_devtools_protocol_handler.Pass());
+ InitializeInternal(profile_params_.get(), protocol_handlers);
profile_params_.reset();
initialized_ = true;

Powered by Google App Engine
This is Rietveld 408576698