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

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

Issue 1539673003: Generate Mojom Types in Dart (Take 2) (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Merge with master Created 4 years, 10 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 camera_mojom; 5 library camera_mojom;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'package:mojo/bindings.dart' as bindings; 9 import 'package:mojo/bindings.dart' as bindings;
10 import 'package:mojo/core.dart' as core; 10 import 'package:mojo/core.dart' as core;
11 import 'package:mojo/mojo/bindings/types/mojom_types.mojom.dart' as mojom_types;
12 import 'package:mojo/mojo/bindings/types/service_describer.mojom.dart' as servic e_describer;
11 13
12 14
13 15
14 class Photo extends bindings.Struct { 16 class Photo extends bindings.Struct {
15 static const List<bindings.StructDataHeader> kVersions = const [ 17 static const List<bindings.StructDataHeader> kVersions = const [
16 const bindings.StructDataHeader(24, 0) 18 const bindings.StructDataHeader(24, 0)
17 ]; 19 ];
18 String uniqueId = null; 20 String uniqueId = null;
19 core.MojoDataPipeConsumer content = null; 21 core.MojoDataPipeConsumer content = null;
20 22
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 "content: $content" ")"; 80 "content: $content" ")";
79 } 81 }
80 82
81 Map toJson() { 83 Map toJson() {
82 throw new bindings.MojoCodecError( 84 throw new bindings.MojoCodecError(
83 'Object containing handles cannot be encoded to JSON.'); 85 'Object containing handles cannot be encoded to JSON.');
84 } 86 }
85 } 87 }
86 88
87 89
90
91
88 class _CameraRollServiceUpdateParams extends bindings.Struct { 92 class _CameraRollServiceUpdateParams extends bindings.Struct {
89 static const List<bindings.StructDataHeader> kVersions = const [ 93 static const List<bindings.StructDataHeader> kVersions = const [
90 const bindings.StructDataHeader(8, 0) 94 const bindings.StructDataHeader(8, 0)
91 ]; 95 ];
92 96
93 _CameraRollServiceUpdateParams() : super(kVersions.last.size); 97 _CameraRollServiceUpdateParams() : super(kVersions.last.size);
94 98
95 static _CameraRollServiceUpdateParams deserialize(bindings.Message message) { 99 static _CameraRollServiceUpdateParams deserialize(bindings.Message message) {
96 var decoder = new bindings.Decoder(message); 100 var decoder = new bindings.Decoder(message);
97 var result = decode(decoder); 101 var result = decode(decoder);
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 return "_CameraRollServiceUpdateParams("")"; 140 return "_CameraRollServiceUpdateParams("")";
137 } 141 }
138 142
139 Map toJson() { 143 Map toJson() {
140 Map map = new Map(); 144 Map map = new Map();
141 return map; 145 return map;
142 } 146 }
143 } 147 }
144 148
145 149
150
151
146 class _CameraRollServiceGetCountParams extends bindings.Struct { 152 class _CameraRollServiceGetCountParams extends bindings.Struct {
147 static const List<bindings.StructDataHeader> kVersions = const [ 153 static const List<bindings.StructDataHeader> kVersions = const [
148 const bindings.StructDataHeader(8, 0) 154 const bindings.StructDataHeader(8, 0)
149 ]; 155 ];
150 156
151 _CameraRollServiceGetCountParams() : super(kVersions.last.size); 157 _CameraRollServiceGetCountParams() : super(kVersions.last.size);
152 158
153 static _CameraRollServiceGetCountParams deserialize(bindings.Message message) { 159 static _CameraRollServiceGetCountParams deserialize(bindings.Message message) {
154 var decoder = new bindings.Decoder(message); 160 var decoder = new bindings.Decoder(message);
155 var result = decode(decoder); 161 var result = decode(decoder);
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 return "_CameraRollServiceGetCountParams("")"; 200 return "_CameraRollServiceGetCountParams("")";
195 } 201 }
196 202
197 Map toJson() { 203 Map toJson() {
198 Map map = new Map(); 204 Map map = new Map();
199 return map; 205 return map;
200 } 206 }
201 } 207 }
202 208
203 209
210
211
204 class CameraRollServiceGetCountResponseParams extends bindings.Struct { 212 class CameraRollServiceGetCountResponseParams extends bindings.Struct {
205 static const List<bindings.StructDataHeader> kVersions = const [ 213 static const List<bindings.StructDataHeader> kVersions = const [
206 const bindings.StructDataHeader(16, 0) 214 const bindings.StructDataHeader(16, 0)
207 ]; 215 ];
208 int numPhotos = 0; 216 int numPhotos = 0;
209 217
210 CameraRollServiceGetCountResponseParams() : super(kVersions.last.size); 218 CameraRollServiceGetCountResponseParams() : super(kVersions.last.size);
211 219
212 static CameraRollServiceGetCountResponseParams deserialize(bindings.Message me ssage) { 220 static CameraRollServiceGetCountResponseParams deserialize(bindings.Message me ssage) {
213 var decoder = new bindings.Decoder(message); 221 var decoder = new bindings.Decoder(message);
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 } 269 }
262 270
263 Map toJson() { 271 Map toJson() {
264 Map map = new Map(); 272 Map map = new Map();
265 map["numPhotos"] = numPhotos; 273 map["numPhotos"] = numPhotos;
266 return map; 274 return map;
267 } 275 }
268 } 276 }
269 277
270 278
279
280
271 class _CameraRollServiceGetPhotoParams extends bindings.Struct { 281 class _CameraRollServiceGetPhotoParams extends bindings.Struct {
272 static const List<bindings.StructDataHeader> kVersions = const [ 282 static const List<bindings.StructDataHeader> kVersions = const [
273 const bindings.StructDataHeader(16, 0) 283 const bindings.StructDataHeader(16, 0)
274 ]; 284 ];
275 int index = 0; 285 int index = 0;
276 286
277 _CameraRollServiceGetPhotoParams() : super(kVersions.last.size); 287 _CameraRollServiceGetPhotoParams() : super(kVersions.last.size);
278 288
279 static _CameraRollServiceGetPhotoParams deserialize(bindings.Message message) { 289 static _CameraRollServiceGetPhotoParams deserialize(bindings.Message message) {
280 var decoder = new bindings.Decoder(message); 290 var decoder = new bindings.Decoder(message);
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 } 338 }
329 339
330 Map toJson() { 340 Map toJson() {
331 Map map = new Map(); 341 Map map = new Map();
332 map["index"] = index; 342 map["index"] = index;
333 return map; 343 return map;
334 } 344 }
335 } 345 }
336 346
337 347
348
349
338 class CameraRollServiceGetPhotoResponseParams extends bindings.Struct { 350 class CameraRollServiceGetPhotoResponseParams extends bindings.Struct {
339 static const List<bindings.StructDataHeader> kVersions = const [ 351 static const List<bindings.StructDataHeader> kVersions = const [
340 const bindings.StructDataHeader(16, 0) 352 const bindings.StructDataHeader(16, 0)
341 ]; 353 ];
342 Photo photo = null; 354 Photo photo = null;
343 355
344 CameraRollServiceGetPhotoResponseParams() : super(kVersions.last.size); 356 CameraRollServiceGetPhotoResponseParams() : super(kVersions.last.size);
345 357
346 static CameraRollServiceGetPhotoResponseParams deserialize(bindings.Message me ssage) { 358 static CameraRollServiceGetPhotoResponseParams deserialize(bindings.Message me ssage) {
347 var decoder = new bindings.Decoder(message); 359 var decoder = new bindings.Decoder(message);
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 "photo: $photo" ")"; 407 "photo: $photo" ")";
396 } 408 }
397 409
398 Map toJson() { 410 Map toJson() {
399 throw new bindings.MojoCodecError( 411 throw new bindings.MojoCodecError(
400 'Object containing handles cannot be encoded to JSON.'); 412 'Object containing handles cannot be encoded to JSON.');
401 } 413 }
402 } 414 }
403 415
404 416
417
418
405 class _CameraServiceGetLatestFrameParams extends bindings.Struct { 419 class _CameraServiceGetLatestFrameParams extends bindings.Struct {
406 static const List<bindings.StructDataHeader> kVersions = const [ 420 static const List<bindings.StructDataHeader> kVersions = const [
407 const bindings.StructDataHeader(8, 0) 421 const bindings.StructDataHeader(8, 0)
408 ]; 422 ];
409 423
410 _CameraServiceGetLatestFrameParams() : super(kVersions.last.size); 424 _CameraServiceGetLatestFrameParams() : super(kVersions.last.size);
411 425
412 static _CameraServiceGetLatestFrameParams deserialize(bindings.Message message ) { 426 static _CameraServiceGetLatestFrameParams deserialize(bindings.Message message ) {
413 var decoder = new bindings.Decoder(message); 427 var decoder = new bindings.Decoder(message);
414 var result = decode(decoder); 428 var result = decode(decoder);
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
453 return "_CameraServiceGetLatestFrameParams("")"; 467 return "_CameraServiceGetLatestFrameParams("")";
454 } 468 }
455 469
456 Map toJson() { 470 Map toJson() {
457 Map map = new Map(); 471 Map map = new Map();
458 return map; 472 return map;
459 } 473 }
460 } 474 }
461 475
462 476
477
478
463 class CameraServiceGetLatestFrameResponseParams extends bindings.Struct { 479 class CameraServiceGetLatestFrameResponseParams extends bindings.Struct {
464 static const List<bindings.StructDataHeader> kVersions = const [ 480 static const List<bindings.StructDataHeader> kVersions = const [
465 const bindings.StructDataHeader(16, 0) 481 const bindings.StructDataHeader(16, 0)
466 ]; 482 ];
467 core.MojoDataPipeConsumer content = null; 483 core.MojoDataPipeConsumer content = null;
468 484
469 CameraServiceGetLatestFrameResponseParams() : super(kVersions.last.size); 485 CameraServiceGetLatestFrameResponseParams() : super(kVersions.last.size);
470 486
471 static CameraServiceGetLatestFrameResponseParams deserialize(bindings.Message message) { 487 static CameraServiceGetLatestFrameResponseParams deserialize(bindings.Message message) {
472 var decoder = new bindings.Decoder(message); 488 var decoder = new bindings.Decoder(message);
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
518 return "CameraServiceGetLatestFrameResponseParams(" 534 return "CameraServiceGetLatestFrameResponseParams("
519 "content: $content" ")"; 535 "content: $content" ")";
520 } 536 }
521 537
522 Map toJson() { 538 Map toJson() {
523 throw new bindings.MojoCodecError( 539 throw new bindings.MojoCodecError(
524 'Object containing handles cannot be encoded to JSON.'); 540 'Object containing handles cannot be encoded to JSON.');
525 } 541 }
526 } 542 }
527 543
544
545
546
528 const int _CameraRollService_updateName = 0; 547 const int _CameraRollService_updateName = 0;
529 const int _CameraRollService_getCountName = 1; 548 const int _CameraRollService_getCountName = 1;
530 const int _CameraRollService_getPhotoName = 2; 549 const int _CameraRollService_getPhotoName = 2;
531 550
551
552
553 class _CameraRollServiceServiceDescription implements service_describer.ServiceD escription {
554 dynamic getTopLevelInterface([Function responseFactory]) => null;
555
556 dynamic getTypeDefinition(String typeKey, [Function responseFactory]) => null;
557
558 dynamic getAllTypeDefinitions([Function responseFactory]) => null;
559 }
560
532 abstract class CameraRollService { 561 abstract class CameraRollService {
533 static const String serviceName = "mojo::CameraRollService"; 562 static const String serviceName = "mojo::CameraRollService";
534 void update(); 563 void update();
535 dynamic getCount([Function responseFactory = null]); 564 dynamic getCount([Function responseFactory = null]);
536 dynamic getPhoto(int index,[Function responseFactory = null]); 565 dynamic getPhoto(int index,[Function responseFactory = null]);
537 } 566 }
538 567
539 568
540 class _CameraRollServiceProxyImpl extends bindings.Proxy { 569 class _CameraRollServiceProxyImpl extends bindings.Proxy {
541 _CameraRollServiceProxyImpl.fromEndpoint( 570 _CameraRollServiceProxyImpl.fromEndpoint(
542 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); 571 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint);
543 572
544 _CameraRollServiceProxyImpl.fromHandle(core.MojoHandle handle) : 573 _CameraRollServiceProxyImpl.fromHandle(core.MojoHandle handle) :
545 super.fromHandle(handle); 574 super.fromHandle(handle);
546 575
547 _CameraRollServiceProxyImpl.unbound() : super.unbound(); 576 _CameraRollServiceProxyImpl.unbound() : super.unbound();
548 577
549 static _CameraRollServiceProxyImpl newFromEndpoint( 578 static _CameraRollServiceProxyImpl newFromEndpoint(
550 core.MojoMessagePipeEndpoint endpoint) { 579 core.MojoMessagePipeEndpoint endpoint) {
551 assert(endpoint.setDescription("For _CameraRollServiceProxyImpl")); 580 assert(endpoint.setDescription("For _CameraRollServiceProxyImpl"));
552 return new _CameraRollServiceProxyImpl.fromEndpoint(endpoint); 581 return new _CameraRollServiceProxyImpl.fromEndpoint(endpoint);
553 } 582 }
554 583
584 service_describer.ServiceDescription get serviceDescription =>
585 new _CameraRollServiceServiceDescription();
586
555 void handleResponse(bindings.ServiceMessage message) { 587 void handleResponse(bindings.ServiceMessage message) {
556 switch (message.header.type) { 588 switch (message.header.type) {
557 case _CameraRollService_getCountName: 589 case _CameraRollService_getCountName:
558 var r = CameraRollServiceGetCountResponseParams.deserialize( 590 var r = CameraRollServiceGetCountResponseParams.deserialize(
559 message.payload); 591 message.payload);
560 if (!message.header.hasRequestId) { 592 if (!message.header.hasRequestId) {
561 proxyError("Expected a message with a valid request Id."); 593 proxyError("Expected a message with a valid request Id.");
562 return; 594 return;
563 } 595 }
564 Completer c = completerMap[message.header.requestId]; 596 Completer c = completerMap[message.header.requestId];
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
798 assert(_impl == null); 830 assert(_impl == null);
799 _impl = d; 831 _impl = d;
800 } 832 }
801 833
802 String toString() { 834 String toString() {
803 var superString = super.toString(); 835 var superString = super.toString();
804 return "CameraRollServiceStub($superString)"; 836 return "CameraRollServiceStub($superString)";
805 } 837 }
806 838
807 int get version => 0; 839 int get version => 0;
840
841 service_describer.ServiceDescription get serviceDescription =>
842 new _CameraRollServiceServiceDescription();
808 } 843 }
809 844
810 const int _CameraService_getLatestFrameName = 0; 845 const int _CameraService_getLatestFrameName = 0;
811 846
847
848
849 class _CameraServiceServiceDescription implements service_describer.ServiceDescr iption {
850 dynamic getTopLevelInterface([Function responseFactory]) => null;
851
852 dynamic getTypeDefinition(String typeKey, [Function responseFactory]) => null;
853
854 dynamic getAllTypeDefinitions([Function responseFactory]) => null;
855 }
856
812 abstract class CameraService { 857 abstract class CameraService {
813 static const String serviceName = "mojo::CameraService"; 858 static const String serviceName = "mojo::CameraService";
814 dynamic getLatestFrame([Function responseFactory = null]); 859 dynamic getLatestFrame([Function responseFactory = null]);
815 } 860 }
816 861
817 862
818 class _CameraServiceProxyImpl extends bindings.Proxy { 863 class _CameraServiceProxyImpl extends bindings.Proxy {
819 _CameraServiceProxyImpl.fromEndpoint( 864 _CameraServiceProxyImpl.fromEndpoint(
820 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); 865 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint);
821 866
822 _CameraServiceProxyImpl.fromHandle(core.MojoHandle handle) : 867 _CameraServiceProxyImpl.fromHandle(core.MojoHandle handle) :
823 super.fromHandle(handle); 868 super.fromHandle(handle);
824 869
825 _CameraServiceProxyImpl.unbound() : super.unbound(); 870 _CameraServiceProxyImpl.unbound() : super.unbound();
826 871
827 static _CameraServiceProxyImpl newFromEndpoint( 872 static _CameraServiceProxyImpl newFromEndpoint(
828 core.MojoMessagePipeEndpoint endpoint) { 873 core.MojoMessagePipeEndpoint endpoint) {
829 assert(endpoint.setDescription("For _CameraServiceProxyImpl")); 874 assert(endpoint.setDescription("For _CameraServiceProxyImpl"));
830 return new _CameraServiceProxyImpl.fromEndpoint(endpoint); 875 return new _CameraServiceProxyImpl.fromEndpoint(endpoint);
831 } 876 }
832 877
878 service_describer.ServiceDescription get serviceDescription =>
879 new _CameraServiceServiceDescription();
880
833 void handleResponse(bindings.ServiceMessage message) { 881 void handleResponse(bindings.ServiceMessage message) {
834 switch (message.header.type) { 882 switch (message.header.type) {
835 case _CameraService_getLatestFrameName: 883 case _CameraService_getLatestFrameName:
836 var r = CameraServiceGetLatestFrameResponseParams.deserialize( 884 var r = CameraServiceGetLatestFrameResponseParams.deserialize(
837 message.payload); 885 message.payload);
838 if (!message.header.hasRequestId) { 886 if (!message.header.hasRequestId) {
839 proxyError("Expected a message with a valid request Id."); 887 proxyError("Expected a message with a valid request Id.");
840 return; 888 return;
841 } 889 }
842 Completer c = completerMap[message.header.requestId]; 890 Completer c = completerMap[message.header.requestId];
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
1007 assert(_impl == null); 1055 assert(_impl == null);
1008 _impl = d; 1056 _impl = d;
1009 } 1057 }
1010 1058
1011 String toString() { 1059 String toString() {
1012 var superString = super.toString(); 1060 var superString = super.toString();
1013 return "CameraServiceStub($superString)"; 1061 return "CameraServiceStub($superString)";
1014 } 1062 }
1015 1063
1016 int get version => 0; 1064 int get version => 0;
1065
1066 service_describer.ServiceDescription get serviceDescription =>
1067 new _CameraServiceServiceDescription();
1017 } 1068 }
1018 1069
1019 1070
1071
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698