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

Unified Diff: mojo/apps/js/content_handler_impl.cc

Issue 686203004: Mojo JS Bindings: Simplify sharing services for content-provided JS applications (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 6 years, 2 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: mojo/apps/js/content_handler_impl.cc
diff --git a/mojo/apps/js/content_handler_impl.cc b/mojo/apps/js/content_handler_impl.cc
index 233e8af179d49f9acaecd56a75eae776fb7510b4..8b8384ee4408624a7a294ec11ee67323cde80d08 100644
--- a/mojo/apps/js/content_handler_impl.cc
+++ b/mojo/apps/js/content_handler_impl.cc
@@ -14,9 +14,11 @@ namespace apps {
class ContentHandlerJSApp : public JSApp {
public:
ContentHandlerJSApp(ApplicationDelegateImpl* app_delegate_impl,
- URLResponsePtr content)
+ URLResponsePtr content,
+ ScopedMessagePipeHandle sp)
Aaron Boodman 2014/10/29 23:06:28 You could at least make this InterfaceRequest<Serv
hansmuller 2014/10/30 00:23:38 Done.
: JSApp(app_delegate_impl),
- content_(content.Pass()) {
+ content_(content.Pass()),
+ requestor_message_pipe_handle_(sp.Pass()) {
}
bool Load(std::string* source, std::string* file_name) override {
@@ -26,8 +28,13 @@ class ContentHandlerJSApp : public JSApp {
return common::BlockingCopyToString(content_->body.Pass(), source);
}
+ virtual MessagePipeHandle RequestorMessagePipeHandle() override {
+ return requestor_message_pipe_handle_.release();
+ }
+
private:
URLResponsePtr content_;
+ ScopedMessagePipeHandle requestor_message_pipe_handle_;
};
@@ -42,8 +49,9 @@ void ContentHandlerImpl::OnConnect(
const mojo::String& requestor_url,
URLResponsePtr content,
InterfaceRequest<ServiceProvider> service_provider) {
+ ScopedMessagePipeHandle sp(service_provider.PassMessagePipe());
scoped_ptr<JSApp> js_app(
- new ContentHandlerJSApp(app_delegate_impl_, content.Pass()));
+ new ContentHandlerJSApp(app_delegate_impl_, content.Pass(), sp.Pass()));
app_delegate_impl_->StartJSApp(js_app.Pass());
}

Powered by Google App Engine
This is Rietveld 408576698