summaryrefslogtreecommitdiffstats
path: root/chrome/browser/net
diff options
context:
space:
mode:
authordhollowa@chromium.org <dhollowa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-06 04:02:12 +0000
committerdhollowa@chromium.org <dhollowa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-06 04:02:12 +0000
commita54fb2a280174122760073c5a521b687569f0e6c (patch)
treeb347f5dff1c04a7967f8d44c44c96d3cdaaa0383 /chrome/browser/net
parentb8cbd4dca055132b059581b744822584290e9229 (diff)
downloadchromium_src-a54fb2a280174122760073c5a521b687569f0e6c.zip
chromium_src-a54fb2a280174122760073c5a521b687569f0e6c.tar.gz
chromium_src-a54fb2a280174122760073c5a521b687569f0e6c.tar.bz2
Add chrome-search: access from Instant overlay
Enables the Instant NTP page access to: chrome-search://theme/*, chrome-search://favicon/*, and chrome-search://thumb/*. This CL has a number of aspects to make the installed theme background image available to the Instant overlay: 1. Utilizes the new chrome-search: scheme that is accessible only to the Instant overlay's render process. This is enforced on the renderer side by WebKit::WebSecurityPolicy facilities. This is enforced on the browser side by the InstantIOContext::ShouldServiceRequest and URLDataSource::ShouldServiceRequest facilities. 2. Whitelists the chrome-search://theme origin to be made available to the specific Instant overlay's origin/url. 3. Backend CSS that sets the appropriate background image that resides in the chrome-search://theme origin. 4. A small refactoring of the Instant tests to support mix-in usage of InstantTestBase. BUG=172408, 134937 TEST=InstantPolicyTest.SearchSchemePolicy R=sreeram@chromium.org, creis@chromium.org Review URL: https://chromiumcodereview.appspot.com/11896113 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@186347 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/net')
-rw-r--r--chrome/browser/net/chrome_url_request_context.cc148
-rw-r--r--chrome/browser/net/chrome_url_request_context.h44
2 files changed, 30 insertions, 162 deletions
diff --git a/chrome/browser/net/chrome_url_request_context.cc b/chrome/browser/net/chrome_url_request_context.cc
index 91d9375..f033aec 100644
--- a/chrome/browser/net/chrome_url_request_context.cc
+++ b/chrome/browser/net/chrome_url_request_context.cc
@@ -42,44 +42,19 @@ class FactoryForMain : public ChromeURLRequestContextFactory {
public:
FactoryForMain(
const ProfileIOData* profile_io_data,
- 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)
- : profile_io_data_(profile_io_data),
- blob_protocol_handler_(blob_protocol_handler.Pass()),
- file_system_protocol_handler_(file_system_protocol_handler.Pass()),
- developer_protocol_handler_(developer_protocol_handler.Pass()),
- chrome_protocol_handler_(chrome_protocol_handler.Pass()),
- chrome_devtools_protocol_handler_(
- chrome_devtools_protocol_handler.Pass()) {}
+ content::ProtocolHandlerMap* protocol_handlers)
+ : profile_io_data_(profile_io_data) {
+ std::swap(protocol_handlers_, *protocol_handlers);
+ }
virtual ChromeURLRequestContext* Create() OVERRIDE {
- profile_io_data_->Init(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_->Init(&protocol_handlers_);
return profile_io_data_->GetMainRequestContext();
}
private:
const ProfileIOData* const profile_io_data_;
- 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_;
};
// Factory that creates the ChromeURLRequestContext for extensions.
@@ -105,26 +80,13 @@ class FactoryForIsolatedApp : public ChromeURLRequestContextFactory {
ChromeURLRequestContextGetter* main_context,
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)
+ content::ProtocolHandlerMap* protocol_handlers)
: profile_io_data_(profile_io_data),
partition_descriptor_(partition_descriptor),
main_request_context_getter_(main_context),
- protocol_handler_interceptor_(protocol_handler_interceptor.Pass()),
- blob_protocol_handler_(blob_protocol_handler.Pass()),
- file_system_protocol_handler_(file_system_protocol_handler.Pass()),
- developer_protocol_handler_(developer_protocol_handler.Pass()),
- chrome_protocol_handler_(chrome_protocol_handler.Pass()),
- chrome_devtools_protocol_handler_(
- chrome_devtools_protocol_handler.Pass()) {}
+ protocol_handler_interceptor_(protocol_handler_interceptor.Pass()) {
+ std::swap(protocol_handlers_, *protocol_handlers);
+ }
virtual ChromeURLRequestContext* Create() OVERRIDE {
// We will copy most of the state from the main request context.
@@ -134,10 +96,9 @@ class FactoryForIsolatedApp : public ChromeURLRequestContextFactory {
// state onwards.
return profile_io_data_->GetIsolatedAppRequestContext(
main_request_context_getter_->GetURLRequestContext(),
- 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());
+ partition_descriptor_,
+ protocol_handler_interceptor_.Pass(),
+ &protocol_handlers_);
}
private:
@@ -147,16 +108,7 @@ class FactoryForIsolatedApp : public ChromeURLRequestContextFactory {
main_request_context_getter_;
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_;
+ content::ProtocolHandlerMap protocol_handlers_;
};
// Factory that creates the media ChromeURLRequestContext for a given isolated
@@ -244,24 +196,10 @@ ChromeURLRequestContextGetter::GetNetworkTaskRunner() const {
ChromeURLRequestContextGetter* ChromeURLRequestContextGetter::CreateOriginal(
Profile* profile,
const ProfileIOData* profile_io_data,
- 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) {
DCHECK(!profile->IsOffTheRecord());
return new ChromeURLRequestContextGetter(
- new FactoryForMain(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()));
+ new FactoryForMain(profile_io_data, protocol_handlers));
}
// static
@@ -290,25 +228,15 @@ ChromeURLRequestContextGetter::CreateOriginalForIsolatedApp(
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) {
+ content::ProtocolHandlerMap* protocol_handlers) {
DCHECK(!profile->IsOffTheRecord());
ChromeURLRequestContextGetter* main_context =
static_cast<ChromeURLRequestContextGetter*>(profile->GetRequestContext());
return new ChromeURLRequestContextGetter(
new FactoryForIsolatedApp(profile_io_data, partition_descriptor,
- main_context, 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()));
+ main_context,
+ protocol_handler_interceptor.Pass(),
+ protocol_handlers));
}
// static
@@ -329,24 +257,10 @@ ChromeURLRequestContextGetter*
ChromeURLRequestContextGetter::CreateOffTheRecord(
Profile* profile,
const ProfileIOData* profile_io_data,
- 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) {
DCHECK(profile->IsOffTheRecord());
return new ChromeURLRequestContextGetter(
- new FactoryForMain(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()));
+ new FactoryForMain(profile_io_data, protocol_handlers));
}
// static
@@ -366,25 +280,15 @@ ChromeURLRequestContextGetter::CreateOffTheRecordForIsolatedApp(
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) {
+ content::ProtocolHandlerMap* protocol_handlers) {
DCHECK(profile->IsOffTheRecord());
ChromeURLRequestContextGetter* main_context =
static_cast<ChromeURLRequestContextGetter*>(profile->GetRequestContext());
return new ChromeURLRequestContextGetter(
new FactoryForIsolatedApp(profile_io_data, partition_descriptor,
- main_context, 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()));
+ main_context,
+ protocol_handler_interceptor.Pass(),
+ protocol_handlers));
}
// ----------------------------------------------------------------------------
diff --git a/chrome/browser/net/chrome_url_request_context.h b/chrome/browser/net/chrome_url_request_context.h
index 88fcc50..db09992 100644
--- a/chrome/browser/net/chrome_url_request_context.h
+++ b/chrome/browser/net/chrome_url_request_context.h
@@ -92,16 +92,7 @@ class ChromeURLRequestContextGetter : public net::URLRequestContextGetter {
static ChromeURLRequestContextGetter* CreateOriginal(
Profile* profile,
const ProfileIOData* profile_io_data,
- 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);
// Create an instance for an original profile for media. This is expected to
// get called on UI thread. This method takes a profile and reuses the
@@ -122,16 +113,7 @@ class ChromeURLRequestContextGetter : public net::URLRequestContextGetter {
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);
+ content::ProtocolHandlerMap* protocol_handlers);
// Create an instance for an original profile for media with isolated
// storage. This is expected to get called on UI thread.
@@ -146,16 +128,7 @@ class ChromeURLRequestContextGetter : public net::URLRequestContextGetter {
static ChromeURLRequestContextGetter* CreateOffTheRecord(
Profile* profile,
const ProfileIOData* profile_io_data,
- 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);
// Create an instance for an OTR profile for extensions. This is expected
// to get called on UI thread.
@@ -170,16 +143,7 @@ class ChromeURLRequestContextGetter : public net::URLRequestContextGetter {
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);
+ content::ProtocolHandlerMap* protocol_handlers);
private:
virtual ~ChromeURLRequestContextGetter();