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

Side by Side Diff: services/js/js_app_bridge_module.cc

Issue 767323002: Mojo JS Bindings: restore the ServiceProvider class, add an application test (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Removed console import from ServiceProvider Created 6 years 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
« no previous file with comments | « services/js/js_app_bridge_module.h ('k') | services/js/js_app_runner_delegate.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "services/js/mojo_bridge_module.h" 5 #include "services/js/js_app_bridge_module.h"
6 6
7 #include "gin/arguments.h" 7 #include "gin/arguments.h"
8 #include "gin/converter.h" 8 #include "gin/converter.h"
9 #include "gin/object_template_builder.h" 9 #include "gin/object_template_builder.h"
10 #include "gin/per_isolate_data.h" 10 #include "gin/per_isolate_data.h"
11 #include "mojo/edk/js/handle.h" 11 #include "mojo/edk/js/handle.h"
12 #include "services/js/js_app.h" 12 #include "services/js/js_app.h"
13 13
14 namespace mojo { 14 namespace mojo {
15 namespace js { 15 namespace js {
16 16
17 namespace { 17 namespace {
18 18
19 gin::WrapperInfo g_wrapper_info = {gin::kEmbedderNativeGin}; 19 gin::WrapperInfo g_wrapper_info = {gin::kEmbedderNativeGin};
20 20
21 } // namespace 21 } // namespace
22 22
23 const char MojoInternals::kModuleName[] = "services/js/bridge"; 23 const char AppBridge::kModuleName[] = "services/js/app-bridge";
24 24
25 v8::Local<v8::Value> MojoInternals::GetModule(JSApp* js_app, 25 v8::Local<v8::Value> AppBridge::GetModule(JSApp* js_app, v8::Isolate* isolate) {
26 v8::Isolate* isolate) {
27 gin::PerIsolateData* data = gin::PerIsolateData::From(isolate); 26 gin::PerIsolateData* data = gin::PerIsolateData::From(isolate);
28 v8::Local<v8::ObjectTemplate> templ = 27 v8::Local<v8::ObjectTemplate> templ =
29 data->GetObjectTemplate(&g_wrapper_info); 28 data->GetObjectTemplate(&g_wrapper_info);
30 29
31 if (templ.IsEmpty()) { 30 if (templ.IsEmpty()) {
32 templ = gin::ObjectTemplateBuilder(isolate) 31 templ = gin::ObjectTemplateBuilder(isolate)
33 .SetMethod("quit", 32 .SetMethod("quit",
34 base::Bind(&JSApp::Quit, base::Unretained(js_app))) 33 base::Bind(&JSApp::Quit, base::Unretained(js_app)))
35 .Build(); 34 .Build();
36 data->SetObjectTemplate(&g_wrapper_info, templ); 35 data->SetObjectTemplate(&g_wrapper_info, templ);
37 } 36 }
38 37
39 return templ->NewInstance(); 38 return templ->NewInstance();
40 } 39 }
41 40
42 } // namespace js 41 } // namespace js
43 } // namespace mojo 42 } // namespace mojo
OLDNEW
« no previous file with comments | « services/js/js_app_bridge_module.h ('k') | services/js/js_app_runner_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698