| OLD | NEW |
| 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 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 | 10 |
| (...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 570 } | 570 } |
| 571 | 571 |
| 572 abstract class CameraRollService { | 572 abstract class CameraRollService { |
| 573 static const String serviceName = "mojo::CameraRollService"; | 573 static const String serviceName = "mojo::CameraRollService"; |
| 574 void update(); | 574 void update(); |
| 575 dynamic getCount([Function responseFactory = null]); | 575 dynamic getCount([Function responseFactory = null]); |
| 576 dynamic getPhoto(int index,[Function responseFactory = null]); | 576 dynamic getPhoto(int index,[Function responseFactory = null]); |
| 577 } | 577 } |
| 578 | 578 |
| 579 | 579 |
| 580 class _CameraRollServiceProxyImpl extends bindings.Proxy { | 580 class _CameraRollServiceProxyControl extends bindings.ProxyMessageHandler |
| 581 _CameraRollServiceProxyImpl.fromEndpoint( | 581 implements bindings.ProxyControl { |
| 582 _CameraRollServiceProxyControl.fromEndpoint( |
| 582 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); | 583 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); |
| 583 | 584 |
| 584 _CameraRollServiceProxyImpl.fromHandle(core.MojoHandle handle) : | 585 _CameraRollServiceProxyControl.fromHandle( |
| 585 super.fromHandle(handle); | 586 core.MojoHandle handle) : super.fromHandle(handle); |
| 586 | 587 |
| 587 _CameraRollServiceProxyImpl.unbound() : super.unbound(); | 588 _CameraRollServiceProxyControl.unbound() : super.unbound(); |
| 588 | |
| 589 static _CameraRollServiceProxyImpl newFromEndpoint( | |
| 590 core.MojoMessagePipeEndpoint endpoint) { | |
| 591 assert(endpoint.setDescription("For _CameraRollServiceProxyImpl")); | |
| 592 return new _CameraRollServiceProxyImpl.fromEndpoint(endpoint); | |
| 593 } | |
| 594 | 589 |
| 595 service_describer.ServiceDescription get serviceDescription => | 590 service_describer.ServiceDescription get serviceDescription => |
| 596 new _CameraRollServiceServiceDescription(); | 591 new _CameraRollServiceServiceDescription(); |
| 597 | 592 |
| 593 String get serviceName => CameraRollService.serviceName; |
| 594 |
| 595 @override |
| 598 void handleResponse(bindings.ServiceMessage message) { | 596 void handleResponse(bindings.ServiceMessage message) { |
| 599 switch (message.header.type) { | 597 switch (message.header.type) { |
| 600 case _cameraRollServiceMethodGetCountName: | 598 case _cameraRollServiceMethodGetCountName: |
| 601 var r = CameraRollServiceGetCountResponseParams.deserialize( | 599 var r = CameraRollServiceGetCountResponseParams.deserialize( |
| 602 message.payload); | 600 message.payload); |
| 603 if (!message.header.hasRequestId) { | 601 if (!message.header.hasRequestId) { |
| 604 proxyError("Expected a message with a valid request Id."); | 602 proxyError("Expected a message with a valid request Id."); |
| 605 return; | 603 return; |
| 606 } | 604 } |
| 607 Completer c = completerMap[message.header.requestId]; | 605 Completer c = completerMap[message.header.requestId]; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 637 } | 635 } |
| 638 c.complete(r); | 636 c.complete(r); |
| 639 break; | 637 break; |
| 640 default: | 638 default: |
| 641 proxyError("Unexpected message type: ${message.header.type}"); | 639 proxyError("Unexpected message type: ${message.header.type}"); |
| 642 close(immediate: true); | 640 close(immediate: true); |
| 643 break; | 641 break; |
| 644 } | 642 } |
| 645 } | 643 } |
| 646 | 644 |
| 645 @override |
| 647 String toString() { | 646 String toString() { |
| 648 var superString = super.toString(); | 647 var superString = super.toString(); |
| 649 return "_CameraRollServiceProxyImpl($superString)"; | 648 return "_CameraRollServiceProxyControl($superString)"; |
| 650 } | 649 } |
| 651 } | 650 } |
| 652 | 651 |
| 653 | 652 |
| 654 class _CameraRollServiceProxyCalls implements CameraRollService { | 653 class CameraRollServiceProxy extends bindings.Proxy |
| 655 _CameraRollServiceProxyImpl _proxyImpl; | 654 implements CameraRollService { |
| 655 CameraRollServiceProxy.fromEndpoint( |
| 656 core.MojoMessagePipeEndpoint endpoint) |
| 657 : super(new _CameraRollServiceProxyControl.fromEndpoint(endpoint)); |
| 656 | 658 |
| 657 _CameraRollServiceProxyCalls(this._proxyImpl); | 659 CameraRollServiceProxy.fromHandle(core.MojoHandle handle) |
| 658 void update() { | 660 : super(new _CameraRollServiceProxyControl.fromHandle(handle)); |
| 659 if (!_proxyImpl.isBound) { | |
| 660 _proxyImpl.proxyError("The Proxy is closed."); | |
| 661 return; | |
| 662 } | |
| 663 var params = new _CameraRollServiceUpdateParams(); | |
| 664 _proxyImpl.sendMessage(params, _cameraRollServiceMethodUpdateName); | |
| 665 } | |
| 666 dynamic getCount([Function responseFactory = null]) { | |
| 667 var params = new _CameraRollServiceGetCountParams(); | |
| 668 return _proxyImpl.sendMessageWithRequestId( | |
| 669 params, | |
| 670 _cameraRollServiceMethodGetCountName, | |
| 671 -1, | |
| 672 bindings.MessageHeader.kMessageExpectsResponse); | |
| 673 } | |
| 674 dynamic getPhoto(int index,[Function responseFactory = null]) { | |
| 675 var params = new _CameraRollServiceGetPhotoParams(); | |
| 676 params.index = index; | |
| 677 return _proxyImpl.sendMessageWithRequestId( | |
| 678 params, | |
| 679 _cameraRollServiceMethodGetPhotoName, | |
| 680 -1, | |
| 681 bindings.MessageHeader.kMessageExpectsResponse); | |
| 682 } | |
| 683 } | |
| 684 | 661 |
| 662 CameraRollServiceProxy.unbound() |
| 663 : super(new _CameraRollServiceProxyControl.unbound()); |
| 685 | 664 |
| 686 class CameraRollServiceProxy implements bindings.ProxyBase { | 665 static CameraRollServiceProxy newFromEndpoint( |
| 687 final bindings.Proxy impl; | 666 core.MojoMessagePipeEndpoint endpoint) { |
| 688 CameraRollService ptr; | 667 assert(endpoint.setDescription("For CameraRollServiceProxy")); |
| 689 | 668 return new CameraRollServiceProxy.fromEndpoint(endpoint); |
| 690 CameraRollServiceProxy(_CameraRollServiceProxyImpl proxyImpl) : | |
| 691 impl = proxyImpl, | |
| 692 ptr = new _CameraRollServiceProxyCalls(proxyImpl); | |
| 693 | |
| 694 CameraRollServiceProxy.fromEndpoint( | |
| 695 core.MojoMessagePipeEndpoint endpoint) : | |
| 696 impl = new _CameraRollServiceProxyImpl.fromEndpoint(endpoint) { | |
| 697 ptr = new _CameraRollServiceProxyCalls(impl); | |
| 698 } | |
| 699 | |
| 700 CameraRollServiceProxy.fromHandle(core.MojoHandle handle) : | |
| 701 impl = new _CameraRollServiceProxyImpl.fromHandle(handle) { | |
| 702 ptr = new _CameraRollServiceProxyCalls(impl); | |
| 703 } | |
| 704 | |
| 705 CameraRollServiceProxy.unbound() : | |
| 706 impl = new _CameraRollServiceProxyImpl.unbound() { | |
| 707 ptr = new _CameraRollServiceProxyCalls(impl); | |
| 708 } | 669 } |
| 709 | 670 |
| 710 factory CameraRollServiceProxy.connectToService( | 671 factory CameraRollServiceProxy.connectToService( |
| 711 bindings.ServiceConnector s, String url, [String serviceName]) { | 672 bindings.ServiceConnector s, String url, [String serviceName]) { |
| 712 CameraRollServiceProxy p = new CameraRollServiceProxy.unbound(); | 673 CameraRollServiceProxy p = new CameraRollServiceProxy.unbound(); |
| 713 s.connectToService(url, p, serviceName); | 674 s.connectToService(url, p, serviceName); |
| 714 return p; | 675 return p; |
| 715 } | 676 } |
| 716 | 677 |
| 717 static CameraRollServiceProxy newFromEndpoint( | 678 |
| 718 core.MojoMessagePipeEndpoint endpoint) { | 679 void update() { |
| 719 assert(endpoint.setDescription("For CameraRollServiceProxy")); | 680 if (!ctrl.isBound) { |
| 720 return new CameraRollServiceProxy.fromEndpoint(endpoint); | 681 ctrl.proxyError("The Proxy is closed."); |
| 682 return; |
| 683 } |
| 684 var params = new _CameraRollServiceUpdateParams(); |
| 685 ctrl.sendMessage(params, |
| 686 _cameraRollServiceMethodUpdateName); |
| 721 } | 687 } |
| 722 | 688 dynamic getCount([Function responseFactory = null]) { |
| 723 String get serviceName => CameraRollService.serviceName; | 689 var params = new _CameraRollServiceGetCountParams(); |
| 724 | 690 return ctrl.sendMessageWithRequestId( |
| 725 Future close({bool immediate: false}) => impl.close(immediate: immediate); | 691 params, |
| 726 | 692 _cameraRollServiceMethodGetCountName, |
| 727 Future responseOrError(Future f) => impl.responseOrError(f); | 693 -1, |
| 728 | 694 bindings.MessageHeader.kMessageExpectsResponse); |
| 729 Future get errorFuture => impl.errorFuture; | |
| 730 | |
| 731 int get version => impl.version; | |
| 732 | |
| 733 Future<int> queryVersion() => impl.queryVersion(); | |
| 734 | |
| 735 void requireVersion(int requiredVersion) { | |
| 736 impl.requireVersion(requiredVersion); | |
| 737 } | 695 } |
| 738 | 696 dynamic getPhoto(int index,[Function responseFactory = null]) { |
| 739 String toString() { | 697 var params = new _CameraRollServiceGetPhotoParams(); |
| 740 return "CameraRollServiceProxy($impl)"; | 698 params.index = index; |
| 699 return ctrl.sendMessageWithRequestId( |
| 700 params, |
| 701 _cameraRollServiceMethodGetPhotoName, |
| 702 -1, |
| 703 bindings.MessageHeader.kMessageExpectsResponse); |
| 741 } | 704 } |
| 742 } | 705 } |
| 743 | 706 |
| 744 | 707 |
| 745 class CameraRollServiceStub extends bindings.Stub { | 708 class CameraRollServiceStub extends bindings.Stub { |
| 746 CameraRollService _impl; | 709 CameraRollService _impl; |
| 747 | 710 |
| 748 CameraRollServiceStub.fromEndpoint( | 711 CameraRollServiceStub.fromEndpoint( |
| 749 core.MojoMessagePipeEndpoint endpoint, [CameraRollService impl]) | 712 core.MojoMessagePipeEndpoint endpoint, [CameraRollService impl]) |
| 750 : super.fromEndpoint(endpoint, autoBegin: impl != null) { | 713 : super.fromEndpoint(endpoint, autoBegin: impl != null) { |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 886 dynamic getAllTypeDefinitions([Function responseFactory]) => | 849 dynamic getAllTypeDefinitions([Function responseFactory]) => |
| 887 responseFactory(null); | 850 responseFactory(null); |
| 888 } | 851 } |
| 889 | 852 |
| 890 abstract class CameraService { | 853 abstract class CameraService { |
| 891 static const String serviceName = "mojo::CameraService"; | 854 static const String serviceName = "mojo::CameraService"; |
| 892 dynamic getLatestFrame([Function responseFactory = null]); | 855 dynamic getLatestFrame([Function responseFactory = null]); |
| 893 } | 856 } |
| 894 | 857 |
| 895 | 858 |
| 896 class _CameraServiceProxyImpl extends bindings.Proxy { | 859 class _CameraServiceProxyControl extends bindings.ProxyMessageHandler |
| 897 _CameraServiceProxyImpl.fromEndpoint( | 860 implements bindings.ProxyControl { |
| 861 _CameraServiceProxyControl.fromEndpoint( |
| 898 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); | 862 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); |
| 899 | 863 |
| 900 _CameraServiceProxyImpl.fromHandle(core.MojoHandle handle) : | 864 _CameraServiceProxyControl.fromHandle( |
| 901 super.fromHandle(handle); | 865 core.MojoHandle handle) : super.fromHandle(handle); |
| 902 | 866 |
| 903 _CameraServiceProxyImpl.unbound() : super.unbound(); | 867 _CameraServiceProxyControl.unbound() : super.unbound(); |
| 904 | |
| 905 static _CameraServiceProxyImpl newFromEndpoint( | |
| 906 core.MojoMessagePipeEndpoint endpoint) { | |
| 907 assert(endpoint.setDescription("For _CameraServiceProxyImpl")); | |
| 908 return new _CameraServiceProxyImpl.fromEndpoint(endpoint); | |
| 909 } | |
| 910 | 868 |
| 911 service_describer.ServiceDescription get serviceDescription => | 869 service_describer.ServiceDescription get serviceDescription => |
| 912 new _CameraServiceServiceDescription(); | 870 new _CameraServiceServiceDescription(); |
| 913 | 871 |
| 872 String get serviceName => CameraService.serviceName; |
| 873 |
| 874 @override |
| 914 void handleResponse(bindings.ServiceMessage message) { | 875 void handleResponse(bindings.ServiceMessage message) { |
| 915 switch (message.header.type) { | 876 switch (message.header.type) { |
| 916 case _cameraServiceMethodGetLatestFrameName: | 877 case _cameraServiceMethodGetLatestFrameName: |
| 917 var r = CameraServiceGetLatestFrameResponseParams.deserialize( | 878 var r = CameraServiceGetLatestFrameResponseParams.deserialize( |
| 918 message.payload); | 879 message.payload); |
| 919 if (!message.header.hasRequestId) { | 880 if (!message.header.hasRequestId) { |
| 920 proxyError("Expected a message with a valid request Id."); | 881 proxyError("Expected a message with a valid request Id."); |
| 921 return; | 882 return; |
| 922 } | 883 } |
| 923 Completer c = completerMap[message.header.requestId]; | 884 Completer c = completerMap[message.header.requestId]; |
| 924 if (c == null) { | 885 if (c == null) { |
| 925 proxyError( | 886 proxyError( |
| 926 "Message had unknown request Id: ${message.header.requestId}"); | 887 "Message had unknown request Id: ${message.header.requestId}"); |
| 927 return; | 888 return; |
| 928 } | 889 } |
| 929 completerMap.remove(message.header.requestId); | 890 completerMap.remove(message.header.requestId); |
| 930 if (c.isCompleted) { | 891 if (c.isCompleted) { |
| 931 proxyError("Response completer already completed"); | 892 proxyError("Response completer already completed"); |
| 932 return; | 893 return; |
| 933 } | 894 } |
| 934 c.complete(r); | 895 c.complete(r); |
| 935 break; | 896 break; |
| 936 default: | 897 default: |
| 937 proxyError("Unexpected message type: ${message.header.type}"); | 898 proxyError("Unexpected message type: ${message.header.type}"); |
| 938 close(immediate: true); | 899 close(immediate: true); |
| 939 break; | 900 break; |
| 940 } | 901 } |
| 941 } | 902 } |
| 942 | 903 |
| 904 @override |
| 943 String toString() { | 905 String toString() { |
| 944 var superString = super.toString(); | 906 var superString = super.toString(); |
| 945 return "_CameraServiceProxyImpl($superString)"; | 907 return "_CameraServiceProxyControl($superString)"; |
| 946 } | 908 } |
| 947 } | 909 } |
| 948 | 910 |
| 949 | 911 |
| 950 class _CameraServiceProxyCalls implements CameraService { | 912 class CameraServiceProxy extends bindings.Proxy |
| 951 _CameraServiceProxyImpl _proxyImpl; | 913 implements CameraService { |
| 914 CameraServiceProxy.fromEndpoint( |
| 915 core.MojoMessagePipeEndpoint endpoint) |
| 916 : super(new _CameraServiceProxyControl.fromEndpoint(endpoint)); |
| 952 | 917 |
| 953 _CameraServiceProxyCalls(this._proxyImpl); | 918 CameraServiceProxy.fromHandle(core.MojoHandle handle) |
| 954 dynamic getLatestFrame([Function responseFactory = null]) { | 919 : super(new _CameraServiceProxyControl.fromHandle(handle)); |
| 955 var params = new _CameraServiceGetLatestFrameParams(); | |
| 956 return _proxyImpl.sendMessageWithRequestId( | |
| 957 params, | |
| 958 _cameraServiceMethodGetLatestFrameName, | |
| 959 -1, | |
| 960 bindings.MessageHeader.kMessageExpectsResponse); | |
| 961 } | |
| 962 } | |
| 963 | 920 |
| 921 CameraServiceProxy.unbound() |
| 922 : super(new _CameraServiceProxyControl.unbound()); |
| 964 | 923 |
| 965 class CameraServiceProxy implements bindings.ProxyBase { | 924 static CameraServiceProxy newFromEndpoint( |
| 966 final bindings.Proxy impl; | 925 core.MojoMessagePipeEndpoint endpoint) { |
| 967 CameraService ptr; | 926 assert(endpoint.setDescription("For CameraServiceProxy")); |
| 968 | 927 return new CameraServiceProxy.fromEndpoint(endpoint); |
| 969 CameraServiceProxy(_CameraServiceProxyImpl proxyImpl) : | |
| 970 impl = proxyImpl, | |
| 971 ptr = new _CameraServiceProxyCalls(proxyImpl); | |
| 972 | |
| 973 CameraServiceProxy.fromEndpoint( | |
| 974 core.MojoMessagePipeEndpoint endpoint) : | |
| 975 impl = new _CameraServiceProxyImpl.fromEndpoint(endpoint) { | |
| 976 ptr = new _CameraServiceProxyCalls(impl); | |
| 977 } | |
| 978 | |
| 979 CameraServiceProxy.fromHandle(core.MojoHandle handle) : | |
| 980 impl = new _CameraServiceProxyImpl.fromHandle(handle) { | |
| 981 ptr = new _CameraServiceProxyCalls(impl); | |
| 982 } | |
| 983 | |
| 984 CameraServiceProxy.unbound() : | |
| 985 impl = new _CameraServiceProxyImpl.unbound() { | |
| 986 ptr = new _CameraServiceProxyCalls(impl); | |
| 987 } | 928 } |
| 988 | 929 |
| 989 factory CameraServiceProxy.connectToService( | 930 factory CameraServiceProxy.connectToService( |
| 990 bindings.ServiceConnector s, String url, [String serviceName]) { | 931 bindings.ServiceConnector s, String url, [String serviceName]) { |
| 991 CameraServiceProxy p = new CameraServiceProxy.unbound(); | 932 CameraServiceProxy p = new CameraServiceProxy.unbound(); |
| 992 s.connectToService(url, p, serviceName); | 933 s.connectToService(url, p, serviceName); |
| 993 return p; | 934 return p; |
| 994 } | 935 } |
| 995 | 936 |
| 996 static CameraServiceProxy newFromEndpoint( | |
| 997 core.MojoMessagePipeEndpoint endpoint) { | |
| 998 assert(endpoint.setDescription("For CameraServiceProxy")); | |
| 999 return new CameraServiceProxy.fromEndpoint(endpoint); | |
| 1000 } | |
| 1001 | 937 |
| 1002 String get serviceName => CameraService.serviceName; | 938 dynamic getLatestFrame([Function responseFactory = null]) { |
| 1003 | 939 var params = new _CameraServiceGetLatestFrameParams(); |
| 1004 Future close({bool immediate: false}) => impl.close(immediate: immediate); | 940 return ctrl.sendMessageWithRequestId( |
| 1005 | 941 params, |
| 1006 Future responseOrError(Future f) => impl.responseOrError(f); | 942 _cameraServiceMethodGetLatestFrameName, |
| 1007 | 943 -1, |
| 1008 Future get errorFuture => impl.errorFuture; | 944 bindings.MessageHeader.kMessageExpectsResponse); |
| 1009 | |
| 1010 int get version => impl.version; | |
| 1011 | |
| 1012 Future<int> queryVersion() => impl.queryVersion(); | |
| 1013 | |
| 1014 void requireVersion(int requiredVersion) { | |
| 1015 impl.requireVersion(requiredVersion); | |
| 1016 } | |
| 1017 | |
| 1018 String toString() { | |
| 1019 return "CameraServiceProxy($impl)"; | |
| 1020 } | 945 } |
| 1021 } | 946 } |
| 1022 | 947 |
| 1023 | 948 |
| 1024 class CameraServiceStub extends bindings.Stub { | 949 class CameraServiceStub extends bindings.Stub { |
| 1025 CameraService _impl; | 950 CameraService _impl; |
| 1026 | 951 |
| 1027 CameraServiceStub.fromEndpoint( | 952 CameraServiceStub.fromEndpoint( |
| 1028 core.MojoMessagePipeEndpoint endpoint, [CameraService impl]) | 953 core.MojoMessagePipeEndpoint endpoint, [CameraService impl]) |
| 1029 : super.fromEndpoint(endpoint, autoBegin: impl != null) { | 954 : super.fromEndpoint(endpoint, autoBegin: impl != null) { |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1118 static service_describer.ServiceDescription get serviceDescription { | 1043 static service_describer.ServiceDescription get serviceDescription { |
| 1119 if (_cachedServiceDescription == null) { | 1044 if (_cachedServiceDescription == null) { |
| 1120 _cachedServiceDescription = new _CameraServiceServiceDescription(); | 1045 _cachedServiceDescription = new _CameraServiceServiceDescription(); |
| 1121 } | 1046 } |
| 1122 return _cachedServiceDescription; | 1047 return _cachedServiceDescription; |
| 1123 } | 1048 } |
| 1124 } | 1049 } |
| 1125 | 1050 |
| 1126 | 1051 |
| 1127 | 1052 |
| OLD | NEW |