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" |
(...skipping 217 matching lines...) Loading... |
228 private: | 228 private: |
229 // |mojo::ApplicationDelegate|: | 229 // |mojo::ApplicationDelegate|: |
230 void Initialize(mojo::ApplicationImpl* application_impl) override { | 230 void Initialize(mojo::ApplicationImpl* application_impl) override { |
231 DCHECK(!application_impl_); | 231 DCHECK(!application_impl_); |
232 application_impl_ = application_impl; | 232 application_impl_ = application_impl; |
233 mojo::ConnectToService(application_impl_->shell(), "mojo:native_support", | 233 mojo::ConnectToService(application_impl_->shell(), "mojo:native_support", |
234 GetProxy(&native_support_process_)); | 234 GetProxy(&native_support_process_)); |
235 } | 235 } |
236 | 236 |
237 bool ConfigureIncomingConnection( | 237 bool ConfigureIncomingConnection( |
238 mojo::ApplicationConnection* connection) override { | 238 mojo::ServiceProviderImpl* service_provider_impl) override { |
239 connection->GetServiceProviderImpl().AddService<TerminalClient>( | 239 service_provider_impl->AddService<TerminalClient>( |
240 [this](const mojo::ConnectionContext& connection_context, | 240 [this](const mojo::ConnectionContext& connection_context, |
241 mojo::InterfaceRequest<TerminalClient> terminal_client_request) { | 241 mojo::InterfaceRequest<TerminalClient> terminal_client_request) { |
242 new TerminalClientImpl(terminal_client_request.Pass(), | 242 new TerminalClientImpl(terminal_client_request.Pass(), |
243 native_support_process_.get()); | 243 native_support_process_.get()); |
244 }); | 244 }); |
245 return true; | 245 return true; |
246 } | 246 } |
247 | 247 |
248 mojo::ApplicationImpl* application_impl_; | 248 mojo::ApplicationImpl* application_impl_; |
249 native_support::ProcessPtr native_support_process_; | 249 native_support::ProcessPtr native_support_process_; |
250 | 250 |
251 DISALLOW_COPY_AND_ASSIGN(NativeRunApp); | 251 DISALLOW_COPY_AND_ASSIGN(NativeRunApp); |
252 }; | 252 }; |
253 | 253 |
254 MojoResult MojoMain(MojoHandle application_request) { | 254 MojoResult MojoMain(MojoHandle application_request) { |
255 mojo::ApplicationRunnerChromium runner(new NativeRunApp()); | 255 mojo::ApplicationRunnerChromium runner(new NativeRunApp()); |
256 return runner.Run(application_request); | 256 return runner.Run(application_request); |
257 } | 257 } |
OLD | NEW |