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

Side by Side Diff: mojo/apps/js/mojo_bridge_module.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, 1 month 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 unified diff | Download patch
OLDNEW
1
Aaron Boodman 2014/10/29 23:06:28 remove blank line
hansmuller 2014/10/30 00:23:38 Done.
1 // Copyright 2014 The Chromium Authors. All rights reserved. 2 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 3 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 4 // found in the LICENSE file.
4 5
5 #include "mojo/apps/js/mojo_bridge_module.h" 6 #include "mojo/apps/js/mojo_bridge_module.h"
6 7
7 #include "gin/arguments.h" 8 #include "gin/arguments.h"
8 #include "gin/converter.h" 9 #include "gin/converter.h"
9 #include "gin/object_template_builder.h" 10 #include "gin/object_template_builder.h"
10 #include "gin/per_isolate_data.h" 11 #include "gin/per_isolate_data.h"
(...skipping 12 matching lines...) Expand all
23 const char MojoInternals::kModuleName[] = "mojo/apps/js/bridge"; 24 const char MojoInternals::kModuleName[] = "mojo/apps/js/bridge";
24 25
25 v8::Local<v8::Value> MojoInternals::GetModule(JSApp* js_app, 26 v8::Local<v8::Value> MojoInternals::GetModule(JSApp* js_app,
26 v8::Isolate* isolate) { 27 v8::Isolate* isolate) {
27 gin::PerIsolateData* data = gin::PerIsolateData::From(isolate); 28 gin::PerIsolateData* data = gin::PerIsolateData::From(isolate);
28 v8::Local<v8::ObjectTemplate> templ = 29 v8::Local<v8::ObjectTemplate> templ =
29 data->GetObjectTemplate(&g_wrapper_info); 30 data->GetObjectTemplate(&g_wrapper_info);
30 31
31 if (templ.IsEmpty()) { 32 if (templ.IsEmpty()) {
32 templ = gin::ObjectTemplateBuilder(isolate) 33 templ = gin::ObjectTemplateBuilder(isolate)
33 .SetMethod("connectToService", 34 .SetMethod("requestorMessagePipeHandle",
34 base::Bind(&JSApp::ConnectToService, 35 base::Bind(&JSApp::RequestorMessagePipeHandle,
36 base::Unretained(js_app)))
37 .SetMethod("connectToApplication",
38 base::Bind(&JSApp::ConnectToApplication,
35 base::Unretained(js_app))) 39 base::Unretained(js_app)))
36 .SetMethod("quit", 40 .SetMethod("quit",
37 base::Bind(&JSApp::Quit, base::Unretained(js_app))) 41 base::Bind(&JSApp::Quit, base::Unretained(js_app)))
38 .Build(); 42 .Build();
39 data->SetObjectTemplate(&g_wrapper_info, templ); 43 data->SetObjectTemplate(&g_wrapper_info, templ);
40 } 44 }
41 45
42 return templ->NewInstance(); 46 return templ->NewInstance();
43 } 47 }
44 48
45 } // namespace apps 49 } // namespace apps
46 } // namespace mojo 50 } // namespace mojo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698