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

Side by Side Diff: mojo/dart/packages/mojo_services/lib/mojo/terminal/terminal_client.mojom.dart

Issue 1983453002: Dart: Refactor Stubs (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Merge 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
OLDNEW
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 library terminal_client_mojom; 5 library terminal_client_mojom;
6 import 'dart:async'; 6 import 'dart:async';
7 import 'package:mojo/bindings.dart' as bindings; 7 import 'package:mojo/bindings.dart' as bindings;
8 import 'package:mojo/core.dart' as core; 8 import 'package:mojo/core.dart' as core;
9 import 'package:mojo/mojo/bindings/types/service_describer.mojom.dart' as servic e_describer; 9 import 'package:mojo/mojo/bindings/types/service_describer.mojom.dart' as servic e_describer;
10 import 'package:mojo_services/mojo/files/file.mojom.dart' as file_mojom; 10 import 'package:mojo_services/mojo/files/file.mojom.dart' as file_mojom;
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 92
93 dynamic getAllTypeDefinitions([Function responseFactory]) => 93 dynamic getAllTypeDefinitions([Function responseFactory]) =>
94 responseFactory(null); 94 responseFactory(null);
95 } 95 }
96 96
97 abstract class TerminalClient { 97 abstract class TerminalClient {
98 static const String serviceName = "mojo::terminal::TerminalClient"; 98 static const String serviceName = "mojo::terminal::TerminalClient";
99 void connectToTerminal(Object terminal); 99 void connectToTerminal(Object terminal);
100 } 100 }
101 101
102 102 class _TerminalClientProxyControl
103 class _TerminalClientProxyControl extends bindings.ProxyMessageHandler 103 extends bindings.ProxyMessageHandler
104 implements bindings.ProxyControl { 104 implements bindings.ProxyControl {
105 _TerminalClientProxyControl.fromEndpoint( 105 _TerminalClientProxyControl.fromEndpoint(
106 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); 106 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint);
107 107
108 _TerminalClientProxyControl.fromHandle( 108 _TerminalClientProxyControl.fromHandle(
109 core.MojoHandle handle) : super.fromHandle(handle); 109 core.MojoHandle handle) : super.fromHandle(handle);
110 110
111 _TerminalClientProxyControl.unbound() : super.unbound(); 111 _TerminalClientProxyControl.unbound() : super.unbound();
112 112
113 service_describer.ServiceDescription get serviceDescription => 113 service_describer.ServiceDescription get serviceDescription =>
114 new _TerminalClientServiceDescription(); 114 new _TerminalClientServiceDescription();
115 115
116 String get serviceName => TerminalClient.serviceName; 116 String get serviceName => TerminalClient.serviceName;
117 117
118 @override
119 void handleResponse(bindings.ServiceMessage message) { 118 void handleResponse(bindings.ServiceMessage message) {
120 switch (message.header.type) { 119 switch (message.header.type) {
121 default: 120 default:
122 proxyError("Unexpected message type: ${message.header.type}"); 121 proxyError("Unexpected message type: ${message.header.type}");
123 close(immediate: true); 122 close(immediate: true);
124 break; 123 break;
125 } 124 }
126 } 125 }
127 126
128 @override 127 @override
129 String toString() { 128 String toString() {
130 var superString = super.toString(); 129 var superString = super.toString();
131 return "_TerminalClientProxyControl($superString)"; 130 return "_TerminalClientProxyControl($superString)";
132 } 131 }
133 } 132 }
134 133
135 134 class TerminalClientProxy
136 class TerminalClientProxy extends bindings.Proxy 135 extends bindings.Proxy
137 implements TerminalClient { 136 implements TerminalClient {
138 TerminalClientProxy.fromEndpoint( 137 TerminalClientProxy.fromEndpoint(
139 core.MojoMessagePipeEndpoint endpoint) 138 core.MojoMessagePipeEndpoint endpoint)
140 : super(new _TerminalClientProxyControl.fromEndpoint(endpoint)); 139 : super(new _TerminalClientProxyControl.fromEndpoint(endpoint));
141 140
142 TerminalClientProxy.fromHandle(core.MojoHandle handle) 141 TerminalClientProxy.fromHandle(core.MojoHandle handle)
143 : super(new _TerminalClientProxyControl.fromHandle(handle)); 142 : super(new _TerminalClientProxyControl.fromHandle(handle));
144 143
145 TerminalClientProxy.unbound() 144 TerminalClientProxy.unbound()
146 : super(new _TerminalClientProxyControl.unbound()); 145 : super(new _TerminalClientProxyControl.unbound());
147 146
(...skipping 16 matching lines...) Expand all
164 ctrl.proxyError("The Proxy is closed."); 163 ctrl.proxyError("The Proxy is closed.");
165 return; 164 return;
166 } 165 }
167 var params = new _TerminalClientConnectToTerminalParams(); 166 var params = new _TerminalClientConnectToTerminalParams();
168 params.terminal = terminal; 167 params.terminal = terminal;
169 ctrl.sendMessage(params, 168 ctrl.sendMessage(params,
170 _terminalClientMethodConnectToTerminalName); 169 _terminalClientMethodConnectToTerminalName);
171 } 170 }
172 } 171 }
173 172
174 173 class _TerminalClientStubControl
175 class TerminalClientStub extends bindings.Stub { 174 extends bindings.StubMessageHandler
175 implements bindings.StubControl<TerminalClient> {
176 TerminalClient _impl; 176 TerminalClient _impl;
177 177
178 TerminalClientStub.fromEndpoint( 178 _TerminalClientStubControl.fromEndpoint(
179 core.MojoMessagePipeEndpoint endpoint, [TerminalClient impl]) 179 core.MojoMessagePipeEndpoint endpoint, [TerminalClient impl])
180 : super.fromEndpoint(endpoint, autoBegin: impl != null) { 180 : super.fromEndpoint(endpoint, autoBegin: impl != null) {
181 _impl = impl; 181 _impl = impl;
182 } 182 }
183 183
184 TerminalClientStub.fromHandle( 184 _TerminalClientStubControl.fromHandle(
185 core.MojoHandle handle, [TerminalClient impl]) 185 core.MojoHandle handle, [TerminalClient impl])
186 : super.fromHandle(handle, autoBegin: impl != null) { 186 : super.fromHandle(handle, autoBegin: impl != null) {
187 _impl = impl; 187 _impl = impl;
188 } 188 }
189 189
190 TerminalClientStub.unbound([this._impl]) : super.unbound(); 190 _TerminalClientStubControl.unbound([this._impl]) : super.unbound();
191
192 static TerminalClientStub newFromEndpoint(
193 core.MojoMessagePipeEndpoint endpoint) {
194 assert(endpoint.setDescription("For TerminalClientStub"));
195 return new TerminalClientStub.fromEndpoint(endpoint);
196 }
197 191
198 192
199 193
200 dynamic handleMessage(bindings.ServiceMessage message) { 194 dynamic handleMessage(bindings.ServiceMessage message) {
201 if (bindings.ControlMessageHandler.isControlMessage(message)) { 195 if (bindings.ControlMessageHandler.isControlMessage(message)) {
202 return bindings.ControlMessageHandler.handleMessage(this, 196 return bindings.ControlMessageHandler.handleMessage(this,
203 0, 197 0,
204 message); 198 message);
205 } 199 }
206 if (_impl == null) { 200 if (_impl == null) {
(...skipping 24 matching lines...) Expand all
231 } 225 }
232 226
233 @override 227 @override
234 void bind(core.MojoMessagePipeEndpoint endpoint) { 228 void bind(core.MojoMessagePipeEndpoint endpoint) {
235 super.bind(endpoint); 229 super.bind(endpoint);
236 if (!isOpen && (_impl != null)) { 230 if (!isOpen && (_impl != null)) {
237 beginHandlingEvents(); 231 beginHandlingEvents();
238 } 232 }
239 } 233 }
240 234
235 @override
241 String toString() { 236 String toString() {
242 var superString = super.toString(); 237 var superString = super.toString();
243 return "TerminalClientStub($superString)"; 238 return "_TerminalClientStubControl($superString)";
244 } 239 }
245 240
246 int get version => 0; 241 int get version => 0;
247 242
248 static service_describer.ServiceDescription _cachedServiceDescription; 243 static service_describer.ServiceDescription _cachedServiceDescription;
249 static service_describer.ServiceDescription get serviceDescription { 244 static service_describer.ServiceDescription get serviceDescription {
250 if (_cachedServiceDescription == null) { 245 if (_cachedServiceDescription == null) {
251 _cachedServiceDescription = new _TerminalClientServiceDescription(); 246 _cachedServiceDescription = new _TerminalClientServiceDescription();
252 } 247 }
253 return _cachedServiceDescription; 248 return _cachedServiceDescription;
254 } 249 }
255 } 250 }
256 251
252 class TerminalClientStub
253 extends bindings.Stub<TerminalClient>
254 implements TerminalClient {
255 TerminalClientStub.fromEndpoint(
256 core.MojoMessagePipeEndpoint endpoint, [TerminalClient impl])
257 : super(new _TerminalClientStubControl.fromEndpoint(endpoint, impl));
258
259 TerminalClientStub.fromHandle(
260 core.MojoHandle handle, [TerminalClient impl])
261 : super(new _TerminalClientStubControl.fromHandle(handle, impl));
262
263 TerminalClientStub.unbound([TerminalClient impl])
264 : super(new _TerminalClientStubControl.unbound(impl));
265
266 static TerminalClientStub newFromEndpoint(
267 core.MojoMessagePipeEndpoint endpoint) {
268 assert(endpoint.setDescription("For TerminalClientStub"));
269 return new TerminalClientStub.fromEndpoint(endpoint);
270 }
271
272 static service_describer.ServiceDescription get serviceDescription =>
273 _TerminalClientStubControl.serviceDescription;
274
275
276 void connectToTerminal(Object terminal) {
277 return impl.connectToTerminal(terminal);
278 }
279 }
280
257 281
258 282
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698