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

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

Issue 1983453002: Dart: Refactor Stubs (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 706 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 dynamic hitTest(geometry_mojom.PointF point,[Function responseFactory = null]) ; 724 dynamic hitTest(geometry_mojom.PointF point,[Function responseFactory = null]) ;
725 } 725 }
726 726
727 727 class _HitTesterProxyControl
728 class _HitTesterProxyControl extends bindings.ProxyMessageHandler 728 extends bindings.ProxyMessageHandler
729 implements bindings.ProxyControl { 729 implements bindings.ProxyControl {
730 _HitTesterProxyControl.fromEndpoint( 730 _HitTesterProxyControl.fromEndpoint(
731 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); 731 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint);
732 732
733 _HitTesterProxyControl.fromHandle( 733 _HitTesterProxyControl.fromHandle(
734 core.MojoHandle handle) : super.fromHandle(handle); 734 core.MojoHandle handle) : super.fromHandle(handle);
735 735
736 _HitTesterProxyControl.unbound() : super.unbound(); 736 _HitTesterProxyControl.unbound() : super.unbound();
737 737
738 service_describer.ServiceDescription get serviceDescription => 738 service_describer.ServiceDescription get serviceDescription =>
739 new _HitTesterServiceDescription(); 739 new _HitTesterServiceDescription();
740 740
741 String get serviceName => HitTester.serviceName; 741 String get serviceName => HitTester.serviceName;
742 742
743 @override
744 void handleResponse(bindings.ServiceMessage message) { 743 void handleResponse(bindings.ServiceMessage message) {
745 switch (message.header.type) { 744 switch (message.header.type) {
746 case _hitTesterMethodHitTestName: 745 case _hitTesterMethodHitTestName:
747 var r = HitTesterHitTestResponseParams.deserialize( 746 var r = HitTesterHitTestResponseParams.deserialize(
748 message.payload); 747 message.payload);
749 if (!message.header.hasRequestId) { 748 if (!message.header.hasRequestId) {
750 proxyError("Expected a message with a valid request Id."); 749 proxyError("Expected a message with a valid request Id.");
751 return; 750 return;
752 } 751 }
753 Completer c = completerMap[message.header.requestId]; 752 Completer c = completerMap[message.header.requestId];
(...skipping 16 matching lines...) Expand all
770 } 769 }
771 } 770 }
772 771
773 @override 772 @override
774 String toString() { 773 String toString() {
775 var superString = super.toString(); 774 var superString = super.toString();
776 return "_HitTesterProxyControl($superString)"; 775 return "_HitTesterProxyControl($superString)";
777 } 776 }
778 } 777 }
779 778
780 779 class HitTesterProxy
781 class HitTesterProxy extends bindings.Proxy 780 extends bindings.Proxy
782 implements HitTester { 781 implements HitTester {
783 HitTesterProxy.fromEndpoint( 782 HitTesterProxy.fromEndpoint(
784 core.MojoMessagePipeEndpoint endpoint) 783 core.MojoMessagePipeEndpoint endpoint)
785 : super(new _HitTesterProxyControl.fromEndpoint(endpoint)); 784 : super(new _HitTesterProxyControl.fromEndpoint(endpoint));
786 785
787 HitTesterProxy.fromHandle(core.MojoHandle handle) 786 HitTesterProxy.fromHandle(core.MojoHandle handle)
788 : super(new _HitTesterProxyControl.fromHandle(handle)); 787 : super(new _HitTesterProxyControl.fromHandle(handle));
789 788
790 HitTesterProxy.unbound() 789 HitTesterProxy.unbound()
791 : super(new _HitTesterProxyControl.unbound()); 790 : super(new _HitTesterProxyControl.unbound());
792 791
(...skipping 15 matching lines...) Expand all
808 var params = new _HitTesterHitTestParams(); 807 var params = new _HitTesterHitTestParams();
809 params.point = point; 808 params.point = point;
810 return ctrl.sendMessageWithRequestId( 809 return ctrl.sendMessageWithRequestId(
811 params, 810 params,
812 _hitTesterMethodHitTestName, 811 _hitTesterMethodHitTestName,
813 -1, 812 -1,
814 bindings.MessageHeader.kMessageExpectsResponse); 813 bindings.MessageHeader.kMessageExpectsResponse);
815 } 814 }
816 } 815 }
817 816
818 817 class _HitTesterStubControl
819 class HitTesterStub extends bindings.Stub { 818 extends bindings.StubMessageHandler
819 implements bindings.StubControl<HitTester> {
820 HitTester _impl; 820 HitTester _impl;
821 821
822 HitTesterStub.fromEndpoint( 822 _HitTesterStubControl.fromEndpoint(
823 core.MojoMessagePipeEndpoint endpoint, [HitTester impl]) 823 core.MojoMessagePipeEndpoint endpoint, [HitTester impl])
824 : super.fromEndpoint(endpoint, autoBegin: impl != null) { 824 : super.fromEndpoint(endpoint, autoBegin: impl != null) {
825 _impl = impl; 825 _impl = impl;
826 } 826 }
827 827
828 HitTesterStub.fromHandle( 828 _HitTesterStubControl.fromHandle(
829 core.MojoHandle handle, [HitTester impl]) 829 core.MojoHandle handle, [HitTester impl])
830 : super.fromHandle(handle, autoBegin: impl != null) { 830 : super.fromHandle(handle, autoBegin: impl != null) {
831 _impl = impl; 831 _impl = impl;
832 } 832 }
833 833
834 HitTesterStub.unbound([this._impl]) : super.unbound(); 834 _HitTesterStubControl.unbound([this._impl]) : super.unbound();
835
836 static HitTesterStub newFromEndpoint(
837 core.MojoMessagePipeEndpoint endpoint) {
838 assert(endpoint.setDescription("For HitTesterStub"));
839 return new HitTesterStub.fromEndpoint(endpoint);
840 }
841 835
842 836
843 HitTesterHitTestResponseParams _hitTesterHitTestResponseParamsFactory(HitTestR esult result) { 837 HitTesterHitTestResponseParams _hitTesterHitTestResponseParamsFactory(HitTestR esult result) {
844 var result = new HitTesterHitTestResponseParams(); 838 var result = new HitTesterHitTestResponseParams();
845 result.result = result; 839 result.result = result;
846 return result; 840 return result;
847 } 841 }
848 842
849 dynamic handleMessage(bindings.ServiceMessage message) { 843 dynamic handleMessage(bindings.ServiceMessage message) {
850 if (bindings.ControlMessageHandler.isControlMessage(message)) { 844 if (bindings.ControlMessageHandler.isControlMessage(message)) {
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
897 } 891 }
898 892
899 @override 893 @override
900 void bind(core.MojoMessagePipeEndpoint endpoint) { 894 void bind(core.MojoMessagePipeEndpoint endpoint) {
901 super.bind(endpoint); 895 super.bind(endpoint);
902 if (!isOpen && (_impl != null)) { 896 if (!isOpen && (_impl != null)) {
903 beginHandlingEvents(); 897 beginHandlingEvents();
904 } 898 }
905 } 899 }
906 900
901 @override
907 String toString() { 902 String toString() {
908 var superString = super.toString(); 903 var superString = super.toString();
909 return "HitTesterStub($superString)"; 904 return "_HitTesterStubControl($superString)";
910 } 905 }
911 906
912 int get version => 0; 907 int get version => 0;
913 908
914 static service_describer.ServiceDescription _cachedServiceDescription; 909 static service_describer.ServiceDescription _cachedServiceDescription;
915 static service_describer.ServiceDescription get serviceDescription { 910 static service_describer.ServiceDescription get serviceDescription {
916 if (_cachedServiceDescription == null) { 911 if (_cachedServiceDescription == null) {
917 _cachedServiceDescription = new _HitTesterServiceDescription(); 912 _cachedServiceDescription = new _HitTesterServiceDescription();
918 } 913 }
919 return _cachedServiceDescription; 914 return _cachedServiceDescription;
920 } 915 }
921 } 916 }
922 917
918 class HitTesterStub
919 extends bindings.Stub<HitTester>
920 implements HitTester {
921 HitTesterStub.fromEndpoint(
922 core.MojoMessagePipeEndpoint endpoint, [HitTester impl])
923 : super(new _HitTesterStubControl.fromEndpoint(endpoint, impl));
924
925 HitTesterStub.fromHandle(
926 core.MojoHandle handle, [HitTester impl])
927 : super(new _HitTesterStubControl.fromHandle(handle, impl));
928
929 HitTesterStub.unbound([HitTester impl])
930 : super(new _HitTesterStubControl.unbound(impl));
931
932 static HitTesterStub newFromEndpoint(
933 core.MojoMessagePipeEndpoint endpoint) {
934 assert(endpoint.setDescription("For HitTesterStub"));
935 return new HitTesterStub.fromEndpoint(endpoint);
936 }
937
938 static service_describer.ServiceDescription get serviceDescription =>
939 _HitTesterStubControl.serviceDescription;
940
941
942 dynamic hitTest(geometry_mojom.PointF point,[Function responseFactory = null]) {
943 return impl.hitTest(point,responseFactory);
944 }
945 }
946
923 947
924 948
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698