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

Unified Diff: headless/lib/browser/headless_browser_context_impl.cc

Issue 2902953003: Revert of Allow headless TabSocket in isolated worlds & remove obsolete logic (Closed)
Patch Set: Created 3 years, 7 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
« no previous file with comments | « headless/BUILD.gn ('k') | headless/lib/browser/headless_web_contents_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: headless/lib/browser/headless_browser_context_impl.cc
diff --git a/headless/lib/browser/headless_browser_context_impl.cc b/headless/lib/browser/headless_browser_context_impl.cc
index d680daa5a66f40cd94005e357c1d84a3825690a6..09ee140058bc3bfa5ab621260dc2977541aad901 100644
--- a/headless/lib/browser/headless_browser_context_impl.cc
+++ b/headless/lib/browser/headless_browser_context_impl.cc
@@ -29,6 +29,10 @@
namespace headless {
+namespace {
+const char kHeadlessMojomProtocol[] = "headless-mojom";
+}
+
// Contains net::URLRequestContextGetter required for resource loading.
// Must be destructed on the IO thread as per content::ResourceContext
// requirements.
@@ -410,6 +414,19 @@
HeadlessBrowserContext* HeadlessBrowserContext::Builder::Build() {
if (!mojo_bindings_.empty()) {
+ std::unique_ptr<InMemoryProtocolHandler> headless_mojom_protocol_handler(
+ new InMemoryProtocolHandler());
+ for (const MojoBindings& binding : mojo_bindings_) {
+ headless_mojom_protocol_handler->InsertResponse(
+ binding.mojom_name,
+ InMemoryProtocolHandler::Response(binding.js_bindings,
+ "application/javascript"));
+ }
+ DCHECK(options_->protocol_handlers_.find(kHeadlessMojomProtocol) ==
+ options_->protocol_handlers_.end());
+ options_->protocol_handlers_[kHeadlessMojomProtocol] =
+ std::move(headless_mojom_protocol_handler);
+
// Unless you know what you're doing it's unsafe to allow http/https for a
// context with mojo bindings.
if (!enable_http_and_https_if_mojo_used_) {
« no previous file with comments | « headless/BUILD.gn ('k') | headless/lib/browser/headless_web_contents_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698