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

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

Issue 665743003: Mojo JS Bindings: Simplify sharing services for content-provided JS applications (Closed) Base URL: https://chromium.googlesource.com/chromium/src.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..610222a372383ee6b7f8ff6d5a8527215eed2a0a 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 17:12:51 Same thing here -- I would prefer to see the stron
hansmuller 2014/10/29 22:43:40 I tried to do this but was thwarted by base::Bind(
: 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 Handle 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