OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 // This is a terminal client (i.e., a "raw" |mojo.terminal.Terminal| -- e.g., | 5 // This is a terminal client (i.e., a "raw" |mojo.terminal.Terminal| -- e.g., |
6 // moterm -- can be asked to talk to this) that prompts the user for a native | 6 // moterm -- can be asked to talk to this) that prompts the user for a native |
7 // (Linux) binary to run and then does so (via mojo:native_support). | 7 // (Linux) binary to run and then does so (via mojo:native_support). |
8 // | 8 // |
9 // E.g., first run mojo:moterm_example_app (embedded by a window manager). Then, | 9 // E.g., first run mojo:moterm_example_app (embedded by a window manager). Then, |
10 // at the prompt, enter "mojo:native_run_app". At the next prompt, enter "bash" | 10 // at the prompt, enter "mojo:native_run_app". At the next prompt, enter "bash" |
11 // (or "echo hello mojo"). | 11 // (or "echo hello mojo"). |
12 // | 12 // |
13 // TODO(vtl): Maybe it should optionally be able to extract the binary path (and | 13 // TODO(vtl): Maybe it should optionally be able to extract the binary path (and |
14 // args) from the connection URL? | 14 // args) from the connection URL? |
15 | 15 |
16 #include <string.h> | 16 #include <string.h> |
17 | 17 |
18 #include <string> | 18 #include <string> |
19 #include <utility> | 19 #include <utility> |
20 #include <vector> | 20 #include <vector> |
21 | 21 |
22 #include "base/logging.h" | 22 #include "base/logging.h" |
23 #include "base/macros.h" | 23 #include "base/macros.h" |
24 #include "base/strings/string_split.h" | 24 #include "base/strings/string_split.h" |
25 #include "base/strings/string_util.h" | 25 #include "base/strings/string_util.h" |
| 26 #include "mojo/environment/scoped_chromium_init.h" |
26 #include "mojo/public/c/system/main.h" | 27 #include "mojo/public/c/system/main.h" |
27 #include "mojo/public/cpp/application/application_delegate.h" | 28 #include "mojo/public/cpp/application/application_delegate.h" |
28 #include "mojo/public/cpp/application/application_impl_base.h" | 29 #include "mojo/public/cpp/application/application_impl_base.h" |
29 #include "mojo/public/cpp/application/connect.h" | 30 #include "mojo/public/cpp/application/connect.h" |
30 #include "mojo/public/cpp/application/run_application.h" | 31 #include "mojo/public/cpp/application/run_application.h" |
31 #include "mojo/public/cpp/application/service_provider_impl.h" | 32 #include "mojo/public/cpp/application/service_provider_impl.h" |
32 #include "mojo/public/cpp/bindings/interface_request.h" | 33 #include "mojo/public/cpp/bindings/interface_request.h" |
33 #include "mojo/public/cpp/bindings/strong_binding.h" | 34 #include "mojo/public/cpp/bindings/strong_binding.h" |
34 #include "mojo/services/files/interfaces/files.mojom.h" | 35 #include "mojo/services/files/interfaces/files.mojom.h" |
35 #include "mojo/services/files/interfaces/ioctl.mojom.h" | 36 #include "mojo/services/files/interfaces/ioctl.mojom.h" |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 }); | 246 }); |
246 return true; | 247 return true; |
247 } | 248 } |
248 | 249 |
249 native_support::ProcessPtr native_support_process_; | 250 native_support::ProcessPtr native_support_process_; |
250 | 251 |
251 DISALLOW_COPY_AND_ASSIGN(NativeRunApp); | 252 DISALLOW_COPY_AND_ASSIGN(NativeRunApp); |
252 }; | 253 }; |
253 | 254 |
254 MojoResult MojoMain(MojoHandle application_request) { | 255 MojoResult MojoMain(MojoHandle application_request) { |
| 256 mojo::ScopedChromiumInit init; |
255 NativeRunApp native_run_app; | 257 NativeRunApp native_run_app; |
256 return mojo::RunMainApplication(application_request, &native_run_app); | 258 return mojo::RunApplication(application_request, &native_run_app); |
257 } | 259 } |
OLD | NEW |