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

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: Yet another rebase Created 7 years, 9 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 f3b2bd84e45eca784eb10cc829cb957b08f9f127..9dc346cd701bdaddb0417cf037d909cb79128b45 100644
--- a/chrome/browser/profiles/profile_io_data.cc
+++ b/chrome/browser/profiles/profile_io_data.cc
@@ -431,6 +431,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])
@@ -439,6 +440,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.
@@ -448,6 +450,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();
}
@@ -474,16 +491,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)) {
@@ -491,9 +499,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);
@@ -603,17 +609,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.
@@ -695,12 +691,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;
« no previous file with comments | « chrome/browser/profiles/profile_io_data.h ('k') | chrome/browser/ui/sync/one_click_signin_helper_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698