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

Side by Side Diff: mojo/dart/packages/mojo_services/lib/keyboard/keyboard.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 keyboard_mojom;
6
7 import 'dart:async';
8
9 import 'package:mojo/bindings.dart' as bindings;
10 import 'package:mojo/core.dart' as core;
11 class SubmitAction extends bindings.MojoEnum {
12 static const DONE = const SubmitAction._(0);
13
14 const SubmitAction._(int v) : super(v);
15
16 static const Map<String, SubmitAction> valuesMap = const {
17 "DONE": DONE,
18 };
19 static const List<SubmitAction> values = const [
20 DONE,
21 ];
22
23 static SubmitAction valueOf(String name) => valuesMap[name];
24
25 factory SubmitAction(int v) {
26 switch (v) {
27 case 0:
28 return DONE;
29 default:
30 return null;
31 }
32 }
33
34 static SubmitAction decode(bindings.Decoder decoder0, int offset) {
35 int v = decoder0.decodeUint32(offset);
36 SubmitAction result = new SubmitAction(v);
37 if (result == null) {
38 throw new bindings.MojoCodecError(
39 'Bad value $v for enum SubmitAction.');
40 }
41 return result;
42 }
43
44 String toString() {
45 switch(this) {
46 case DONE:
47 return 'SubmitAction.DONE';
48 }
49 }
50
51 int toJson() => value;
52 }
53 class KeyboardType extends bindings.MojoEnum {
54 static const TEXT = const KeyboardType._(0);
55 static const NUMBER = const KeyboardType._(1);
56 static const PHONE = const KeyboardType._(2);
57 static const DATETIME = const KeyboardType._(3);
58
59 const KeyboardType._(int v) : super(v);
60
61 static const Map<String, KeyboardType> valuesMap = const {
62 "TEXT": TEXT,
63 "NUMBER": NUMBER,
64 "PHONE": PHONE,
65 "DATETIME": DATETIME,
66 };
67 static const List<KeyboardType> values = const [
68 TEXT,
69 NUMBER,
70 PHONE,
71 DATETIME,
72 ];
73
74 static KeyboardType valueOf(String name) => valuesMap[name];
75
76 factory KeyboardType(int v) {
77 switch (v) {
78 case 0:
79 return TEXT;
80 case 1:
81 return NUMBER;
82 case 2:
83 return PHONE;
84 case 3:
85 return DATETIME;
86 default:
87 return null;
88 }
89 }
90
91 static KeyboardType decode(bindings.Decoder decoder0, int offset) {
92 int v = decoder0.decodeUint32(offset);
93 KeyboardType result = new KeyboardType(v);
94 if (result == null) {
95 throw new bindings.MojoCodecError(
96 'Bad value $v for enum KeyboardType.');
97 }
98 return result;
99 }
100
101 String toString() {
102 switch(this) {
103 case TEXT:
104 return 'KeyboardType.TEXT';
105 case NUMBER:
106 return 'KeyboardType.NUMBER';
107 case PHONE:
108 return 'KeyboardType.PHONE';
109 case DATETIME:
110 return 'KeyboardType.DATETIME';
111 }
112 }
113
114 int toJson() => value;
115 }
116
117
118
119 class CompletionData extends bindings.Struct {
120 static const List<bindings.StructDataHeader> kVersions = const [
121 const bindings.StructDataHeader(40, 0)
122 ];
123 int id = 0;
124 int position = 0;
125 String text = null;
126 String label = null;
127
128 CompletionData() : super(kVersions.last.size);
129
130 static CompletionData deserialize(bindings.Message message) {
131 var decoder = new bindings.Decoder(message);
132 var result = decode(decoder);
133 if (decoder.excessHandles != null) {
134 decoder.excessHandles.forEach((h) => h.close());
135 }
136 return result;
137 }
138
139 static CompletionData decode(bindings.Decoder decoder0) {
140 if (decoder0 == null) {
141 return null;
142 }
143 CompletionData result = new CompletionData();
144
145 var mainDataHeader = decoder0.decodeStructDataHeader();
146 if (mainDataHeader.version <= kVersions.last.version) {
147 // Scan in reverse order to optimize for more recent versions.
148 for (int i = kVersions.length - 1; i >= 0; --i) {
149 if (mainDataHeader.version >= kVersions[i].version) {
150 if (mainDataHeader.size == kVersions[i].size) {
151 // Found a match.
152 break;
153 }
154 throw new bindings.MojoCodecError(
155 'Header size doesn\'t correspond to known version size.');
156 }
157 }
158 } else if (mainDataHeader.size < kVersions.last.size) {
159 throw new bindings.MojoCodecError(
160 'Message newer than the last known version cannot be shorter than '
161 'required by the last known version.');
162 }
163 if (mainDataHeader.version >= 0) {
164
165 result.id = decoder0.decodeInt64(8);
166 }
167 if (mainDataHeader.version >= 0) {
168
169 result.position = decoder0.decodeInt32(16);
170 }
171 if (mainDataHeader.version >= 0) {
172
173 result.text = decoder0.decodeString(24, false);
174 }
175 if (mainDataHeader.version >= 0) {
176
177 result.label = decoder0.decodeString(32, false);
178 }
179 return result;
180 }
181
182 void encode(bindings.Encoder encoder) {
183 var encoder0 = encoder.getStructEncoderAtOffset(kVersions.last);
184
185 encoder0.encodeInt64(id, 8);
186
187 encoder0.encodeInt32(position, 16);
188
189 encoder0.encodeString(text, 24, false);
190
191 encoder0.encodeString(label, 32, false);
192 }
193
194 String toString() {
195 return "CompletionData("
196 "id: $id" ", "
197 "position: $position" ", "
198 "text: $text" ", "
199 "label: $label" ")";
200 }
201
202 Map toJson() {
203 Map map = new Map();
204 map["id"] = id;
205 map["position"] = position;
206 map["text"] = text;
207 map["label"] = label;
208 return map;
209 }
210 }
211
212
213 class CorrectionData extends bindings.Struct {
214 static const List<bindings.StructDataHeader> kVersions = const [
215 const bindings.StructDataHeader(32, 0)
216 ];
217 int offset = 0;
218 String oldText = null;
219 String newText = null;
220
221 CorrectionData() : super(kVersions.last.size);
222
223 static CorrectionData deserialize(bindings.Message message) {
224 var decoder = new bindings.Decoder(message);
225 var result = decode(decoder);
226 if (decoder.excessHandles != null) {
227 decoder.excessHandles.forEach((h) => h.close());
228 }
229 return result;
230 }
231
232 static CorrectionData decode(bindings.Decoder decoder0) {
233 if (decoder0 == null) {
234 return null;
235 }
236 CorrectionData result = new CorrectionData();
237
238 var mainDataHeader = decoder0.decodeStructDataHeader();
239 if (mainDataHeader.version <= kVersions.last.version) {
240 // Scan in reverse order to optimize for more recent versions.
241 for (int i = kVersions.length - 1; i >= 0; --i) {
242 if (mainDataHeader.version >= kVersions[i].version) {
243 if (mainDataHeader.size == kVersions[i].size) {
244 // Found a match.
245 break;
246 }
247 throw new bindings.MojoCodecError(
248 'Header size doesn\'t correspond to known version size.');
249 }
250 }
251 } else if (mainDataHeader.size < kVersions.last.size) {
252 throw new bindings.MojoCodecError(
253 'Message newer than the last known version cannot be shorter than '
254 'required by the last known version.');
255 }
256 if (mainDataHeader.version >= 0) {
257
258 result.offset = decoder0.decodeInt32(8);
259 }
260 if (mainDataHeader.version >= 0) {
261
262 result.oldText = decoder0.decodeString(16, false);
263 }
264 if (mainDataHeader.version >= 0) {
265
266 result.newText = decoder0.decodeString(24, false);
267 }
268 return result;
269 }
270
271 void encode(bindings.Encoder encoder) {
272 var encoder0 = encoder.getStructEncoderAtOffset(kVersions.last);
273
274 encoder0.encodeInt32(offset, 8);
275
276 encoder0.encodeString(oldText, 16, false);
277
278 encoder0.encodeString(newText, 24, false);
279 }
280
281 String toString() {
282 return "CorrectionData("
283 "offset: $offset" ", "
284 "oldText: $oldText" ", "
285 "newText: $newText" ")";
286 }
287
288 Map toJson() {
289 Map map = new Map();
290 map["offset"] = offset;
291 map["oldText"] = oldText;
292 map["newText"] = newText;
293 return map;
294 }
295 }
296
297
298 class KeyboardClientCommitCompletionParams extends bindings.Struct {
299 static const List<bindings.StructDataHeader> kVersions = const [
300 const bindings.StructDataHeader(16, 0)
301 ];
302 CompletionData completion = null;
303
304 KeyboardClientCommitCompletionParams() : super(kVersions.last.size);
305
306 static KeyboardClientCommitCompletionParams deserialize(bindings.Message messa ge) {
307 var decoder = new bindings.Decoder(message);
308 var result = decode(decoder);
309 if (decoder.excessHandles != null) {
310 decoder.excessHandles.forEach((h) => h.close());
311 }
312 return result;
313 }
314
315 static KeyboardClientCommitCompletionParams decode(bindings.Decoder decoder0) {
316 if (decoder0 == null) {
317 return null;
318 }
319 KeyboardClientCommitCompletionParams result = new KeyboardClientCommitComple tionParams();
320
321 var mainDataHeader = decoder0.decodeStructDataHeader();
322 if (mainDataHeader.version <= kVersions.last.version) {
323 // Scan in reverse order to optimize for more recent versions.
324 for (int i = kVersions.length - 1; i >= 0; --i) {
325 if (mainDataHeader.version >= kVersions[i].version) {
326 if (mainDataHeader.size == kVersions[i].size) {
327 // Found a match.
328 break;
329 }
330 throw new bindings.MojoCodecError(
331 'Header size doesn\'t correspond to known version size.');
332 }
333 }
334 } else if (mainDataHeader.size < kVersions.last.size) {
335 throw new bindings.MojoCodecError(
336 'Message newer than the last known version cannot be shorter than '
337 'required by the last known version.');
338 }
339 if (mainDataHeader.version >= 0) {
340
341 var decoder1 = decoder0.decodePointer(8, false);
342 result.completion = CompletionData.decode(decoder1);
343 }
344 return result;
345 }
346
347 void encode(bindings.Encoder encoder) {
348 var encoder0 = encoder.getStructEncoderAtOffset(kVersions.last);
349
350 encoder0.encodeStruct(completion, 8, false);
351 }
352
353 String toString() {
354 return "KeyboardClientCommitCompletionParams("
355 "completion: $completion" ")";
356 }
357
358 Map toJson() {
359 Map map = new Map();
360 map["completion"] = completion;
361 return map;
362 }
363 }
364
365
366 class KeyboardClientCommitCorrectionParams extends bindings.Struct {
367 static const List<bindings.StructDataHeader> kVersions = const [
368 const bindings.StructDataHeader(16, 0)
369 ];
370 CorrectionData correction = null;
371
372 KeyboardClientCommitCorrectionParams() : super(kVersions.last.size);
373
374 static KeyboardClientCommitCorrectionParams deserialize(bindings.Message messa ge) {
375 var decoder = new bindings.Decoder(message);
376 var result = decode(decoder);
377 if (decoder.excessHandles != null) {
378 decoder.excessHandles.forEach((h) => h.close());
379 }
380 return result;
381 }
382
383 static KeyboardClientCommitCorrectionParams decode(bindings.Decoder decoder0) {
384 if (decoder0 == null) {
385 return null;
386 }
387 KeyboardClientCommitCorrectionParams result = new KeyboardClientCommitCorrec tionParams();
388
389 var mainDataHeader = decoder0.decodeStructDataHeader();
390 if (mainDataHeader.version <= kVersions.last.version) {
391 // Scan in reverse order to optimize for more recent versions.
392 for (int i = kVersions.length - 1; i >= 0; --i) {
393 if (mainDataHeader.version >= kVersions[i].version) {
394 if (mainDataHeader.size == kVersions[i].size) {
395 // Found a match.
396 break;
397 }
398 throw new bindings.MojoCodecError(
399 'Header size doesn\'t correspond to known version size.');
400 }
401 }
402 } else if (mainDataHeader.size < kVersions.last.size) {
403 throw new bindings.MojoCodecError(
404 'Message newer than the last known version cannot be shorter than '
405 'required by the last known version.');
406 }
407 if (mainDataHeader.version >= 0) {
408
409 var decoder1 = decoder0.decodePointer(8, false);
410 result.correction = CorrectionData.decode(decoder1);
411 }
412 return result;
413 }
414
415 void encode(bindings.Encoder encoder) {
416 var encoder0 = encoder.getStructEncoderAtOffset(kVersions.last);
417
418 encoder0.encodeStruct(correction, 8, false);
419 }
420
421 String toString() {
422 return "KeyboardClientCommitCorrectionParams("
423 "correction: $correction" ")";
424 }
425
426 Map toJson() {
427 Map map = new Map();
428 map["correction"] = correction;
429 return map;
430 }
431 }
432
433
434 class KeyboardClientCommitTextParams extends bindings.Struct {
435 static const List<bindings.StructDataHeader> kVersions = const [
436 const bindings.StructDataHeader(24, 0)
437 ];
438 String text = null;
439 int newCursorPosition = 0;
440
441 KeyboardClientCommitTextParams() : super(kVersions.last.size);
442
443 static KeyboardClientCommitTextParams deserialize(bindings.Message message) {
444 var decoder = new bindings.Decoder(message);
445 var result = decode(decoder);
446 if (decoder.excessHandles != null) {
447 decoder.excessHandles.forEach((h) => h.close());
448 }
449 return result;
450 }
451
452 static KeyboardClientCommitTextParams decode(bindings.Decoder decoder0) {
453 if (decoder0 == null) {
454 return null;
455 }
456 KeyboardClientCommitTextParams result = new KeyboardClientCommitTextParams() ;
457
458 var mainDataHeader = decoder0.decodeStructDataHeader();
459 if (mainDataHeader.version <= kVersions.last.version) {
460 // Scan in reverse order to optimize for more recent versions.
461 for (int i = kVersions.length - 1; i >= 0; --i) {
462 if (mainDataHeader.version >= kVersions[i].version) {
463 if (mainDataHeader.size == kVersions[i].size) {
464 // Found a match.
465 break;
466 }
467 throw new bindings.MojoCodecError(
468 'Header size doesn\'t correspond to known version size.');
469 }
470 }
471 } else if (mainDataHeader.size < kVersions.last.size) {
472 throw new bindings.MojoCodecError(
473 'Message newer than the last known version cannot be shorter than '
474 'required by the last known version.');
475 }
476 if (mainDataHeader.version >= 0) {
477
478 result.text = decoder0.decodeString(8, false);
479 }
480 if (mainDataHeader.version >= 0) {
481
482 result.newCursorPosition = decoder0.decodeInt32(16);
483 }
484 return result;
485 }
486
487 void encode(bindings.Encoder encoder) {
488 var encoder0 = encoder.getStructEncoderAtOffset(kVersions.last);
489
490 encoder0.encodeString(text, 8, false);
491
492 encoder0.encodeInt32(newCursorPosition, 16);
493 }
494
495 String toString() {
496 return "KeyboardClientCommitTextParams("
497 "text: $text" ", "
498 "newCursorPosition: $newCursorPosition" ")";
499 }
500
501 Map toJson() {
502 Map map = new Map();
503 map["text"] = text;
504 map["newCursorPosition"] = newCursorPosition;
505 return map;
506 }
507 }
508
509
510 class KeyboardClientDeleteSurroundingTextParams extends bindings.Struct {
511 static const List<bindings.StructDataHeader> kVersions = const [
512 const bindings.StructDataHeader(16, 0)
513 ];
514 int beforeLength = 0;
515 int afterLength = 0;
516
517 KeyboardClientDeleteSurroundingTextParams() : super(kVersions.last.size);
518
519 static KeyboardClientDeleteSurroundingTextParams deserialize(bindings.Message message) {
520 var decoder = new bindings.Decoder(message);
521 var result = decode(decoder);
522 if (decoder.excessHandles != null) {
523 decoder.excessHandles.forEach((h) => h.close());
524 }
525 return result;
526 }
527
528 static KeyboardClientDeleteSurroundingTextParams decode(bindings.Decoder decod er0) {
529 if (decoder0 == null) {
530 return null;
531 }
532 KeyboardClientDeleteSurroundingTextParams result = new KeyboardClientDeleteS urroundingTextParams();
533
534 var mainDataHeader = decoder0.decodeStructDataHeader();
535 if (mainDataHeader.version <= kVersions.last.version) {
536 // Scan in reverse order to optimize for more recent versions.
537 for (int i = kVersions.length - 1; i >= 0; --i) {
538 if (mainDataHeader.version >= kVersions[i].version) {
539 if (mainDataHeader.size == kVersions[i].size) {
540 // Found a match.
541 break;
542 }
543 throw new bindings.MojoCodecError(
544 'Header size doesn\'t correspond to known version size.');
545 }
546 }
547 } else if (mainDataHeader.size < kVersions.last.size) {
548 throw new bindings.MojoCodecError(
549 'Message newer than the last known version cannot be shorter than '
550 'required by the last known version.');
551 }
552 if (mainDataHeader.version >= 0) {
553
554 result.beforeLength = decoder0.decodeInt32(8);
555 }
556 if (mainDataHeader.version >= 0) {
557
558 result.afterLength = decoder0.decodeInt32(12);
559 }
560 return result;
561 }
562
563 void encode(bindings.Encoder encoder) {
564 var encoder0 = encoder.getStructEncoderAtOffset(kVersions.last);
565
566 encoder0.encodeInt32(beforeLength, 8);
567
568 encoder0.encodeInt32(afterLength, 12);
569 }
570
571 String toString() {
572 return "KeyboardClientDeleteSurroundingTextParams("
573 "beforeLength: $beforeLength" ", "
574 "afterLength: $afterLength" ")";
575 }
576
577 Map toJson() {
578 Map map = new Map();
579 map["beforeLength"] = beforeLength;
580 map["afterLength"] = afterLength;
581 return map;
582 }
583 }
584
585
586 class KeyboardClientSetComposingRegionParams extends bindings.Struct {
587 static const List<bindings.StructDataHeader> kVersions = const [
588 const bindings.StructDataHeader(16, 0)
589 ];
590 int start = 0;
591 int end = 0;
592
593 KeyboardClientSetComposingRegionParams() : super(kVersions.last.size);
594
595 static KeyboardClientSetComposingRegionParams deserialize(bindings.Message mes sage) {
596 var decoder = new bindings.Decoder(message);
597 var result = decode(decoder);
598 if (decoder.excessHandles != null) {
599 decoder.excessHandles.forEach((h) => h.close());
600 }
601 return result;
602 }
603
604 static KeyboardClientSetComposingRegionParams decode(bindings.Decoder decoder0 ) {
605 if (decoder0 == null) {
606 return null;
607 }
608 KeyboardClientSetComposingRegionParams result = new KeyboardClientSetComposi ngRegionParams();
609
610 var mainDataHeader = decoder0.decodeStructDataHeader();
611 if (mainDataHeader.version <= kVersions.last.version) {
612 // Scan in reverse order to optimize for more recent versions.
613 for (int i = kVersions.length - 1; i >= 0; --i) {
614 if (mainDataHeader.version >= kVersions[i].version) {
615 if (mainDataHeader.size == kVersions[i].size) {
616 // Found a match.
617 break;
618 }
619 throw new bindings.MojoCodecError(
620 'Header size doesn\'t correspond to known version size.');
621 }
622 }
623 } else if (mainDataHeader.size < kVersions.last.size) {
624 throw new bindings.MojoCodecError(
625 'Message newer than the last known version cannot be shorter than '
626 'required by the last known version.');
627 }
628 if (mainDataHeader.version >= 0) {
629
630 result.start = decoder0.decodeInt32(8);
631 }
632 if (mainDataHeader.version >= 0) {
633
634 result.end = decoder0.decodeInt32(12);
635 }
636 return result;
637 }
638
639 void encode(bindings.Encoder encoder) {
640 var encoder0 = encoder.getStructEncoderAtOffset(kVersions.last);
641
642 encoder0.encodeInt32(start, 8);
643
644 encoder0.encodeInt32(end, 12);
645 }
646
647 String toString() {
648 return "KeyboardClientSetComposingRegionParams("
649 "start: $start" ", "
650 "end: $end" ")";
651 }
652
653 Map toJson() {
654 Map map = new Map();
655 map["start"] = start;
656 map["end"] = end;
657 return map;
658 }
659 }
660
661
662 class KeyboardClientSetComposingTextParams extends bindings.Struct {
663 static const List<bindings.StructDataHeader> kVersions = const [
664 const bindings.StructDataHeader(24, 0)
665 ];
666 String text = null;
667 int newCursorPosition = 0;
668
669 KeyboardClientSetComposingTextParams() : super(kVersions.last.size);
670
671 static KeyboardClientSetComposingTextParams deserialize(bindings.Message messa ge) {
672 var decoder = new bindings.Decoder(message);
673 var result = decode(decoder);
674 if (decoder.excessHandles != null) {
675 decoder.excessHandles.forEach((h) => h.close());
676 }
677 return result;
678 }
679
680 static KeyboardClientSetComposingTextParams decode(bindings.Decoder decoder0) {
681 if (decoder0 == null) {
682 return null;
683 }
684 KeyboardClientSetComposingTextParams result = new KeyboardClientSetComposing TextParams();
685
686 var mainDataHeader = decoder0.decodeStructDataHeader();
687 if (mainDataHeader.version <= kVersions.last.version) {
688 // Scan in reverse order to optimize for more recent versions.
689 for (int i = kVersions.length - 1; i >= 0; --i) {
690 if (mainDataHeader.version >= kVersions[i].version) {
691 if (mainDataHeader.size == kVersions[i].size) {
692 // Found a match.
693 break;
694 }
695 throw new bindings.MojoCodecError(
696 'Header size doesn\'t correspond to known version size.');
697 }
698 }
699 } else if (mainDataHeader.size < kVersions.last.size) {
700 throw new bindings.MojoCodecError(
701 'Message newer than the last known version cannot be shorter than '
702 'required by the last known version.');
703 }
704 if (mainDataHeader.version >= 0) {
705
706 result.text = decoder0.decodeString(8, false);
707 }
708 if (mainDataHeader.version >= 0) {
709
710 result.newCursorPosition = decoder0.decodeInt32(16);
711 }
712 return result;
713 }
714
715 void encode(bindings.Encoder encoder) {
716 var encoder0 = encoder.getStructEncoderAtOffset(kVersions.last);
717
718 encoder0.encodeString(text, 8, false);
719
720 encoder0.encodeInt32(newCursorPosition, 16);
721 }
722
723 String toString() {
724 return "KeyboardClientSetComposingTextParams("
725 "text: $text" ", "
726 "newCursorPosition: $newCursorPosition" ")";
727 }
728
729 Map toJson() {
730 Map map = new Map();
731 map["text"] = text;
732 map["newCursorPosition"] = newCursorPosition;
733 return map;
734 }
735 }
736
737
738 class KeyboardClientSetSelectionParams extends bindings.Struct {
739 static const List<bindings.StructDataHeader> kVersions = const [
740 const bindings.StructDataHeader(16, 0)
741 ];
742 int start = 0;
743 int end = 0;
744
745 KeyboardClientSetSelectionParams() : super(kVersions.last.size);
746
747 static KeyboardClientSetSelectionParams deserialize(bindings.Message message) {
748 var decoder = new bindings.Decoder(message);
749 var result = decode(decoder);
750 if (decoder.excessHandles != null) {
751 decoder.excessHandles.forEach((h) => h.close());
752 }
753 return result;
754 }
755
756 static KeyboardClientSetSelectionParams decode(bindings.Decoder decoder0) {
757 if (decoder0 == null) {
758 return null;
759 }
760 KeyboardClientSetSelectionParams result = new KeyboardClientSetSelectionPara ms();
761
762 var mainDataHeader = decoder0.decodeStructDataHeader();
763 if (mainDataHeader.version <= kVersions.last.version) {
764 // Scan in reverse order to optimize for more recent versions.
765 for (int i = kVersions.length - 1; i >= 0; --i) {
766 if (mainDataHeader.version >= kVersions[i].version) {
767 if (mainDataHeader.size == kVersions[i].size) {
768 // Found a match.
769 break;
770 }
771 throw new bindings.MojoCodecError(
772 'Header size doesn\'t correspond to known version size.');
773 }
774 }
775 } else if (mainDataHeader.size < kVersions.last.size) {
776 throw new bindings.MojoCodecError(
777 'Message newer than the last known version cannot be shorter than '
778 'required by the last known version.');
779 }
780 if (mainDataHeader.version >= 0) {
781
782 result.start = decoder0.decodeInt32(8);
783 }
784 if (mainDataHeader.version >= 0) {
785
786 result.end = decoder0.decodeInt32(12);
787 }
788 return result;
789 }
790
791 void encode(bindings.Encoder encoder) {
792 var encoder0 = encoder.getStructEncoderAtOffset(kVersions.last);
793
794 encoder0.encodeInt32(start, 8);
795
796 encoder0.encodeInt32(end, 12);
797 }
798
799 String toString() {
800 return "KeyboardClientSetSelectionParams("
801 "start: $start" ", "
802 "end: $end" ")";
803 }
804
805 Map toJson() {
806 Map map = new Map();
807 map["start"] = start;
808 map["end"] = end;
809 return map;
810 }
811 }
812
813
814 class KeyboardClientSubmitParams extends bindings.Struct {
815 static const List<bindings.StructDataHeader> kVersions = const [
816 const bindings.StructDataHeader(16, 0)
817 ];
818 SubmitAction action = null;
819
820 KeyboardClientSubmitParams() : super(kVersions.last.size);
821
822 static KeyboardClientSubmitParams deserialize(bindings.Message message) {
823 var decoder = new bindings.Decoder(message);
824 var result = decode(decoder);
825 if (decoder.excessHandles != null) {
826 decoder.excessHandles.forEach((h) => h.close());
827 }
828 return result;
829 }
830
831 static KeyboardClientSubmitParams decode(bindings.Decoder decoder0) {
832 if (decoder0 == null) {
833 return null;
834 }
835 KeyboardClientSubmitParams result = new KeyboardClientSubmitParams();
836
837 var mainDataHeader = decoder0.decodeStructDataHeader();
838 if (mainDataHeader.version <= kVersions.last.version) {
839 // Scan in reverse order to optimize for more recent versions.
840 for (int i = kVersions.length - 1; i >= 0; --i) {
841 if (mainDataHeader.version >= kVersions[i].version) {
842 if (mainDataHeader.size == kVersions[i].size) {
843 // Found a match.
844 break;
845 }
846 throw new bindings.MojoCodecError(
847 'Header size doesn\'t correspond to known version size.');
848 }
849 }
850 } else if (mainDataHeader.size < kVersions.last.size) {
851 throw new bindings.MojoCodecError(
852 'Message newer than the last known version cannot be shorter than '
853 'required by the last known version.');
854 }
855 if (mainDataHeader.version >= 0) {
856
857 result.action = SubmitAction.decode(decoder0, 8);
858 if (result.action == null) {
859 throw new bindings.MojoCodecError(
860 'Trying to decode null union for non-nullable SubmitAction.');
861 }
862 }
863 return result;
864 }
865
866 void encode(bindings.Encoder encoder) {
867 var encoder0 = encoder.getStructEncoderAtOffset(kVersions.last);
868
869 encoder0.encodeEnum(action, 8);
870 }
871
872 String toString() {
873 return "KeyboardClientSubmitParams("
874 "action: $action" ")";
875 }
876
877 Map toJson() {
878 Map map = new Map();
879 map["action"] = action;
880 return map;
881 }
882 }
883
884
885 class KeyboardServiceShowParams extends bindings.Struct {
886 static const List<bindings.StructDataHeader> kVersions = const [
887 const bindings.StructDataHeader(24, 0)
888 ];
889 Object client = null;
890 KeyboardType type = null;
891
892 KeyboardServiceShowParams() : super(kVersions.last.size);
893
894 static KeyboardServiceShowParams deserialize(bindings.Message message) {
895 var decoder = new bindings.Decoder(message);
896 var result = decode(decoder);
897 if (decoder.excessHandles != null) {
898 decoder.excessHandles.forEach((h) => h.close());
899 }
900 return result;
901 }
902
903 static KeyboardServiceShowParams decode(bindings.Decoder decoder0) {
904 if (decoder0 == null) {
905 return null;
906 }
907 KeyboardServiceShowParams result = new KeyboardServiceShowParams();
908
909 var mainDataHeader = decoder0.decodeStructDataHeader();
910 if (mainDataHeader.version <= kVersions.last.version) {
911 // Scan in reverse order to optimize for more recent versions.
912 for (int i = kVersions.length - 1; i >= 0; --i) {
913 if (mainDataHeader.version >= kVersions[i].version) {
914 if (mainDataHeader.size == kVersions[i].size) {
915 // Found a match.
916 break;
917 }
918 throw new bindings.MojoCodecError(
919 'Header size doesn\'t correspond to known version size.');
920 }
921 }
922 } else if (mainDataHeader.size < kVersions.last.size) {
923 throw new bindings.MojoCodecError(
924 'Message newer than the last known version cannot be shorter than '
925 'required by the last known version.');
926 }
927 if (mainDataHeader.version >= 0) {
928
929 result.client = decoder0.decodeServiceInterface(8, false, KeyboardClientPr oxy.newFromEndpoint);
930 }
931 if (mainDataHeader.version >= 0) {
932
933 result.type = KeyboardType.decode(decoder0, 16);
934 if (result.type == null) {
935 throw new bindings.MojoCodecError(
936 'Trying to decode null union for non-nullable KeyboardType.');
937 }
938 }
939 return result;
940 }
941
942 void encode(bindings.Encoder encoder) {
943 var encoder0 = encoder.getStructEncoderAtOffset(kVersions.last);
944
945 encoder0.encodeInterface(client, 8, false);
946
947 encoder0.encodeEnum(type, 16);
948 }
949
950 String toString() {
951 return "KeyboardServiceShowParams("
952 "client: $client" ", "
953 "type: $type" ")";
954 }
955
956 Map toJson() {
957 throw new bindings.MojoCodecError(
958 'Object containing handles cannot be encoded to JSON.');
959 }
960 }
961
962
963 class KeyboardServiceShowByRequestParams extends bindings.Struct {
964 static const List<bindings.StructDataHeader> kVersions = const [
965 const bindings.StructDataHeader(8, 0)
966 ];
967
968 KeyboardServiceShowByRequestParams() : super(kVersions.last.size);
969
970 static KeyboardServiceShowByRequestParams deserialize(bindings.Message message ) {
971 var decoder = new bindings.Decoder(message);
972 var result = decode(decoder);
973 if (decoder.excessHandles != null) {
974 decoder.excessHandles.forEach((h) => h.close());
975 }
976 return result;
977 }
978
979 static KeyboardServiceShowByRequestParams decode(bindings.Decoder decoder0) {
980 if (decoder0 == null) {
981 return null;
982 }
983 KeyboardServiceShowByRequestParams result = new KeyboardServiceShowByRequest Params();
984
985 var mainDataHeader = decoder0.decodeStructDataHeader();
986 if (mainDataHeader.version <= kVersions.last.version) {
987 // Scan in reverse order to optimize for more recent versions.
988 for (int i = kVersions.length - 1; i >= 0; --i) {
989 if (mainDataHeader.version >= kVersions[i].version) {
990 if (mainDataHeader.size == kVersions[i].size) {
991 // Found a match.
992 break;
993 }
994 throw new bindings.MojoCodecError(
995 'Header size doesn\'t correspond to known version size.');
996 }
997 }
998 } else if (mainDataHeader.size < kVersions.last.size) {
999 throw new bindings.MojoCodecError(
1000 'Message newer than the last known version cannot be shorter than '
1001 'required by the last known version.');
1002 }
1003 return result;
1004 }
1005
1006 void encode(bindings.Encoder encoder) {
1007 encoder.getStructEncoderAtOffset(kVersions.last);
1008 }
1009
1010 String toString() {
1011 return "KeyboardServiceShowByRequestParams("")";
1012 }
1013
1014 Map toJson() {
1015 Map map = new Map();
1016 return map;
1017 }
1018 }
1019
1020
1021 class KeyboardServiceHideParams extends bindings.Struct {
1022 static const List<bindings.StructDataHeader> kVersions = const [
1023 const bindings.StructDataHeader(8, 0)
1024 ];
1025
1026 KeyboardServiceHideParams() : super(kVersions.last.size);
1027
1028 static KeyboardServiceHideParams deserialize(bindings.Message message) {
1029 var decoder = new bindings.Decoder(message);
1030 var result = decode(decoder);
1031 if (decoder.excessHandles != null) {
1032 decoder.excessHandles.forEach((h) => h.close());
1033 }
1034 return result;
1035 }
1036
1037 static KeyboardServiceHideParams decode(bindings.Decoder decoder0) {
1038 if (decoder0 == null) {
1039 return null;
1040 }
1041 KeyboardServiceHideParams result = new KeyboardServiceHideParams();
1042
1043 var mainDataHeader = decoder0.decodeStructDataHeader();
1044 if (mainDataHeader.version <= kVersions.last.version) {
1045 // Scan in reverse order to optimize for more recent versions.
1046 for (int i = kVersions.length - 1; i >= 0; --i) {
1047 if (mainDataHeader.version >= kVersions[i].version) {
1048 if (mainDataHeader.size == kVersions[i].size) {
1049 // Found a match.
1050 break;
1051 }
1052 throw new bindings.MojoCodecError(
1053 'Header size doesn\'t correspond to known version size.');
1054 }
1055 }
1056 } else if (mainDataHeader.size < kVersions.last.size) {
1057 throw new bindings.MojoCodecError(
1058 'Message newer than the last known version cannot be shorter than '
1059 'required by the last known version.');
1060 }
1061 return result;
1062 }
1063
1064 void encode(bindings.Encoder encoder) {
1065 encoder.getStructEncoderAtOffset(kVersions.last);
1066 }
1067
1068 String toString() {
1069 return "KeyboardServiceHideParams("")";
1070 }
1071
1072 Map toJson() {
1073 Map map = new Map();
1074 return map;
1075 }
1076 }
1077
1078
1079 class KeyboardServiceSetTextParams extends bindings.Struct {
1080 static const List<bindings.StructDataHeader> kVersions = const [
1081 const bindings.StructDataHeader(16, 0)
1082 ];
1083 String text = null;
1084
1085 KeyboardServiceSetTextParams() : super(kVersions.last.size);
1086
1087 static KeyboardServiceSetTextParams deserialize(bindings.Message message) {
1088 var decoder = new bindings.Decoder(message);
1089 var result = decode(decoder);
1090 if (decoder.excessHandles != null) {
1091 decoder.excessHandles.forEach((h) => h.close());
1092 }
1093 return result;
1094 }
1095
1096 static KeyboardServiceSetTextParams decode(bindings.Decoder decoder0) {
1097 if (decoder0 == null) {
1098 return null;
1099 }
1100 KeyboardServiceSetTextParams result = new KeyboardServiceSetTextParams();
1101
1102 var mainDataHeader = decoder0.decodeStructDataHeader();
1103 if (mainDataHeader.version <= kVersions.last.version) {
1104 // Scan in reverse order to optimize for more recent versions.
1105 for (int i = kVersions.length - 1; i >= 0; --i) {
1106 if (mainDataHeader.version >= kVersions[i].version) {
1107 if (mainDataHeader.size == kVersions[i].size) {
1108 // Found a match.
1109 break;
1110 }
1111 throw new bindings.MojoCodecError(
1112 'Header size doesn\'t correspond to known version size.');
1113 }
1114 }
1115 } else if (mainDataHeader.size < kVersions.last.size) {
1116 throw new bindings.MojoCodecError(
1117 'Message newer than the last known version cannot be shorter than '
1118 'required by the last known version.');
1119 }
1120 if (mainDataHeader.version >= 0) {
1121
1122 result.text = decoder0.decodeString(8, false);
1123 }
1124 return result;
1125 }
1126
1127 void encode(bindings.Encoder encoder) {
1128 var encoder0 = encoder.getStructEncoderAtOffset(kVersions.last);
1129
1130 encoder0.encodeString(text, 8, false);
1131 }
1132
1133 String toString() {
1134 return "KeyboardServiceSetTextParams("
1135 "text: $text" ")";
1136 }
1137
1138 Map toJson() {
1139 Map map = new Map();
1140 map["text"] = text;
1141 return map;
1142 }
1143 }
1144
1145
1146 class KeyboardServiceSetSelectionParams extends bindings.Struct {
1147 static const List<bindings.StructDataHeader> kVersions = const [
1148 const bindings.StructDataHeader(16, 0)
1149 ];
1150 int start = 0;
1151 int end = 0;
1152
1153 KeyboardServiceSetSelectionParams() : super(kVersions.last.size);
1154
1155 static KeyboardServiceSetSelectionParams deserialize(bindings.Message message) {
1156 var decoder = new bindings.Decoder(message);
1157 var result = decode(decoder);
1158 if (decoder.excessHandles != null) {
1159 decoder.excessHandles.forEach((h) => h.close());
1160 }
1161 return result;
1162 }
1163
1164 static KeyboardServiceSetSelectionParams decode(bindings.Decoder decoder0) {
1165 if (decoder0 == null) {
1166 return null;
1167 }
1168 KeyboardServiceSetSelectionParams result = new KeyboardServiceSetSelectionPa rams();
1169
1170 var mainDataHeader = decoder0.decodeStructDataHeader();
1171 if (mainDataHeader.version <= kVersions.last.version) {
1172 // Scan in reverse order to optimize for more recent versions.
1173 for (int i = kVersions.length - 1; i >= 0; --i) {
1174 if (mainDataHeader.version >= kVersions[i].version) {
1175 if (mainDataHeader.size == kVersions[i].size) {
1176 // Found a match.
1177 break;
1178 }
1179 throw new bindings.MojoCodecError(
1180 'Header size doesn\'t correspond to known version size.');
1181 }
1182 }
1183 } else if (mainDataHeader.size < kVersions.last.size) {
1184 throw new bindings.MojoCodecError(
1185 'Message newer than the last known version cannot be shorter than '
1186 'required by the last known version.');
1187 }
1188 if (mainDataHeader.version >= 0) {
1189
1190 result.start = decoder0.decodeInt32(8);
1191 }
1192 if (mainDataHeader.version >= 0) {
1193
1194 result.end = decoder0.decodeInt32(12);
1195 }
1196 return result;
1197 }
1198
1199 void encode(bindings.Encoder encoder) {
1200 var encoder0 = encoder.getStructEncoderAtOffset(kVersions.last);
1201
1202 encoder0.encodeInt32(start, 8);
1203
1204 encoder0.encodeInt32(end, 12);
1205 }
1206
1207 String toString() {
1208 return "KeyboardServiceSetSelectionParams("
1209 "start: $start" ", "
1210 "end: $end" ")";
1211 }
1212
1213 Map toJson() {
1214 Map map = new Map();
1215 map["start"] = start;
1216 map["end"] = end;
1217 return map;
1218 }
1219 }
1220
1221 const int kKeyboardClient_commitCompletion_name = 0;
1222 const int kKeyboardClient_commitCorrection_name = 1;
1223 const int kKeyboardClient_commitText_name = 2;
1224 const int kKeyboardClient_deleteSurroundingText_name = 3;
1225 const int kKeyboardClient_setComposingRegion_name = 4;
1226 const int kKeyboardClient_setComposingText_name = 5;
1227 const int kKeyboardClient_setSelection_name = 6;
1228 const int kKeyboardClient_submit_name = 7;
1229
1230 const String KeyboardClientName =
1231 'keyboard::KeyboardClient';
1232
1233 abstract class KeyboardClient {
1234 void commitCompletion(CompletionData completion);
1235 void commitCorrection(CorrectionData correction);
1236 void commitText(String text, int newCursorPosition);
1237 void deleteSurroundingText(int beforeLength, int afterLength);
1238 void setComposingRegion(int start, int end);
1239 void setComposingText(String text, int newCursorPosition);
1240 void setSelection(int start, int end);
1241 void submit(SubmitAction action);
1242
1243 }
1244
1245
1246 class KeyboardClientProxyImpl extends bindings.Proxy {
1247 KeyboardClientProxyImpl.fromEndpoint(
1248 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint);
1249
1250 KeyboardClientProxyImpl.fromHandle(core.MojoHandle handle) :
1251 super.fromHandle(handle);
1252
1253 KeyboardClientProxyImpl.unbound() : super.unbound();
1254
1255 static KeyboardClientProxyImpl newFromEndpoint(
1256 core.MojoMessagePipeEndpoint endpoint) {
1257 assert(endpoint.setDescription("For KeyboardClientProxyImpl"));
1258 return new KeyboardClientProxyImpl.fromEndpoint(endpoint);
1259 }
1260
1261 String get name => KeyboardClientName;
1262
1263 void handleResponse(bindings.ServiceMessage message) {
1264 switch (message.header.type) {
1265 default:
1266 proxyError("Unexpected message type: ${message.header.type}");
1267 close(immediate: true);
1268 break;
1269 }
1270 }
1271
1272 String toString() {
1273 var superString = super.toString();
1274 return "KeyboardClientProxyImpl($superString)";
1275 }
1276 }
1277
1278
1279 class _KeyboardClientProxyCalls implements KeyboardClient {
1280 KeyboardClientProxyImpl _proxyImpl;
1281
1282 _KeyboardClientProxyCalls(this._proxyImpl);
1283 void commitCompletion(CompletionData completion) {
1284 if (!_proxyImpl.isBound) {
1285 _proxyImpl.proxyError("The Proxy is closed.");
1286 return;
1287 }
1288 var params = new KeyboardClientCommitCompletionParams();
1289 params.completion = completion;
1290 _proxyImpl.sendMessage(params, kKeyboardClient_commitCompletion_name);
1291 }
1292
1293 void commitCorrection(CorrectionData correction) {
1294 if (!_proxyImpl.isBound) {
1295 _proxyImpl.proxyError("The Proxy is closed.");
1296 return;
1297 }
1298 var params = new KeyboardClientCommitCorrectionParams();
1299 params.correction = correction;
1300 _proxyImpl.sendMessage(params, kKeyboardClient_commitCorrection_name);
1301 }
1302
1303 void commitText(String text, int newCursorPosition) {
1304 if (!_proxyImpl.isBound) {
1305 _proxyImpl.proxyError("The Proxy is closed.");
1306 return;
1307 }
1308 var params = new KeyboardClientCommitTextParams();
1309 params.text = text;
1310 params.newCursorPosition = newCursorPosition;
1311 _proxyImpl.sendMessage(params, kKeyboardClient_commitText_name);
1312 }
1313
1314 void deleteSurroundingText(int beforeLength, int afterLength) {
1315 if (!_proxyImpl.isBound) {
1316 _proxyImpl.proxyError("The Proxy is closed.");
1317 return;
1318 }
1319 var params = new KeyboardClientDeleteSurroundingTextParams();
1320 params.beforeLength = beforeLength;
1321 params.afterLength = afterLength;
1322 _proxyImpl.sendMessage(params, kKeyboardClient_deleteSurroundingText_name) ;
1323 }
1324
1325 void setComposingRegion(int start, int end) {
1326 if (!_proxyImpl.isBound) {
1327 _proxyImpl.proxyError("The Proxy is closed.");
1328 return;
1329 }
1330 var params = new KeyboardClientSetComposingRegionParams();
1331 params.start = start;
1332 params.end = end;
1333 _proxyImpl.sendMessage(params, kKeyboardClient_setComposingRegion_name);
1334 }
1335
1336 void setComposingText(String text, int newCursorPosition) {
1337 if (!_proxyImpl.isBound) {
1338 _proxyImpl.proxyError("The Proxy is closed.");
1339 return;
1340 }
1341 var params = new KeyboardClientSetComposingTextParams();
1342 params.text = text;
1343 params.newCursorPosition = newCursorPosition;
1344 _proxyImpl.sendMessage(params, kKeyboardClient_setComposingText_name);
1345 }
1346
1347 void setSelection(int start, int end) {
1348 if (!_proxyImpl.isBound) {
1349 _proxyImpl.proxyError("The Proxy is closed.");
1350 return;
1351 }
1352 var params = new KeyboardClientSetSelectionParams();
1353 params.start = start;
1354 params.end = end;
1355 _proxyImpl.sendMessage(params, kKeyboardClient_setSelection_name);
1356 }
1357
1358 void submit(SubmitAction action) {
1359 if (!_proxyImpl.isBound) {
1360 _proxyImpl.proxyError("The Proxy is closed.");
1361 return;
1362 }
1363 var params = new KeyboardClientSubmitParams();
1364 params.action = action;
1365 _proxyImpl.sendMessage(params, kKeyboardClient_submit_name);
1366 }
1367
1368 }
1369
1370
1371 class KeyboardClientProxy implements bindings.ProxyBase {
1372 final bindings.Proxy impl;
1373 KeyboardClient ptr;
1374 final String name = KeyboardClientName;
1375
1376 KeyboardClientProxy(KeyboardClientProxyImpl proxyImpl) :
1377 impl = proxyImpl,
1378 ptr = new _KeyboardClientProxyCalls(proxyImpl);
1379
1380 KeyboardClientProxy.fromEndpoint(
1381 core.MojoMessagePipeEndpoint endpoint) :
1382 impl = new KeyboardClientProxyImpl.fromEndpoint(endpoint) {
1383 ptr = new _KeyboardClientProxyCalls(impl);
1384 }
1385
1386 KeyboardClientProxy.fromHandle(core.MojoHandle handle) :
1387 impl = new KeyboardClientProxyImpl.fromHandle(handle) {
1388 ptr = new _KeyboardClientProxyCalls(impl);
1389 }
1390
1391 KeyboardClientProxy.unbound() :
1392 impl = new KeyboardClientProxyImpl.unbound() {
1393 ptr = new _KeyboardClientProxyCalls(impl);
1394 }
1395
1396 factory KeyboardClientProxy.connectToService(
1397 bindings.ServiceConnector s, String url) {
1398 KeyboardClientProxy p = new KeyboardClientProxy.unbound();
1399 s.connectToService(url, p);
1400 return p;
1401 }
1402
1403 static KeyboardClientProxy newFromEndpoint(
1404 core.MojoMessagePipeEndpoint endpoint) {
1405 assert(endpoint.setDescription("For KeyboardClientProxy"));
1406 return new KeyboardClientProxy.fromEndpoint(endpoint);
1407 }
1408
1409 Future close({bool immediate: false}) => impl.close(immediate: immediate);
1410
1411 Future responseOrError(Future f) => impl.responseOrError(f);
1412
1413 Future get errorFuture => impl.errorFuture;
1414
1415 int get version => impl.version;
1416
1417 Future<int> queryVersion() => impl.queryVersion();
1418
1419 void requireVersion(int requiredVersion) {
1420 impl.requireVersion(requiredVersion);
1421 }
1422
1423 String toString() {
1424 return "KeyboardClientProxy($impl)";
1425 }
1426 }
1427
1428
1429 class KeyboardClientStub extends bindings.Stub {
1430 KeyboardClient _impl = null;
1431
1432 KeyboardClientStub.fromEndpoint(
1433 core.MojoMessagePipeEndpoint endpoint, [this._impl])
1434 : super.fromEndpoint(endpoint);
1435
1436 KeyboardClientStub.fromHandle(core.MojoHandle handle, [this._impl])
1437 : super.fromHandle(handle);
1438
1439 KeyboardClientStub.unbound() : super.unbound();
1440
1441 static KeyboardClientStub newFromEndpoint(
1442 core.MojoMessagePipeEndpoint endpoint) {
1443 assert(endpoint.setDescription("For KeyboardClientStub"));
1444 return new KeyboardClientStub.fromEndpoint(endpoint);
1445 }
1446
1447 static const String name = KeyboardClientName;
1448
1449
1450
1451 dynamic handleMessage(bindings.ServiceMessage message) {
1452 if (bindings.ControlMessageHandler.isControlMessage(message)) {
1453 return bindings.ControlMessageHandler.handleMessage(this,
1454 0,
1455 message);
1456 }
1457 assert(_impl != null);
1458 switch (message.header.type) {
1459 case kKeyboardClient_commitCompletion_name:
1460 var params = KeyboardClientCommitCompletionParams.deserialize(
1461 message.payload);
1462 _impl.commitCompletion(params.completion);
1463 break;
1464 case kKeyboardClient_commitCorrection_name:
1465 var params = KeyboardClientCommitCorrectionParams.deserialize(
1466 message.payload);
1467 _impl.commitCorrection(params.correction);
1468 break;
1469 case kKeyboardClient_commitText_name:
1470 var params = KeyboardClientCommitTextParams.deserialize(
1471 message.payload);
1472 _impl.commitText(params.text, params.newCursorPosition);
1473 break;
1474 case kKeyboardClient_deleteSurroundingText_name:
1475 var params = KeyboardClientDeleteSurroundingTextParams.deserialize(
1476 message.payload);
1477 _impl.deleteSurroundingText(params.beforeLength, params.afterLength);
1478 break;
1479 case kKeyboardClient_setComposingRegion_name:
1480 var params = KeyboardClientSetComposingRegionParams.deserialize(
1481 message.payload);
1482 _impl.setComposingRegion(params.start, params.end);
1483 break;
1484 case kKeyboardClient_setComposingText_name:
1485 var params = KeyboardClientSetComposingTextParams.deserialize(
1486 message.payload);
1487 _impl.setComposingText(params.text, params.newCursorPosition);
1488 break;
1489 case kKeyboardClient_setSelection_name:
1490 var params = KeyboardClientSetSelectionParams.deserialize(
1491 message.payload);
1492 _impl.setSelection(params.start, params.end);
1493 break;
1494 case kKeyboardClient_submit_name:
1495 var params = KeyboardClientSubmitParams.deserialize(
1496 message.payload);
1497 _impl.submit(params.action);
1498 break;
1499 default:
1500 throw new bindings.MojoCodecError("Unexpected message name");
1501 break;
1502 }
1503 return null;
1504 }
1505
1506 KeyboardClient get impl => _impl;
1507 set impl(KeyboardClient d) {
1508 assert(_impl == null);
1509 _impl = d;
1510 }
1511
1512 String toString() {
1513 var superString = super.toString();
1514 return "KeyboardClientStub($superString)";
1515 }
1516
1517 int get version => 0;
1518 }
1519
1520 const int kKeyboardService_show_name = 0;
1521 const int kKeyboardService_showByRequest_name = 1;
1522 const int kKeyboardService_hide_name = 2;
1523 const int kKeyboardService_setText_name = 3;
1524 const int kKeyboardService_setSelection_name = 4;
1525
1526 const String KeyboardServiceName =
1527 'keyboard::KeyboardService';
1528
1529 abstract class KeyboardService {
1530 void show(Object client, KeyboardType type);
1531 void showByRequest();
1532 void hide();
1533 void setText(String text);
1534 void setSelection(int start, int end);
1535
1536 }
1537
1538
1539 class KeyboardServiceProxyImpl extends bindings.Proxy {
1540 KeyboardServiceProxyImpl.fromEndpoint(
1541 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint);
1542
1543 KeyboardServiceProxyImpl.fromHandle(core.MojoHandle handle) :
1544 super.fromHandle(handle);
1545
1546 KeyboardServiceProxyImpl.unbound() : super.unbound();
1547
1548 static KeyboardServiceProxyImpl newFromEndpoint(
1549 core.MojoMessagePipeEndpoint endpoint) {
1550 assert(endpoint.setDescription("For KeyboardServiceProxyImpl"));
1551 return new KeyboardServiceProxyImpl.fromEndpoint(endpoint);
1552 }
1553
1554 String get name => KeyboardServiceName;
1555
1556 void handleResponse(bindings.ServiceMessage message) {
1557 switch (message.header.type) {
1558 default:
1559 proxyError("Unexpected message type: ${message.header.type}");
1560 close(immediate: true);
1561 break;
1562 }
1563 }
1564
1565 String toString() {
1566 var superString = super.toString();
1567 return "KeyboardServiceProxyImpl($superString)";
1568 }
1569 }
1570
1571
1572 class _KeyboardServiceProxyCalls implements KeyboardService {
1573 KeyboardServiceProxyImpl _proxyImpl;
1574
1575 _KeyboardServiceProxyCalls(this._proxyImpl);
1576 void show(Object client, KeyboardType type) {
1577 if (!_proxyImpl.isBound) {
1578 _proxyImpl.proxyError("The Proxy is closed.");
1579 return;
1580 }
1581 var params = new KeyboardServiceShowParams();
1582 params.client = client;
1583 params.type = type;
1584 _proxyImpl.sendMessage(params, kKeyboardService_show_name);
1585 }
1586
1587 void showByRequest() {
1588 if (!_proxyImpl.isBound) {
1589 _proxyImpl.proxyError("The Proxy is closed.");
1590 return;
1591 }
1592 var params = new KeyboardServiceShowByRequestParams();
1593 _proxyImpl.sendMessage(params, kKeyboardService_showByRequest_name);
1594 }
1595
1596 void hide() {
1597 if (!_proxyImpl.isBound) {
1598 _proxyImpl.proxyError("The Proxy is closed.");
1599 return;
1600 }
1601 var params = new KeyboardServiceHideParams();
1602 _proxyImpl.sendMessage(params, kKeyboardService_hide_name);
1603 }
1604
1605 void setText(String text) {
1606 if (!_proxyImpl.isBound) {
1607 _proxyImpl.proxyError("The Proxy is closed.");
1608 return;
1609 }
1610 var params = new KeyboardServiceSetTextParams();
1611 params.text = text;
1612 _proxyImpl.sendMessage(params, kKeyboardService_setText_name);
1613 }
1614
1615 void setSelection(int start, int end) {
1616 if (!_proxyImpl.isBound) {
1617 _proxyImpl.proxyError("The Proxy is closed.");
1618 return;
1619 }
1620 var params = new KeyboardServiceSetSelectionParams();
1621 params.start = start;
1622 params.end = end;
1623 _proxyImpl.sendMessage(params, kKeyboardService_setSelection_name);
1624 }
1625
1626 }
1627
1628
1629 class KeyboardServiceProxy implements bindings.ProxyBase {
1630 final bindings.Proxy impl;
1631 KeyboardService ptr;
1632 final String name = KeyboardServiceName;
1633
1634 KeyboardServiceProxy(KeyboardServiceProxyImpl proxyImpl) :
1635 impl = proxyImpl,
1636 ptr = new _KeyboardServiceProxyCalls(proxyImpl);
1637
1638 KeyboardServiceProxy.fromEndpoint(
1639 core.MojoMessagePipeEndpoint endpoint) :
1640 impl = new KeyboardServiceProxyImpl.fromEndpoint(endpoint) {
1641 ptr = new _KeyboardServiceProxyCalls(impl);
1642 }
1643
1644 KeyboardServiceProxy.fromHandle(core.MojoHandle handle) :
1645 impl = new KeyboardServiceProxyImpl.fromHandle(handle) {
1646 ptr = new _KeyboardServiceProxyCalls(impl);
1647 }
1648
1649 KeyboardServiceProxy.unbound() :
1650 impl = new KeyboardServiceProxyImpl.unbound() {
1651 ptr = new _KeyboardServiceProxyCalls(impl);
1652 }
1653
1654 factory KeyboardServiceProxy.connectToService(
1655 bindings.ServiceConnector s, String url) {
1656 KeyboardServiceProxy p = new KeyboardServiceProxy.unbound();
1657 s.connectToService(url, p);
1658 return p;
1659 }
1660
1661 static KeyboardServiceProxy newFromEndpoint(
1662 core.MojoMessagePipeEndpoint endpoint) {
1663 assert(endpoint.setDescription("For KeyboardServiceProxy"));
1664 return new KeyboardServiceProxy.fromEndpoint(endpoint);
1665 }
1666
1667 Future close({bool immediate: false}) => impl.close(immediate: immediate);
1668
1669 Future responseOrError(Future f) => impl.responseOrError(f);
1670
1671 Future get errorFuture => impl.errorFuture;
1672
1673 int get version => impl.version;
1674
1675 Future<int> queryVersion() => impl.queryVersion();
1676
1677 void requireVersion(int requiredVersion) {
1678 impl.requireVersion(requiredVersion);
1679 }
1680
1681 String toString() {
1682 return "KeyboardServiceProxy($impl)";
1683 }
1684 }
1685
1686
1687 class KeyboardServiceStub extends bindings.Stub {
1688 KeyboardService _impl = null;
1689
1690 KeyboardServiceStub.fromEndpoint(
1691 core.MojoMessagePipeEndpoint endpoint, [this._impl])
1692 : super.fromEndpoint(endpoint);
1693
1694 KeyboardServiceStub.fromHandle(core.MojoHandle handle, [this._impl])
1695 : super.fromHandle(handle);
1696
1697 KeyboardServiceStub.unbound() : super.unbound();
1698
1699 static KeyboardServiceStub newFromEndpoint(
1700 core.MojoMessagePipeEndpoint endpoint) {
1701 assert(endpoint.setDescription("For KeyboardServiceStub"));
1702 return new KeyboardServiceStub.fromEndpoint(endpoint);
1703 }
1704
1705 static const String name = KeyboardServiceName;
1706
1707
1708
1709 dynamic handleMessage(bindings.ServiceMessage message) {
1710 if (bindings.ControlMessageHandler.isControlMessage(message)) {
1711 return bindings.ControlMessageHandler.handleMessage(this,
1712 0,
1713 message);
1714 }
1715 assert(_impl != null);
1716 switch (message.header.type) {
1717 case kKeyboardService_show_name:
1718 var params = KeyboardServiceShowParams.deserialize(
1719 message.payload);
1720 _impl.show(params.client, params.type);
1721 break;
1722 case kKeyboardService_showByRequest_name:
1723 var params = KeyboardServiceShowByRequestParams.deserialize(
1724 message.payload);
1725 _impl.showByRequest();
1726 break;
1727 case kKeyboardService_hide_name:
1728 var params = KeyboardServiceHideParams.deserialize(
1729 message.payload);
1730 _impl.hide();
1731 break;
1732 case kKeyboardService_setText_name:
1733 var params = KeyboardServiceSetTextParams.deserialize(
1734 message.payload);
1735 _impl.setText(params.text);
1736 break;
1737 case kKeyboardService_setSelection_name:
1738 var params = KeyboardServiceSetSelectionParams.deserialize(
1739 message.payload);
1740 _impl.setSelection(params.start, params.end);
1741 break;
1742 default:
1743 throw new bindings.MojoCodecError("Unexpected message name");
1744 break;
1745 }
1746 return null;
1747 }
1748
1749 KeyboardService get impl => _impl;
1750 set impl(KeyboardService d) {
1751 assert(_impl == null);
1752 _impl = d;
1753 }
1754
1755 String toString() {
1756 var superString = super.toString();
1757 return "KeyboardServiceStub($superString)";
1758 }
1759
1760 int get version => 0;
1761 }
1762
1763
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698