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