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

Side by Side Diff: examples/echo_terminal/main.cc

Issue 1975993002: Change InterfaceFactory<I>::Create() to take a ConnectionContext instead of an ApplicationConnectio… (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 4 years, 7 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
« no previous file with comments | « examples/echo/echo_server.cc ('k') | examples/hello_mojo/hello_mojo_server.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include <utility> 5 #include <utility>
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 private: 107 private:
108 // |ApplicationDelegate| override: 108 // |ApplicationDelegate| override:
109 bool ConfigureIncomingConnection( 109 bool ConfigureIncomingConnection(
110 mojo::ApplicationConnection* connection) override { 110 mojo::ApplicationConnection* connection) override {
111 connection->AddService<mojo::terminal::TerminalClient>(this); 111 connection->AddService<mojo::terminal::TerminalClient>(this);
112 return true; 112 return true;
113 } 113 }
114 114
115 // |InterfaceFactory<mojo::terminal::TerminalClient>| implementation: 115 // |InterfaceFactory<mojo::terminal::TerminalClient>| implementation:
116 void Create( 116 void Create(
117 mojo::ApplicationConnection* connection, 117 const mojo::ConnectionContext& connection_context,
118 mojo::InterfaceRequest<mojo::terminal::TerminalClient> request) override { 118 mojo::InterfaceRequest<mojo::terminal::TerminalClient> request) override {
119 terminal_clients_.AddBinding(this, request.Pass()); 119 terminal_clients_.AddBinding(this, request.Pass());
120 } 120 }
121 121
122 // |mojo::terminal::TerminalClient| implementation: 122 // |mojo::terminal::TerminalClient| implementation:
123 void ConnectToTerminal( 123 void ConnectToTerminal(
124 mojo::InterfaceHandle<mojo::files::File> terminal) override { 124 mojo::InterfaceHandle<mojo::files::File> terminal) override {
125 DCHECK(terminal); 125 DCHECK(terminal);
126 // The |TerminalEchoer| will own itself. 126 // The |TerminalEchoer| will own itself.
127 (new TerminalEchoer(mojo::files::FilePtr::Create(std::move(terminal)))) 127 (new TerminalEchoer(mojo::files::FilePtr::Create(std::move(terminal))))
128 ->StartReading(); 128 ->StartReading();
129 } 129 }
130 130
131 mojo::BindingSet<mojo::terminal::TerminalClient> terminal_clients_; 131 mojo::BindingSet<mojo::terminal::TerminalClient> terminal_clients_;
132 132
133 DISALLOW_COPY_AND_ASSIGN(EchoTerminalApp); 133 DISALLOW_COPY_AND_ASSIGN(EchoTerminalApp);
134 }; 134 };
135 135
136 MojoResult MojoMain(MojoHandle application_request) { 136 MojoResult MojoMain(MojoHandle application_request) {
137 mojo::ApplicationRunnerChromium runner(new EchoTerminalApp()); 137 mojo::ApplicationRunnerChromium runner(new EchoTerminalApp());
138 return runner.Run(application_request); 138 return runner.Run(application_request);
139 } 139 }
OLDNEW
« no previous file with comments | « examples/echo/echo_server.cc ('k') | examples/hello_mojo/hello_mojo_server.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698