OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "services/js/js_app_shell.h" |
| 6 |
| 7 #include "gin/object_template_builder.h" |
| 8 #include "services/js/js_app.h" |
| 9 |
| 10 namespace mojo { |
| 11 namespace js { |
| 12 |
| 13 gin::WrapperInfo JSAppShell::kWrapperInfo = {gin::kEmbedderNativeGin}; |
| 14 |
| 15 gin::Handle<JSAppShell> JSAppShell::Create(v8::Isolate* isolate, |
| 16 JSApp* js_app) { |
| 17 return CreateHandle(isolate, new JSAppShell(js_app)); |
| 18 } |
| 19 |
| 20 JSAppShell::JSAppShell(JSApp* js_app) : js_app_(js_app) { |
| 21 } |
| 22 |
| 23 JSAppShell::~JSAppShell() { |
| 24 } |
| 25 |
| 26 gin::ObjectTemplateBuilder JSAppShell::GetObjectTemplateBuilder( |
| 27 v8::Isolate* isolate) { |
| 28 return gin::Wrappable<JSAppShell>::GetObjectTemplateBuilder(isolate) |
| 29 .SetMethod("connectToApplication", &JSAppShell::ConnectToApplication); |
| 30 } |
| 31 |
| 32 void JSAppShell::ConnectToApplication( |
| 33 const std::string& application_url, mojo::Handle service_provider) { |
| 34 // TODO(hansmuller): Validate arguments. |
| 35 // TODO(hansmuller): Service_provider may be a ServiceProviderProxy. |
| 36 MessagePipeHandle message_pipe_handle(service_provider.value()); |
| 37 ScopedMessagePipeHandle scoped_handle(message_pipe_handle); |
| 38 js_app_->ConnectToApplication(application_url, scoped_handle.Pass()); |
| 39 } |
| 40 |
| 41 } // namespace js |
| 42 } // namespace mojo |
OLD | NEW |