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

Side by Side Diff: mojo/dart/packages/mojo_services/lib/mojo/gfx/composition/hit_tests.mojom.dart

Issue 1998433002: Dart: Adds Interface and InterfaceRequest interfaces. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Merge Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 library hit_tests_mojom; 5 library hit_tests_mojom;
6 import 'dart:async'; 6 import 'dart:async';
7 import 'package:mojo/bindings.dart' as bindings; 7 import 'package:mojo/bindings.dart' as bindings;
8 import 'package:mojo/core.dart' as core; 8 import 'package:mojo/core.dart' as core;
9 import 'package:mojo/mojo/bindings/types/service_describer.mojom.dart' as servic e_describer; 9 import 'package:mojo/mojo/bindings/types/service_describer.mojom.dart' as servic e_describer;
10 import 'package:mojo_services/mojo/geometry.mojom.dart' as geometry_mojom; 10 import 'package:mojo_services/mojo/geometry.mojom.dart' as geometry_mojom;
(...skipping 703 matching lines...) Expand 10 before | Expand all | Expand 10 after
714 714
715 dynamic getTypeDefinition(String typeKey, [Function responseFactory]) => 715 dynamic getTypeDefinition(String typeKey, [Function responseFactory]) =>
716 responseFactory(null); 716 responseFactory(null);
717 717
718 dynamic getAllTypeDefinitions([Function responseFactory]) => 718 dynamic getAllTypeDefinitions([Function responseFactory]) =>
719 responseFactory(null); 719 responseFactory(null);
720 } 720 }
721 721
722 abstract class HitTester { 722 abstract class HitTester {
723 static const String serviceName = null; 723 static const String serviceName = null;
724
725 static service_describer.ServiceDescription _cachedServiceDescription;
726 static service_describer.ServiceDescription get serviceDescription {
727 if (_cachedServiceDescription == null) {
728 _cachedServiceDescription = new _HitTesterServiceDescription();
729 }
730 return _cachedServiceDescription;
731 }
732
733 static HitTesterProxy connectToService(
734 bindings.ServiceConnector s, String url, [String serviceName]) {
735 HitTesterProxy p = new HitTesterProxy.unbound();
736 String name = serviceName ?? HitTester.serviceName;
737 if ((name == null) || name.isEmpty) {
738 throw new core.MojoApiError(
739 "If an interface has no ServiceName, then one must be provided.");
740 }
741 s.connectToService(url, p, name);
742 return p;
743 }
724 dynamic hitTest(geometry_mojom.PointF point,[Function responseFactory = null]) ; 744 dynamic hitTest(geometry_mojom.PointF point,[Function responseFactory = null]) ;
725 } 745 }
726 746
747 abstract class HitTesterInterface
748 implements bindings.MojoInterface<HitTester>,
749 HitTester {
750 factory HitTesterInterface([HitTester impl]) =>
751 new HitTesterStub.unbound(impl);
752 factory HitTesterInterface.fromEndpoint(
753 core.MojoMessagePipeEndpoint endpoint,
754 [HitTester impl]) =>
755 new HitTesterStub.fromEndpoint(endpoint, impl);
756 }
757
758 abstract class HitTesterInterfaceRequest
759 implements bindings.MojoInterface<HitTester>,
760 HitTester {
761 factory HitTesterInterfaceRequest() =>
762 new HitTesterProxy.unbound();
763 }
764
727 class _HitTesterProxyControl 765 class _HitTesterProxyControl
728 extends bindings.ProxyMessageHandler 766 extends bindings.ProxyMessageHandler
729 implements bindings.ProxyControl { 767 implements bindings.ProxyControl<HitTester> {
730 _HitTesterProxyControl.fromEndpoint( 768 _HitTesterProxyControl.fromEndpoint(
731 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); 769 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint);
732 770
733 _HitTesterProxyControl.fromHandle( 771 _HitTesterProxyControl.fromHandle(
734 core.MojoHandle handle) : super.fromHandle(handle); 772 core.MojoHandle handle) : super.fromHandle(handle);
735 773
736 _HitTesterProxyControl.unbound() : super.unbound(); 774 _HitTesterProxyControl.unbound() : super.unbound();
737 775
738 service_describer.ServiceDescription get serviceDescription =>
739 new _HitTesterServiceDescription();
740
741 String get serviceName => HitTester.serviceName; 776 String get serviceName => HitTester.serviceName;
742 777
743 void handleResponse(bindings.ServiceMessage message) { 778 void handleResponse(bindings.ServiceMessage message) {
744 switch (message.header.type) { 779 switch (message.header.type) {
745 case _hitTesterMethodHitTestName: 780 case _hitTesterMethodHitTestName:
746 var r = HitTesterHitTestResponseParams.deserialize( 781 var r = HitTesterHitTestResponseParams.deserialize(
747 message.payload); 782 message.payload);
748 if (!message.header.hasRequestId) { 783 if (!message.header.hasRequestId) {
749 proxyError("Expected a message with a valid request Id."); 784 proxyError("Expected a message with a valid request Id.");
750 return; 785 return;
(...skipping 11 matching lines...) Expand all
762 } 797 }
763 c.complete(r); 798 c.complete(r);
764 break; 799 break;
765 default: 800 default:
766 proxyError("Unexpected message type: ${message.header.type}"); 801 proxyError("Unexpected message type: ${message.header.type}");
767 close(immediate: true); 802 close(immediate: true);
768 break; 803 break;
769 } 804 }
770 } 805 }
771 806
807 HitTester get impl => null;
808 set impl(HitTester _) {
809 throw new core.MojoApiError("The impl of a Proxy cannot be set.");
810 }
811
772 @override 812 @override
773 String toString() { 813 String toString() {
774 var superString = super.toString(); 814 var superString = super.toString();
775 return "_HitTesterProxyControl($superString)"; 815 return "_HitTesterProxyControl($superString)";
776 } 816 }
777 } 817 }
778 818
779 class HitTesterProxy 819 class HitTesterProxy
780 extends bindings.Proxy 820 extends bindings.Proxy<HitTester>
781 implements HitTester { 821 implements HitTester,
822 HitTesterInterface,
823 HitTesterInterfaceRequest {
782 HitTesterProxy.fromEndpoint( 824 HitTesterProxy.fromEndpoint(
783 core.MojoMessagePipeEndpoint endpoint) 825 core.MojoMessagePipeEndpoint endpoint)
784 : super(new _HitTesterProxyControl.fromEndpoint(endpoint)); 826 : super(new _HitTesterProxyControl.fromEndpoint(endpoint));
785 827
786 HitTesterProxy.fromHandle(core.MojoHandle handle) 828 HitTesterProxy.fromHandle(core.MojoHandle handle)
787 : super(new _HitTesterProxyControl.fromHandle(handle)); 829 : super(new _HitTesterProxyControl.fromHandle(handle));
788 830
789 HitTesterProxy.unbound() 831 HitTesterProxy.unbound()
790 : super(new _HitTesterProxyControl.unbound()); 832 : super(new _HitTesterProxyControl.unbound());
791 833
792 static HitTesterProxy newFromEndpoint( 834 static HitTesterProxy newFromEndpoint(
793 core.MojoMessagePipeEndpoint endpoint) { 835 core.MojoMessagePipeEndpoint endpoint) {
794 assert(endpoint.setDescription("For HitTesterProxy")); 836 assert(endpoint.setDescription("For HitTesterProxy"));
795 return new HitTesterProxy.fromEndpoint(endpoint); 837 return new HitTesterProxy.fromEndpoint(endpoint);
796 } 838 }
797 839
798 factory HitTesterProxy.connectToService(
799 bindings.ServiceConnector s, String url, [String serviceName]) {
800 HitTesterProxy p = new HitTesterProxy.unbound();
801 s.connectToService(url, p, serviceName);
802 return p;
803 }
804
805 840
806 dynamic hitTest(geometry_mojom.PointF point,[Function responseFactory = null]) { 841 dynamic hitTest(geometry_mojom.PointF point,[Function responseFactory = null]) {
807 var params = new _HitTesterHitTestParams(); 842 var params = new _HitTesterHitTestParams();
808 params.point = point; 843 params.point = point;
809 return ctrl.sendMessageWithRequestId( 844 return ctrl.sendMessageWithRequestId(
810 params, 845 params,
811 _hitTesterMethodHitTestName, 846 _hitTesterMethodHitTestName,
812 -1, 847 -1,
813 bindings.MessageHeader.kMessageExpectsResponse); 848 bindings.MessageHeader.kMessageExpectsResponse);
814 } 849 }
(...skipping 11 matching lines...) Expand all
826 } 861 }
827 862
828 _HitTesterStubControl.fromHandle( 863 _HitTesterStubControl.fromHandle(
829 core.MojoHandle handle, [HitTester impl]) 864 core.MojoHandle handle, [HitTester impl])
830 : super.fromHandle(handle, autoBegin: impl != null) { 865 : super.fromHandle(handle, autoBegin: impl != null) {
831 _impl = impl; 866 _impl = impl;
832 } 867 }
833 868
834 _HitTesterStubControl.unbound([this._impl]) : super.unbound(); 869 _HitTesterStubControl.unbound([this._impl]) : super.unbound();
835 870
871 String get serviceName => HitTester.serviceName;
872
836 873
837 HitTesterHitTestResponseParams _hitTesterHitTestResponseParamsFactory(HitTestR esult result) { 874 HitTesterHitTestResponseParams _hitTesterHitTestResponseParamsFactory(HitTestR esult result) {
838 var result = new HitTesterHitTestResponseParams(); 875 var result = new HitTesterHitTestResponseParams();
839 result.result = result; 876 result.result = result;
840 return result; 877 return result;
841 } 878 }
842 879
843 dynamic handleMessage(bindings.ServiceMessage message) { 880 dynamic handleMessage(bindings.ServiceMessage message) {
844 if (bindings.ControlMessageHandler.isControlMessage(message)) { 881 if (bindings.ControlMessageHandler.isControlMessage(message)) {
845 return bindings.ControlMessageHandler.handleMessage(this, 882 return bindings.ControlMessageHandler.handleMessage(this,
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
898 } 935 }
899 } 936 }
900 937
901 @override 938 @override
902 String toString() { 939 String toString() {
903 var superString = super.toString(); 940 var superString = super.toString();
904 return "_HitTesterStubControl($superString)"; 941 return "_HitTesterStubControl($superString)";
905 } 942 }
906 943
907 int get version => 0; 944 int get version => 0;
908
909 static service_describer.ServiceDescription _cachedServiceDescription;
910 static service_describer.ServiceDescription get serviceDescription {
911 if (_cachedServiceDescription == null) {
912 _cachedServiceDescription = new _HitTesterServiceDescription();
913 }
914 return _cachedServiceDescription;
915 }
916 } 945 }
917 946
918 class HitTesterStub 947 class HitTesterStub
919 extends bindings.Stub<HitTester> 948 extends bindings.Stub<HitTester>
920 implements HitTester { 949 implements HitTester,
950 HitTesterInterface,
951 HitTesterInterfaceRequest {
952 HitTesterStub.unbound([HitTester impl])
953 : super(new _HitTesterStubControl.unbound(impl));
954
921 HitTesterStub.fromEndpoint( 955 HitTesterStub.fromEndpoint(
922 core.MojoMessagePipeEndpoint endpoint, [HitTester impl]) 956 core.MojoMessagePipeEndpoint endpoint, [HitTester impl])
923 : super(new _HitTesterStubControl.fromEndpoint(endpoint, impl)); 957 : super(new _HitTesterStubControl.fromEndpoint(endpoint, impl));
924 958
925 HitTesterStub.fromHandle( 959 HitTesterStub.fromHandle(
926 core.MojoHandle handle, [HitTester impl]) 960 core.MojoHandle handle, [HitTester impl])
927 : super(new _HitTesterStubControl.fromHandle(handle, impl)); 961 : super(new _HitTesterStubControl.fromHandle(handle, impl));
928 962
929 HitTesterStub.unbound([HitTester impl])
930 : super(new _HitTesterStubControl.unbound(impl));
931
932 static HitTesterStub newFromEndpoint( 963 static HitTesterStub newFromEndpoint(
933 core.MojoMessagePipeEndpoint endpoint) { 964 core.MojoMessagePipeEndpoint endpoint) {
934 assert(endpoint.setDescription("For HitTesterStub")); 965 assert(endpoint.setDescription("For HitTesterStub"));
935 return new HitTesterStub.fromEndpoint(endpoint); 966 return new HitTesterStub.fromEndpoint(endpoint);
936 } 967 }
937 968
938 static service_describer.ServiceDescription get serviceDescription =>
939 _HitTesterStubControl.serviceDescription;
940
941 969
942 dynamic hitTest(geometry_mojom.PointF point,[Function responseFactory = null]) { 970 dynamic hitTest(geometry_mojom.PointF point,[Function responseFactory = null]) {
943 return impl.hitTest(point,responseFactory); 971 return impl.hitTest(point,responseFactory);
944 } 972 }
945 } 973 }
946 974
947 975
948 976
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698