| OLD | NEW |
| 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/mojo_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" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 const char MojoInternals::kModuleName[] = "services/js/bridge"; | 23 const char MojoInternals::kModuleName[] = "services/js/bridge"; |
| 24 | 24 |
| 25 v8::Local<v8::Value> MojoInternals::GetModule(JSApp* js_app, | 25 v8::Local<v8::Value> MojoInternals::GetModule(JSApp* js_app, |
| 26 v8::Isolate* isolate) { | 26 v8::Isolate* isolate) { |
| 27 gin::PerIsolateData* data = gin::PerIsolateData::From(isolate); | 27 gin::PerIsolateData* data = gin::PerIsolateData::From(isolate); |
| 28 v8::Local<v8::ObjectTemplate> templ = | 28 v8::Local<v8::ObjectTemplate> templ = |
| 29 data->GetObjectTemplate(&g_wrapper_info); | 29 data->GetObjectTemplate(&g_wrapper_info); |
| 30 | 30 |
| 31 if (templ.IsEmpty()) { | 31 if (templ.IsEmpty()) { |
| 32 templ = gin::ObjectTemplateBuilder(isolate) | 32 templ = gin::ObjectTemplateBuilder(isolate) |
| 33 .SetMethod("requestorMessagePipeHandle", | |
| 34 base::Bind(&JSApp::RequestorMessagePipeHandle, | |
| 35 base::Unretained(js_app))) | |
| 36 .SetMethod("connectToApplication", | |
| 37 base::Bind(&JSApp::ConnectToApplication, | |
| 38 base::Unretained(js_app))) | |
| 39 .SetMethod("quit", | 33 .SetMethod("quit", |
| 40 base::Bind(&JSApp::Quit, base::Unretained(js_app))) | 34 base::Bind(&JSApp::Quit, base::Unretained(js_app))) |
| 41 .Build(); | 35 .Build(); |
| 42 data->SetObjectTemplate(&g_wrapper_info, templ); | 36 data->SetObjectTemplate(&g_wrapper_info, templ); |
| 43 } | 37 } |
| 44 | 38 |
| 45 return templ->NewInstance(); | 39 return templ->NewInstance(); |
| 46 } | 40 } |
| 47 | 41 |
| 48 } // namespace js | 42 } // namespace js |
| 49 } // namespace mojo | 43 } // namespace mojo |
| OLD | NEW |