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

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

Issue 1449203002: Check in generated Dart bindings and add presubmit script (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 1 month 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
(Empty)
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
3 // found in the LICENSE file.
4
5 library input_mojom;
6
7 import 'dart:async';
8
9 import 'package:mojo/bindings.dart' as bindings;
10 import 'package:mojo/core.dart' as core;
11
12
13
14 class InputClientOnBackButtonParams extends bindings.Struct {
15 static const List<bindings.StructDataHeader> kVersions = const [
16 const bindings.StructDataHeader(8, 0)
17 ];
18
19 InputClientOnBackButtonParams() : super(kVersions.last.size);
20
21 static InputClientOnBackButtonParams deserialize(bindings.Message message) {
22 var decoder = new bindings.Decoder(message);
23 var result = decode(decoder);
24 if (decoder.excessHandles != null) {
25 decoder.excessHandles.forEach((h) => h.close());
26 }
27 return result;
28 }
29
30 static InputClientOnBackButtonParams decode(bindings.Decoder decoder0) {
31 if (decoder0 == null) {
32 return null;
33 }
34 InputClientOnBackButtonParams result = new InputClientOnBackButtonParams();
35
36 var mainDataHeader = decoder0.decodeStructDataHeader();
37 if (mainDataHeader.version <= kVersions.last.version) {
38 // Scan in reverse order to optimize for more recent versions.
39 for (int i = kVersions.length - 1; i >= 0; --i) {
40 if (mainDataHeader.version >= kVersions[i].version) {
41 if (mainDataHeader.size == kVersions[i].size) {
42 // Found a match.
43 break;
44 }
45 throw new bindings.MojoCodecError(
46 'Header size doesn\'t correspond to known version size.');
47 }
48 }
49 } else if (mainDataHeader.size < kVersions.last.size) {
50 throw new bindings.MojoCodecError(
51 'Message newer than the last known version cannot be shorter than '
52 'required by the last known version.');
53 }
54 return result;
55 }
56
57 void encode(bindings.Encoder encoder) {
58 encoder.getStructEncoderAtOffset(kVersions.last);
59 }
60
61 String toString() {
62 return "InputClientOnBackButtonParams("")";
63 }
64
65 Map toJson() {
66 Map map = new Map();
67 return map;
68 }
69 }
70
71
72 class InputClientOnBackButtonResponseParams extends bindings.Struct {
73 static const List<bindings.StructDataHeader> kVersions = const [
74 const bindings.StructDataHeader(8, 0)
75 ];
76
77 InputClientOnBackButtonResponseParams() : super(kVersions.last.size);
78
79 static InputClientOnBackButtonResponseParams deserialize(bindings.Message mess age) {
80 var decoder = new bindings.Decoder(message);
81 var result = decode(decoder);
82 if (decoder.excessHandles != null) {
83 decoder.excessHandles.forEach((h) => h.close());
84 }
85 return result;
86 }
87
88 static InputClientOnBackButtonResponseParams decode(bindings.Decoder decoder0) {
89 if (decoder0 == null) {
90 return null;
91 }
92 InputClientOnBackButtonResponseParams result = new InputClientOnBackButtonRe sponseParams();
93
94 var mainDataHeader = decoder0.decodeStructDataHeader();
95 if (mainDataHeader.version <= kVersions.last.version) {
96 // Scan in reverse order to optimize for more recent versions.
97 for (int i = kVersions.length - 1; i >= 0; --i) {
98 if (mainDataHeader.version >= kVersions[i].version) {
99 if (mainDataHeader.size == kVersions[i].size) {
100 // Found a match.
101 break;
102 }
103 throw new bindings.MojoCodecError(
104 'Header size doesn\'t correspond to known version size.');
105 }
106 }
107 } else if (mainDataHeader.size < kVersions.last.size) {
108 throw new bindings.MojoCodecError(
109 'Message newer than the last known version cannot be shorter than '
110 'required by the last known version.');
111 }
112 return result;
113 }
114
115 void encode(bindings.Encoder encoder) {
116 encoder.getStructEncoderAtOffset(kVersions.last);
117 }
118
119 String toString() {
120 return "InputClientOnBackButtonResponseParams("")";
121 }
122
123 Map toJson() {
124 Map map = new Map();
125 return map;
126 }
127 }
128
129
130 class InputServiceSetClientParams extends bindings.Struct {
131 static const List<bindings.StructDataHeader> kVersions = const [
132 const bindings.StructDataHeader(16, 0)
133 ];
134 Object client = null;
135
136 InputServiceSetClientParams() : super(kVersions.last.size);
137
138 static InputServiceSetClientParams deserialize(bindings.Message message) {
139 var decoder = new bindings.Decoder(message);
140 var result = decode(decoder);
141 if (decoder.excessHandles != null) {
142 decoder.excessHandles.forEach((h) => h.close());
143 }
144 return result;
145 }
146
147 static InputServiceSetClientParams decode(bindings.Decoder decoder0) {
148 if (decoder0 == null) {
149 return null;
150 }
151 InputServiceSetClientParams result = new InputServiceSetClientParams();
152
153 var mainDataHeader = decoder0.decodeStructDataHeader();
154 if (mainDataHeader.version <= kVersions.last.version) {
155 // Scan in reverse order to optimize for more recent versions.
156 for (int i = kVersions.length - 1; i >= 0; --i) {
157 if (mainDataHeader.version >= kVersions[i].version) {
158 if (mainDataHeader.size == kVersions[i].size) {
159 // Found a match.
160 break;
161 }
162 throw new bindings.MojoCodecError(
163 'Header size doesn\'t correspond to known version size.');
164 }
165 }
166 } else if (mainDataHeader.size < kVersions.last.size) {
167 throw new bindings.MojoCodecError(
168 'Message newer than the last known version cannot be shorter than '
169 'required by the last known version.');
170 }
171 if (mainDataHeader.version >= 0) {
172
173 result.client = decoder0.decodeServiceInterface(8, false, InputClientProxy .newFromEndpoint);
174 }
175 return result;
176 }
177
178 void encode(bindings.Encoder encoder) {
179 var encoder0 = encoder.getStructEncoderAtOffset(kVersions.last);
180
181 encoder0.encodeInterface(client, 8, false);
182 }
183
184 String toString() {
185 return "InputServiceSetClientParams("
186 "client: $client" ")";
187 }
188
189 Map toJson() {
190 throw new bindings.MojoCodecError(
191 'Object containing handles cannot be encoded to JSON.');
192 }
193 }
194
195 const int kInputClient_onBackButton_name = 0;
196
197 const String InputClientName =
198 'input::InputClient';
199
200 abstract class InputClient {
201 dynamic onBackButton([Function responseFactory = null]);
202
203 }
204
205
206 class InputClientProxyImpl extends bindings.Proxy {
207 InputClientProxyImpl.fromEndpoint(
208 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint);
209
210 InputClientProxyImpl.fromHandle(core.MojoHandle handle) :
211 super.fromHandle(handle);
212
213 InputClientProxyImpl.unbound() : super.unbound();
214
215 static InputClientProxyImpl newFromEndpoint(
216 core.MojoMessagePipeEndpoint endpoint) {
217 assert(endpoint.setDescription("For InputClientProxyImpl"));
218 return new InputClientProxyImpl.fromEndpoint(endpoint);
219 }
220
221 String get name => InputClientName;
222
223 void handleResponse(bindings.ServiceMessage message) {
224 switch (message.header.type) {
225 case kInputClient_onBackButton_name:
226 var r = InputClientOnBackButtonResponseParams.deserialize(
227 message.payload);
228 if (!message.header.hasRequestId) {
229 proxyError("Expected a message with a valid request Id.");
230 return;
231 }
232 Completer c = completerMap[message.header.requestId];
233 if (c == null) {
234 proxyError(
235 "Message had unknown request Id: ${message.header.requestId}");
236 return;
237 }
238 completerMap.remove(message.header.requestId);
239 if (c.isCompleted) {
240 proxyError("Response completer already completed");
241 return;
242 }
243 c.complete(r);
244 break;
245 default:
246 proxyError("Unexpected message type: ${message.header.type}");
247 close(immediate: true);
248 break;
249 }
250 }
251
252 String toString() {
253 var superString = super.toString();
254 return "InputClientProxyImpl($superString)";
255 }
256 }
257
258
259 class _InputClientProxyCalls implements InputClient {
260 InputClientProxyImpl _proxyImpl;
261
262 _InputClientProxyCalls(this._proxyImpl);
263 dynamic onBackButton([Function responseFactory = null]) {
264 var params = new InputClientOnBackButtonParams();
265 return _proxyImpl.sendMessageWithRequestId(
266 params,
267 kInputClient_onBackButton_name,
268 -1,
269 bindings.MessageHeader.kMessageExpectsResponse);
270 }
271 }
272
273
274 class InputClientProxy implements bindings.ProxyBase {
275 final bindings.Proxy impl;
276 InputClient ptr;
277 final String name = InputClientName;
278
279 InputClientProxy(InputClientProxyImpl proxyImpl) :
280 impl = proxyImpl,
281 ptr = new _InputClientProxyCalls(proxyImpl);
282
283 InputClientProxy.fromEndpoint(
284 core.MojoMessagePipeEndpoint endpoint) :
285 impl = new InputClientProxyImpl.fromEndpoint(endpoint) {
286 ptr = new _InputClientProxyCalls(impl);
287 }
288
289 InputClientProxy.fromHandle(core.MojoHandle handle) :
290 impl = new InputClientProxyImpl.fromHandle(handle) {
291 ptr = new _InputClientProxyCalls(impl);
292 }
293
294 InputClientProxy.unbound() :
295 impl = new InputClientProxyImpl.unbound() {
296 ptr = new _InputClientProxyCalls(impl);
297 }
298
299 factory InputClientProxy.connectToService(
300 bindings.ServiceConnector s, String url) {
301 InputClientProxy p = new InputClientProxy.unbound();
302 s.connectToService(url, p);
303 return p;
304 }
305
306 static InputClientProxy newFromEndpoint(
307 core.MojoMessagePipeEndpoint endpoint) {
308 assert(endpoint.setDescription("For InputClientProxy"));
309 return new InputClientProxy.fromEndpoint(endpoint);
310 }
311
312 Future close({bool immediate: false}) => impl.close(immediate: immediate);
313
314 Future responseOrError(Future f) => impl.responseOrError(f);
315
316 Future get errorFuture => impl.errorFuture;
317
318 int get version => impl.version;
319
320 Future<int> queryVersion() => impl.queryVersion();
321
322 void requireVersion(int requiredVersion) {
323 impl.requireVersion(requiredVersion);
324 }
325
326 String toString() {
327 return "InputClientProxy($impl)";
328 }
329 }
330
331
332 class InputClientStub extends bindings.Stub {
333 InputClient _impl = null;
334
335 InputClientStub.fromEndpoint(
336 core.MojoMessagePipeEndpoint endpoint, [this._impl])
337 : super.fromEndpoint(endpoint);
338
339 InputClientStub.fromHandle(core.MojoHandle handle, [this._impl])
340 : super.fromHandle(handle);
341
342 InputClientStub.unbound() : super.unbound();
343
344 static InputClientStub newFromEndpoint(
345 core.MojoMessagePipeEndpoint endpoint) {
346 assert(endpoint.setDescription("For InputClientStub"));
347 return new InputClientStub.fromEndpoint(endpoint);
348 }
349
350 static const String name = InputClientName;
351
352
353 InputClientOnBackButtonResponseParams _InputClientOnBackButtonResponseParamsFa ctory() {
354 var result = new InputClientOnBackButtonResponseParams();
355 return result;
356 }
357
358 dynamic handleMessage(bindings.ServiceMessage message) {
359 if (bindings.ControlMessageHandler.isControlMessage(message)) {
360 return bindings.ControlMessageHandler.handleMessage(this,
361 0,
362 message);
363 }
364 assert(_impl != null);
365 switch (message.header.type) {
366 case kInputClient_onBackButton_name:
367 var params = InputClientOnBackButtonParams.deserialize(
368 message.payload);
369 var response = _impl.onBackButton(_InputClientOnBackButtonResponseParams Factory);
370 if (response is Future) {
371 return response.then((response) {
372 if (response != null) {
373 return buildResponseWithId(
374 response,
375 kInputClient_onBackButton_name,
376 message.header.requestId,
377 bindings.MessageHeader.kMessageIsResponse);
378 }
379 });
380 } else if (response != null) {
381 return buildResponseWithId(
382 response,
383 kInputClient_onBackButton_name,
384 message.header.requestId,
385 bindings.MessageHeader.kMessageIsResponse);
386 }
387 break;
388 default:
389 throw new bindings.MojoCodecError("Unexpected message name");
390 break;
391 }
392 return null;
393 }
394
395 InputClient get impl => _impl;
396 set impl(InputClient d) {
397 assert(_impl == null);
398 _impl = d;
399 }
400
401 String toString() {
402 var superString = super.toString();
403 return "InputClientStub($superString)";
404 }
405
406 int get version => 0;
407 }
408
409 const int kInputService_setClient_name = 0;
410
411 const String InputServiceName =
412 'input::InputService';
413
414 abstract class InputService {
415 void setClient(Object client);
416
417 }
418
419
420 class InputServiceProxyImpl extends bindings.Proxy {
421 InputServiceProxyImpl.fromEndpoint(
422 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint);
423
424 InputServiceProxyImpl.fromHandle(core.MojoHandle handle) :
425 super.fromHandle(handle);
426
427 InputServiceProxyImpl.unbound() : super.unbound();
428
429 static InputServiceProxyImpl newFromEndpoint(
430 core.MojoMessagePipeEndpoint endpoint) {
431 assert(endpoint.setDescription("For InputServiceProxyImpl"));
432 return new InputServiceProxyImpl.fromEndpoint(endpoint);
433 }
434
435 String get name => InputServiceName;
436
437 void handleResponse(bindings.ServiceMessage message) {
438 switch (message.header.type) {
439 default:
440 proxyError("Unexpected message type: ${message.header.type}");
441 close(immediate: true);
442 break;
443 }
444 }
445
446 String toString() {
447 var superString = super.toString();
448 return "InputServiceProxyImpl($superString)";
449 }
450 }
451
452
453 class _InputServiceProxyCalls implements InputService {
454 InputServiceProxyImpl _proxyImpl;
455
456 _InputServiceProxyCalls(this._proxyImpl);
457 void setClient(Object client) {
458 if (!_proxyImpl.isBound) {
459 _proxyImpl.proxyError("The Proxy is closed.");
460 return;
461 }
462 var params = new InputServiceSetClientParams();
463 params.client = client;
464 _proxyImpl.sendMessage(params, kInputService_setClient_name);
465 }
466
467 }
468
469
470 class InputServiceProxy implements bindings.ProxyBase {
471 final bindings.Proxy impl;
472 InputService ptr;
473 final String name = InputServiceName;
474
475 InputServiceProxy(InputServiceProxyImpl proxyImpl) :
476 impl = proxyImpl,
477 ptr = new _InputServiceProxyCalls(proxyImpl);
478
479 InputServiceProxy.fromEndpoint(
480 core.MojoMessagePipeEndpoint endpoint) :
481 impl = new InputServiceProxyImpl.fromEndpoint(endpoint) {
482 ptr = new _InputServiceProxyCalls(impl);
483 }
484
485 InputServiceProxy.fromHandle(core.MojoHandle handle) :
486 impl = new InputServiceProxyImpl.fromHandle(handle) {
487 ptr = new _InputServiceProxyCalls(impl);
488 }
489
490 InputServiceProxy.unbound() :
491 impl = new InputServiceProxyImpl.unbound() {
492 ptr = new _InputServiceProxyCalls(impl);
493 }
494
495 factory InputServiceProxy.connectToService(
496 bindings.ServiceConnector s, String url) {
497 InputServiceProxy p = new InputServiceProxy.unbound();
498 s.connectToService(url, p);
499 return p;
500 }
501
502 static InputServiceProxy newFromEndpoint(
503 core.MojoMessagePipeEndpoint endpoint) {
504 assert(endpoint.setDescription("For InputServiceProxy"));
505 return new InputServiceProxy.fromEndpoint(endpoint);
506 }
507
508 Future close({bool immediate: false}) => impl.close(immediate: immediate);
509
510 Future responseOrError(Future f) => impl.responseOrError(f);
511
512 Future get errorFuture => impl.errorFuture;
513
514 int get version => impl.version;
515
516 Future<int> queryVersion() => impl.queryVersion();
517
518 void requireVersion(int requiredVersion) {
519 impl.requireVersion(requiredVersion);
520 }
521
522 String toString() {
523 return "InputServiceProxy($impl)";
524 }
525 }
526
527
528 class InputServiceStub extends bindings.Stub {
529 InputService _impl = null;
530
531 InputServiceStub.fromEndpoint(
532 core.MojoMessagePipeEndpoint endpoint, [this._impl])
533 : super.fromEndpoint(endpoint);
534
535 InputServiceStub.fromHandle(core.MojoHandle handle, [this._impl])
536 : super.fromHandle(handle);
537
538 InputServiceStub.unbound() : super.unbound();
539
540 static InputServiceStub newFromEndpoint(
541 core.MojoMessagePipeEndpoint endpoint) {
542 assert(endpoint.setDescription("For InputServiceStub"));
543 return new InputServiceStub.fromEndpoint(endpoint);
544 }
545
546 static const String name = InputServiceName;
547
548
549
550 dynamic handleMessage(bindings.ServiceMessage message) {
551 if (bindings.ControlMessageHandler.isControlMessage(message)) {
552 return bindings.ControlMessageHandler.handleMessage(this,
553 0,
554 message);
555 }
556 assert(_impl != null);
557 switch (message.header.type) {
558 case kInputService_setClient_name:
559 var params = InputServiceSetClientParams.deserialize(
560 message.payload);
561 _impl.setClient(params.client);
562 break;
563 default:
564 throw new bindings.MojoCodecError("Unexpected message name");
565 break;
566 }
567 return null;
568 }
569
570 InputService get impl => _impl;
571 set impl(InputService d) {
572 assert(_impl == null);
573 _impl = d;
574 }
575
576 String toString() {
577 var superString = super.toString();
578 return "InputServiceStub($superString)";
579 }
580
581 int get version => 0;
582 }
583
584
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698