| 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 "mojo/apps/js/js_app.h" | 5 #include "services/js/js_app.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "gin/array_buffer.h" | 8 #include "gin/array_buffer.h" |
| 9 #include "gin/converter.h" | 9 #include "gin/converter.h" |
| 10 #include "mojo/apps/js/mojo_bridge_module.h" | |
| 11 #include "mojo/common/data_pipe_utils.h" | 10 #include "mojo/common/data_pipe_utils.h" |
| 11 #include "services/js/mojo_bridge_module.h" |
| 12 | 12 |
| 13 namespace mojo { | 13 namespace mojo { |
| 14 namespace apps { | 14 namespace js { |
| 15 | 15 |
| 16 JSApp::JSApp(ShellPtr shell, URLResponsePtr response) : shell_(shell.Pass()) { | 16 JSApp::JSApp(ShellPtr shell, URLResponsePtr response) : shell_(shell.Pass()) { |
| 17 // TODO(hansmuller): handle load failure here and below. | 17 // TODO(hansmuller): handle load failure here and below. |
| 18 DCHECK(!response.is_null()); | 18 DCHECK(!response.is_null()); |
| 19 file_name_ = response->url; | 19 file_name_ = response->url; |
| 20 bool result = common::BlockingCopyToString(response->body.Pass(), &source_); | 20 bool result = common::BlockingCopyToString(response->body.Pass(), &source_); |
| 21 DCHECK(result); | 21 DCHECK(result); |
| 22 | 22 |
| 23 runner_delegate.AddBuiltinModule(MojoInternals::kModuleName, | 23 runner_delegate.AddBuiltinModule(MojoInternals::kModuleName, |
| 24 base::Bind(MojoInternals::GetModule, this)); | 24 base::Bind(MojoInternals::GetModule, this)); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 } | 59 } |
| 60 | 60 |
| 61 void JSApp::Initialize(Array<String> args) { | 61 void JSApp::Initialize(Array<String> args) { |
| 62 } | 62 } |
| 63 | 63 |
| 64 void JSApp::QuitInternal() { | 64 void JSApp::QuitInternal() { |
| 65 shell_runner_.reset(); | 65 shell_runner_.reset(); |
| 66 base::MessageLoop::current()->QuitWhenIdle(); | 66 base::MessageLoop::current()->QuitWhenIdle(); |
| 67 } | 67 } |
| 68 | 68 |
| 69 } // namespace apps | 69 } // namespace js |
| 70 } // namespace mojo | 70 } // namespace mojo |
| OLD | NEW |