diff options
author | jochen@chromium.org <jochen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-06 08:57:05 +0000 |
---|---|---|
committer | jochen@chromium.org <jochen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-06 08:57:05 +0000 |
commit | 9c3ed0a9174fbc15500df7ba8a5d24020805aeec (patch) | |
tree | f8791958335e609fe45a5c92e69a75c5d35b070d /android_webview | |
parent | d7f277f6c09e00852153706f44adc2625f66955f (diff) | |
download | chromium_src-9c3ed0a9174fbc15500df7ba8a5d24020805aeec.zip chromium_src-9c3ed0a9174fbc15500df7ba8a5d24020805aeec.tar.gz chromium_src-9c3ed0a9174fbc15500df7ba8a5d24020805aeec.tar.bz2 |
Revert 186347
Broke MalwareDetailsTest:
[ RUN ] MalwareDetailsTest.HTTPCache
Received signal 11 SEGV_MAPERR 00010000001e
[0x00000285f2ee] base::debug::StackTrace::StackTrace()
[0x00000285f3f6] base::debug::(anonymous namespace)::StackDumpSignalHandler()
[0x7f5274c148f0] <unknown>
[0x0000028a82f7] base::SupportsUserData::GetUserData()
[0x00000215307f] (anonymous namespace)::GetDataForResourceContext()
[0x00000215315c] InstantIOContext::RemoveInstantProcessOnIO()
[0x000002881dd9] MessageLoop::RunTask()
[0x00000288261b] MessageLoop::DeferOrRunPendingTask()
[0x000002882c28] MessageLoop::DoWork()
[0x000002853f4a] base::MessagePumpLibevent::Run()
[0x00000287d8f2] MessageLoop::RunInternal()
[0x00000289966d] base::RunLoop::Run()
[0x00000287cca5] MessageLoop::Run()
[0x0000042ee488] content::BrowserThreadImpl::IOThreadRun()
[0x0000042ef28b] content::BrowserThreadImpl::Run()
[0x0000028b4d88] base::Thread::ThreadMain()
[0x0000028afc01] base::(anonymous namespace)::ThreadFunc()
[0x7f5274c0b9ca] start_thread
[0x7f5272728cdd] clone
> 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
TBR=dhollowa@chromium.org
Review URL: https://codereview.chromium.org/12521005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@186371 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'android_webview')
6 files changed, 138 insertions, 24 deletions
diff --git a/android_webview/browser/aw_browser_context.cc b/android_webview/browser/aw_browser_context.cc index 983cd3e..85a1c14 100644 --- a/android_webview/browser/aw_browser_context.cc +++ b/android_webview/browser/aw_browser_context.cc @@ -76,9 +76,21 @@ void AwBrowserContext::AddVisitedURLs(const std::vector<GURL>& urls) { } net::URLRequestContextGetter* AwBrowserContext::CreateRequestContext( - content::ProtocolHandlerMap* protocol_handlers) { + 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) { CHECK(url_request_context_getter_); - url_request_context_getter_->SetProtocolHandlers(protocol_handlers); + url_request_context_getter_->SetProtocolHandlers( + blob_protocol_handler.Pass(), file_system_protocol_handler.Pass(), + developer_protocol_handler.Pass(), chrome_protocol_handler.Pass(), + chrome_devtools_protocol_handler.Pass()); return url_request_context_getter_.get(); } @@ -86,7 +98,16 @@ net::URLRequestContextGetter* AwBrowserContext::CreateRequestContextForStoragePartition( const base::FilePath& partition_path, bool in_memory, - content::ProtocolHandlerMap* protocol_handlers) { + 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) { CHECK(url_request_context_getter_); return url_request_context_getter_.get(); } diff --git a/android_webview/browser/aw_browser_context.h b/android_webview/browser/aw_browser_context.h index 254a247..c0916c9 100644 --- a/android_webview/browser/aw_browser_context.h +++ b/android_webview/browser/aw_browser_context.h @@ -15,7 +15,6 @@ #include "base/memory/scoped_ptr.h" #include "components/visitedlink/browser/visitedlink_delegate.h" #include "content/public/browser/browser_context.h" -#include "content/public/browser/content_browser_client.h" #include "content/public/browser/geolocation_permission_context.h" #include "net/url_request/url_request_job_factory.h" @@ -59,11 +58,29 @@ class AwBrowserContext : public content::BrowserContext, void AddVisitedURLs(const std::vector<GURL>& urls); net::URLRequestContextGetter* CreateRequestContext( - content::ProtocolHandlerMap* protocol_handlers); + 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); net::URLRequestContextGetter* CreateRequestContextForStoragePartition( const base::FilePath& partition_path, bool in_memory, - content::ProtocolHandlerMap* protocol_handlers); + 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); AwQuotaManagerBridge* GetQuotaManagerBridge(); diff --git a/android_webview/browser/aw_content_browser_client.cc b/android_webview/browser/aw_content_browser_client.cc index 78d8e27..3d8185e 100644 --- a/android_webview/browser/aw_content_browser_client.cc +++ b/android_webview/browser/aw_content_browser_client.cc @@ -118,9 +118,21 @@ void AwContentBrowserClient::RenderProcessHostCreated( net::URLRequestContextGetter* AwContentBrowserClient::CreateRequestContext( content::BrowserContext* browser_context, - content::ProtocolHandlerMap* protocol_handlers) { + 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) { DCHECK(browser_context_.get() == browser_context); - return browser_context_->CreateRequestContext(protocol_handlers); + return browser_context_->CreateRequestContext( + blob_protocol_handler.Pass(), file_system_protocol_handler.Pass(), + developer_protocol_handler.Pass(), chrome_protocol_handler.Pass(), + chrome_devtools_protocol_handler.Pass()); } net::URLRequestContextGetter* @@ -128,10 +140,22 @@ AwContentBrowserClient::CreateRequestContextForStoragePartition( content::BrowserContext* browser_context, const base::FilePath& partition_path, bool in_memory, - content::ProtocolHandlerMap* protocol_handlers) { + 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) { DCHECK(browser_context_.get() == browser_context); return browser_context_->CreateRequestContextForStoragePartition( - partition_path, in_memory, protocol_handlers); + partition_path, in_memory, blob_protocol_handler.Pass(), + file_system_protocol_handler.Pass(), + developer_protocol_handler.Pass(), chrome_protocol_handler.Pass(), + chrome_devtools_protocol_handler.Pass()); } std::string AwContentBrowserClient::GetCanonicalEncodingNameByAliasName( diff --git a/android_webview/browser/aw_content_browser_client.h b/android_webview/browser/aw_content_browser_client.h index 874caa7..3aa78ec 100644 --- a/android_webview/browser/aw_content_browser_client.h +++ b/android_webview/browser/aw_content_browser_client.h @@ -41,12 +41,30 @@ class AwContentBrowserClient : public content::ContentBrowserClient { content::RenderProcessHost* host) OVERRIDE; virtual net::URLRequestContextGetter* CreateRequestContext( content::BrowserContext* browser_context, - content::ProtocolHandlerMap* protocol_handlers) OVERRIDE; + 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) OVERRIDE; virtual net::URLRequestContextGetter* CreateRequestContextForStoragePartition( content::BrowserContext* browser_context, const base::FilePath& partition_path, bool in_memory, - content::ProtocolHandlerMap* protocol_handlers) OVERRIDE; + 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) OVERRIDE; virtual std::string GetCanonicalEncodingNameByAliasName( const std::string& alias_name) OVERRIDE; virtual void AppendExtraCommandLineSwitches(CommandLine* command_line, diff --git a/android_webview/browser/net/aw_url_request_context_getter.cc b/android_webview/browser/net/aw_url_request_context_getter.cc index 9e7b8b0..1b7177b 100644 --- a/android_webview/browser/net/aw_url_request_context_getter.cc +++ b/android_webview/browser/net/aw_url_request_context_getter.cc @@ -106,22 +106,23 @@ net::URLRequestContext* AwURLRequestContextGetter::GetURLRequestContext() { set_protocol = job_factory->SetProtocolHandler( chrome::kDataScheme, new net::DataProtocolHandler()); DCHECK(set_protocol); + DCHECK(blob_protocol_handler_); set_protocol = job_factory->SetProtocolHandler( - chrome::kBlobScheme, protocol_handlers_[chrome::kBlobScheme].release()); + chrome::kBlobScheme, blob_protocol_handler_.release()); DCHECK(set_protocol); + DCHECK(file_system_protocol_handler_); set_protocol = job_factory->SetProtocolHandler( - chrome::kFileSystemScheme, - protocol_handlers_[chrome::kFileSystemScheme].release()); + chrome::kFileSystemScheme, file_system_protocol_handler_.release()); DCHECK(set_protocol); + DCHECK(chrome_protocol_handler_); set_protocol = job_factory->SetProtocolHandler( - chrome::kChromeUIScheme, - protocol_handlers_[chrome::kChromeUIScheme].release()); + chrome::kChromeUIScheme, chrome_protocol_handler_.release()); DCHECK(set_protocol); + DCHECK(chrome_devtools_protocol_handler_); set_protocol = job_factory->SetProtocolHandler( chrome::kChromeDevToolsScheme, - protocol_handlers_[chrome::kChromeDevToolsScheme].release()); + chrome_devtools_protocol_handler_.release()); DCHECK(set_protocol); - protocol_handlers_.clear(); // Create a chain of URLRequestJobFactories. Keep |job_factory_| pointed // at the beginning of the chain. job_factory_ = CreateAndroidJobFactory(job_factory.Pass()); @@ -129,6 +130,9 @@ net::URLRequestContext* AwURLRequestContextGetter::GetURLRequestContext() { job_factory_.Pass(), scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>( new AwRequestInterceptor()))); + job_factory_.reset(new net::ProtocolInterceptJobFactory( + job_factory_.Pass(), + developer_protocol_handler_.Pass())); url_request_context_->set_job_factory(job_factory_.get()); } return url_request_context_.get(); @@ -140,8 +144,21 @@ AwURLRequestContextGetter::GetNetworkTaskRunner() const { } void AwURLRequestContextGetter::SetProtocolHandlers( - content::ProtocolHandlerMap* protocol_handlers) { - std::swap(protocol_handlers_, *protocol_handlers); + 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) { + 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(); } } // namespace android_webview diff --git a/android_webview/browser/net/aw_url_request_context_getter.h b/android_webview/browser/net/aw_url_request_context_getter.h index 418e921..cc2d81f 100644 --- a/android_webview/browser/net/aw_url_request_context_getter.h +++ b/android_webview/browser/net/aw_url_request_context_getter.h @@ -9,7 +9,6 @@ #include "base/compiler_specific.h" #include "base/memory/scoped_ptr.h" #include "content/public/browser/browser_thread_delegate.h" -#include "content/public/browser/content_browser_client.h" #include "net/http/http_network_session.h" #include "net/url_request/url_request_context_getter.h" #include "net/url_request/url_request_job_factory.h" @@ -53,7 +52,17 @@ class AwURLRequestContextGetter : public net::URLRequestContextGetter, // AwBrowserContext::CreateRequestContext() call SetProtocolHandlers(). // SetProtocolHandlers() is necessary because the ProtocolHandlers are created // on the UI thread while |job_factory_| must be created on the IO thread. - void SetProtocolHandlers(content::ProtocolHandlerMap* protocol_handlers); + void SetProtocolHandlers( + 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); void PopulateNetworkSessionParams(net::HttpNetworkSession::Params* params); @@ -65,7 +74,15 @@ class AwURLRequestContextGetter : public net::URLRequestContextGetter, // ProtocolHandlers are stored here between SetProtocolHandlers() and the // first GetURLRequestContext() call. - content::ProtocolHandlerMap protocol_handlers_; + 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_; DISALLOW_COPY_AND_ASSIGN(AwURLRequestContextGetter); }; |