Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(343)

Side by Side Diff: examples/native_run_app/native_run_app.cc

Issue 1916233002: Mark ApplicationImpl::ConnectTo{Application,Service}() as deprecated. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 public mojo::InterfaceFactory<TerminalClient> { 224 public mojo::InterfaceFactory<TerminalClient> {
225 public: 225 public:
226 NativeRunApp() : application_impl_(nullptr) {} 226 NativeRunApp() : application_impl_(nullptr) {}
227 ~NativeRunApp() override {} 227 ~NativeRunApp() override {}
228 228
229 private: 229 private:
230 // |mojo::ApplicationDelegate|: 230 // |mojo::ApplicationDelegate|:
231 void Initialize(mojo::ApplicationImpl* application_impl) override { 231 void Initialize(mojo::ApplicationImpl* application_impl) override {
232 DCHECK(!application_impl_); 232 DCHECK(!application_impl_);
233 application_impl_ = application_impl; 233 application_impl_ = application_impl;
234 application_impl_->ConnectToService("mojo:native_support", 234 application_impl_->ConnectToServiceDeprecated("mojo:native_support",
235 &native_support_process_); 235 &native_support_process_);
236 } 236 }
237 237
238 bool ConfigureIncomingConnection( 238 bool ConfigureIncomingConnection(
239 mojo::ApplicationConnection* connection) override { 239 mojo::ApplicationConnection* connection) override {
240 connection->AddService<TerminalClient>(this); 240 connection->AddService<TerminalClient>(this);
241 return true; 241 return true;
242 } 242 }
243 243
244 // |InterfaceFactory<TerminalClient>| implementation: 244 // |InterfaceFactory<TerminalClient>| implementation:
245 void Create(mojo::ApplicationConnection* /*connection*/, 245 void Create(mojo::ApplicationConnection* /*connection*/,
246 mojo::InterfaceRequest<TerminalClient> request) override { 246 mojo::InterfaceRequest<TerminalClient> request) override {
247 new TerminalClientImpl(request.Pass(), native_support_process_.get()); 247 new TerminalClientImpl(request.Pass(), native_support_process_.get());
248 } 248 }
249 249
250 mojo::ApplicationImpl* application_impl_; 250 mojo::ApplicationImpl* application_impl_;
251 native_support::ProcessPtr native_support_process_; 251 native_support::ProcessPtr native_support_process_;
252 252
253 DISALLOW_COPY_AND_ASSIGN(NativeRunApp); 253 DISALLOW_COPY_AND_ASSIGN(NativeRunApp);
254 }; 254 };
255 255
256 MojoResult MojoMain(MojoHandle application_request) { 256 MojoResult MojoMain(MojoHandle application_request) {
257 mojo::ApplicationRunnerChromium runner(new NativeRunApp()); 257 mojo::ApplicationRunnerChromium runner(new NativeRunApp());
258 return runner.Run(application_request); 258 return runner.Run(application_request);
259 } 259 }
OLDNEW
« no previous file with comments | « examples/media_test/media_test.cc ('k') | examples/notification_generator/notification_generator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698