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

Side by Side Diff: mojo/dart/packages/mojo_services/lib/mojo/ui/view_trees.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 view_trees_mojom; 5 library view_trees_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/mojo/service_provider.mojom.dart' as service_provider_mojom ; 10 import 'package:mojo/mojo/service_provider.mojom.dart' as service_provider_mojom ;
(...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after
490 } 490 }
491 491
492 abstract class ViewTree { 492 abstract class ViewTree {
493 static const String serviceName = null; 493 static const String serviceName = null;
494 dynamic getToken([Function responseFactory = null]); 494 dynamic getToken([Function responseFactory = null]);
495 void getServiceProvider(Object serviceProvider); 495 void getServiceProvider(Object serviceProvider);
496 void setRenderer(Object renderer); 496 void setRenderer(Object renderer);
497 void getContainer(Object container); 497 void getContainer(Object container);
498 } 498 }
499 499
500 500 class _ViewTreeProxyControl
501 class _ViewTreeProxyControl extends bindings.ProxyMessageHandler 501 extends bindings.ProxyMessageHandler
502 implements bindings.ProxyControl { 502 implements bindings.ProxyControl {
503 _ViewTreeProxyControl.fromEndpoint( 503 _ViewTreeProxyControl.fromEndpoint(
504 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); 504 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint);
505 505
506 _ViewTreeProxyControl.fromHandle( 506 _ViewTreeProxyControl.fromHandle(
507 core.MojoHandle handle) : super.fromHandle(handle); 507 core.MojoHandle handle) : super.fromHandle(handle);
508 508
509 _ViewTreeProxyControl.unbound() : super.unbound(); 509 _ViewTreeProxyControl.unbound() : super.unbound();
510 510
511 service_describer.ServiceDescription get serviceDescription => 511 service_describer.ServiceDescription get serviceDescription =>
512 new _ViewTreeServiceDescription(); 512 new _ViewTreeServiceDescription();
513 513
514 String get serviceName => ViewTree.serviceName; 514 String get serviceName => ViewTree.serviceName;
515 515
516 @override
517 void handleResponse(bindings.ServiceMessage message) { 516 void handleResponse(bindings.ServiceMessage message) {
518 switch (message.header.type) { 517 switch (message.header.type) {
519 case _viewTreeMethodGetTokenName: 518 case _viewTreeMethodGetTokenName:
520 var r = ViewTreeGetTokenResponseParams.deserialize( 519 var r = ViewTreeGetTokenResponseParams.deserialize(
521 message.payload); 520 message.payload);
522 if (!message.header.hasRequestId) { 521 if (!message.header.hasRequestId) {
523 proxyError("Expected a message with a valid request Id."); 522 proxyError("Expected a message with a valid request Id.");
524 return; 523 return;
525 } 524 }
526 Completer c = completerMap[message.header.requestId]; 525 Completer c = completerMap[message.header.requestId];
(...skipping 16 matching lines...) Expand all
543 } 542 }
544 } 543 }
545 544
546 @override 545 @override
547 String toString() { 546 String toString() {
548 var superString = super.toString(); 547 var superString = super.toString();
549 return "_ViewTreeProxyControl($superString)"; 548 return "_ViewTreeProxyControl($superString)";
550 } 549 }
551 } 550 }
552 551
553 552 class ViewTreeProxy
554 class ViewTreeProxy extends bindings.Proxy 553 extends bindings.Proxy
555 implements ViewTree { 554 implements ViewTree {
556 ViewTreeProxy.fromEndpoint( 555 ViewTreeProxy.fromEndpoint(
557 core.MojoMessagePipeEndpoint endpoint) 556 core.MojoMessagePipeEndpoint endpoint)
558 : super(new _ViewTreeProxyControl.fromEndpoint(endpoint)); 557 : super(new _ViewTreeProxyControl.fromEndpoint(endpoint));
559 558
560 ViewTreeProxy.fromHandle(core.MojoHandle handle) 559 ViewTreeProxy.fromHandle(core.MojoHandle handle)
561 : super(new _ViewTreeProxyControl.fromHandle(handle)); 560 : super(new _ViewTreeProxyControl.fromHandle(handle));
562 561
563 ViewTreeProxy.unbound() 562 ViewTreeProxy.unbound()
564 : super(new _ViewTreeProxyControl.unbound()); 563 : super(new _ViewTreeProxyControl.unbound());
565 564
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
610 ctrl.proxyError("The Proxy is closed."); 609 ctrl.proxyError("The Proxy is closed.");
611 return; 610 return;
612 } 611 }
613 var params = new _ViewTreeGetContainerParams(); 612 var params = new _ViewTreeGetContainerParams();
614 params.container = container; 613 params.container = container;
615 ctrl.sendMessage(params, 614 ctrl.sendMessage(params,
616 _viewTreeMethodGetContainerName); 615 _viewTreeMethodGetContainerName);
617 } 616 }
618 } 617 }
619 618
620 619 class _ViewTreeStubControl
621 class ViewTreeStub extends bindings.Stub { 620 extends bindings.StubMessageHandler
621 implements bindings.StubControl<ViewTree> {
622 ViewTree _impl; 622 ViewTree _impl;
623 623
624 ViewTreeStub.fromEndpoint( 624 _ViewTreeStubControl.fromEndpoint(
625 core.MojoMessagePipeEndpoint endpoint, [ViewTree impl]) 625 core.MojoMessagePipeEndpoint endpoint, [ViewTree impl])
626 : super.fromEndpoint(endpoint, autoBegin: impl != null) { 626 : super.fromEndpoint(endpoint, autoBegin: impl != null) {
627 _impl = impl; 627 _impl = impl;
628 } 628 }
629 629
630 ViewTreeStub.fromHandle( 630 _ViewTreeStubControl.fromHandle(
631 core.MojoHandle handle, [ViewTree impl]) 631 core.MojoHandle handle, [ViewTree impl])
632 : super.fromHandle(handle, autoBegin: impl != null) { 632 : super.fromHandle(handle, autoBegin: impl != null) {
633 _impl = impl; 633 _impl = impl;
634 } 634 }
635 635
636 ViewTreeStub.unbound([this._impl]) : super.unbound(); 636 _ViewTreeStubControl.unbound([this._impl]) : super.unbound();
637
638 static ViewTreeStub newFromEndpoint(
639 core.MojoMessagePipeEndpoint endpoint) {
640 assert(endpoint.setDescription("For ViewTreeStub"));
641 return new ViewTreeStub.fromEndpoint(endpoint);
642 }
643 637
644 638
645 ViewTreeGetTokenResponseParams _viewTreeGetTokenResponseParamsFactory(view_tre e_token_mojom.ViewTreeToken token) { 639 ViewTreeGetTokenResponseParams _viewTreeGetTokenResponseParamsFactory(view_tre e_token_mojom.ViewTreeToken token) {
646 var result = new ViewTreeGetTokenResponseParams(); 640 var result = new ViewTreeGetTokenResponseParams();
647 result.token = token; 641 result.token = token;
648 return result; 642 return result;
649 } 643 }
650 644
651 dynamic handleMessage(bindings.ServiceMessage message) { 645 dynamic handleMessage(bindings.ServiceMessage message) {
652 if (bindings.ControlMessageHandler.isControlMessage(message)) { 646 if (bindings.ControlMessageHandler.isControlMessage(message)) {
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
712 } 706 }
713 707
714 @override 708 @override
715 void bind(core.MojoMessagePipeEndpoint endpoint) { 709 void bind(core.MojoMessagePipeEndpoint endpoint) {
716 super.bind(endpoint); 710 super.bind(endpoint);
717 if (!isOpen && (_impl != null)) { 711 if (!isOpen && (_impl != null)) {
718 beginHandlingEvents(); 712 beginHandlingEvents();
719 } 713 }
720 } 714 }
721 715
716 @override
722 String toString() { 717 String toString() {
723 var superString = super.toString(); 718 var superString = super.toString();
724 return "ViewTreeStub($superString)"; 719 return "_ViewTreeStubControl($superString)";
725 } 720 }
726 721
727 int get version => 0; 722 int get version => 0;
728 723
729 static service_describer.ServiceDescription _cachedServiceDescription; 724 static service_describer.ServiceDescription _cachedServiceDescription;
730 static service_describer.ServiceDescription get serviceDescription { 725 static service_describer.ServiceDescription get serviceDescription {
731 if (_cachedServiceDescription == null) { 726 if (_cachedServiceDescription == null) {
732 _cachedServiceDescription = new _ViewTreeServiceDescription(); 727 _cachedServiceDescription = new _ViewTreeServiceDescription();
733 } 728 }
734 return _cachedServiceDescription; 729 return _cachedServiceDescription;
735 } 730 }
736 } 731 }
737 732
733 class ViewTreeStub
734 extends bindings.Stub<ViewTree>
735 implements ViewTree {
736 ViewTreeStub.fromEndpoint(
737 core.MojoMessagePipeEndpoint endpoint, [ViewTree impl])
738 : super(new _ViewTreeStubControl.fromEndpoint(endpoint, impl));
739
740 ViewTreeStub.fromHandle(
741 core.MojoHandle handle, [ViewTree impl])
742 : super(new _ViewTreeStubControl.fromHandle(handle, impl));
743
744 ViewTreeStub.unbound([ViewTree impl])
745 : super(new _ViewTreeStubControl.unbound(impl));
746
747 static ViewTreeStub newFromEndpoint(
748 core.MojoMessagePipeEndpoint endpoint) {
749 assert(endpoint.setDescription("For ViewTreeStub"));
750 return new ViewTreeStub.fromEndpoint(endpoint);
751 }
752
753 static service_describer.ServiceDescription get serviceDescription =>
754 _ViewTreeStubControl.serviceDescription;
755
756
757 dynamic getToken([Function responseFactory = null]) {
758 return impl.getToken(responseFactory);
759 }
760 void getServiceProvider(Object serviceProvider) {
761 return impl.getServiceProvider(serviceProvider);
762 }
763 void setRenderer(Object renderer) {
764 return impl.setRenderer(renderer);
765 }
766 void getContainer(Object container) {
767 return impl.getContainer(container);
768 }
769 }
770
738 const int _viewTreeListenerMethodOnRendererDiedName = 0; 771 const int _viewTreeListenerMethodOnRendererDiedName = 0;
739 772
740 class _ViewTreeListenerServiceDescription implements service_describer.ServiceDe scription { 773 class _ViewTreeListenerServiceDescription implements service_describer.ServiceDe scription {
741 dynamic getTopLevelInterface([Function responseFactory]) => 774 dynamic getTopLevelInterface([Function responseFactory]) =>
742 responseFactory(null); 775 responseFactory(null);
743 776
744 dynamic getTypeDefinition(String typeKey, [Function responseFactory]) => 777 dynamic getTypeDefinition(String typeKey, [Function responseFactory]) =>
745 responseFactory(null); 778 responseFactory(null);
746 779
747 dynamic getAllTypeDefinitions([Function responseFactory]) => 780 dynamic getAllTypeDefinitions([Function responseFactory]) =>
748 responseFactory(null); 781 responseFactory(null);
749 } 782 }
750 783
751 abstract class ViewTreeListener { 784 abstract class ViewTreeListener {
752 static const String serviceName = null; 785 static const String serviceName = null;
753 dynamic onRendererDied([Function responseFactory = null]); 786 dynamic onRendererDied([Function responseFactory = null]);
754 } 787 }
755 788
756 789 class _ViewTreeListenerProxyControl
757 class _ViewTreeListenerProxyControl extends bindings.ProxyMessageHandler 790 extends bindings.ProxyMessageHandler
758 implements bindings.ProxyControl { 791 implements bindings.ProxyControl {
759 _ViewTreeListenerProxyControl.fromEndpoint( 792 _ViewTreeListenerProxyControl.fromEndpoint(
760 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); 793 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint);
761 794
762 _ViewTreeListenerProxyControl.fromHandle( 795 _ViewTreeListenerProxyControl.fromHandle(
763 core.MojoHandle handle) : super.fromHandle(handle); 796 core.MojoHandle handle) : super.fromHandle(handle);
764 797
765 _ViewTreeListenerProxyControl.unbound() : super.unbound(); 798 _ViewTreeListenerProxyControl.unbound() : super.unbound();
766 799
767 service_describer.ServiceDescription get serviceDescription => 800 service_describer.ServiceDescription get serviceDescription =>
768 new _ViewTreeListenerServiceDescription(); 801 new _ViewTreeListenerServiceDescription();
769 802
770 String get serviceName => ViewTreeListener.serviceName; 803 String get serviceName => ViewTreeListener.serviceName;
771 804
772 @override
773 void handleResponse(bindings.ServiceMessage message) { 805 void handleResponse(bindings.ServiceMessage message) {
774 switch (message.header.type) { 806 switch (message.header.type) {
775 case _viewTreeListenerMethodOnRendererDiedName: 807 case _viewTreeListenerMethodOnRendererDiedName:
776 var r = ViewTreeListenerOnRendererDiedResponseParams.deserialize( 808 var r = ViewTreeListenerOnRendererDiedResponseParams.deserialize(
777 message.payload); 809 message.payload);
778 if (!message.header.hasRequestId) { 810 if (!message.header.hasRequestId) {
779 proxyError("Expected a message with a valid request Id."); 811 proxyError("Expected a message with a valid request Id.");
780 return; 812 return;
781 } 813 }
782 Completer c = completerMap[message.header.requestId]; 814 Completer c = completerMap[message.header.requestId];
(...skipping 16 matching lines...) Expand all
799 } 831 }
800 } 832 }
801 833
802 @override 834 @override
803 String toString() { 835 String toString() {
804 var superString = super.toString(); 836 var superString = super.toString();
805 return "_ViewTreeListenerProxyControl($superString)"; 837 return "_ViewTreeListenerProxyControl($superString)";
806 } 838 }
807 } 839 }
808 840
809 841 class ViewTreeListenerProxy
810 class ViewTreeListenerProxy extends bindings.Proxy 842 extends bindings.Proxy
811 implements ViewTreeListener { 843 implements ViewTreeListener {
812 ViewTreeListenerProxy.fromEndpoint( 844 ViewTreeListenerProxy.fromEndpoint(
813 core.MojoMessagePipeEndpoint endpoint) 845 core.MojoMessagePipeEndpoint endpoint)
814 : super(new _ViewTreeListenerProxyControl.fromEndpoint(endpoint)); 846 : super(new _ViewTreeListenerProxyControl.fromEndpoint(endpoint));
815 847
816 ViewTreeListenerProxy.fromHandle(core.MojoHandle handle) 848 ViewTreeListenerProxy.fromHandle(core.MojoHandle handle)
817 : super(new _ViewTreeListenerProxyControl.fromHandle(handle)); 849 : super(new _ViewTreeListenerProxyControl.fromHandle(handle));
818 850
819 ViewTreeListenerProxy.unbound() 851 ViewTreeListenerProxy.unbound()
820 : super(new _ViewTreeListenerProxyControl.unbound()); 852 : super(new _ViewTreeListenerProxyControl.unbound());
821 853
(...skipping 14 matching lines...) Expand all
836 dynamic onRendererDied([Function responseFactory = null]) { 868 dynamic onRendererDied([Function responseFactory = null]) {
837 var params = new _ViewTreeListenerOnRendererDiedParams(); 869 var params = new _ViewTreeListenerOnRendererDiedParams();
838 return ctrl.sendMessageWithRequestId( 870 return ctrl.sendMessageWithRequestId(
839 params, 871 params,
840 _viewTreeListenerMethodOnRendererDiedName, 872 _viewTreeListenerMethodOnRendererDiedName,
841 -1, 873 -1,
842 bindings.MessageHeader.kMessageExpectsResponse); 874 bindings.MessageHeader.kMessageExpectsResponse);
843 } 875 }
844 } 876 }
845 877
846 878 class _ViewTreeListenerStubControl
847 class ViewTreeListenerStub extends bindings.Stub { 879 extends bindings.StubMessageHandler
880 implements bindings.StubControl<ViewTreeListener> {
848 ViewTreeListener _impl; 881 ViewTreeListener _impl;
849 882
850 ViewTreeListenerStub.fromEndpoint( 883 _ViewTreeListenerStubControl.fromEndpoint(
851 core.MojoMessagePipeEndpoint endpoint, [ViewTreeListener impl]) 884 core.MojoMessagePipeEndpoint endpoint, [ViewTreeListener impl])
852 : super.fromEndpoint(endpoint, autoBegin: impl != null) { 885 : super.fromEndpoint(endpoint, autoBegin: impl != null) {
853 _impl = impl; 886 _impl = impl;
854 } 887 }
855 888
856 ViewTreeListenerStub.fromHandle( 889 _ViewTreeListenerStubControl.fromHandle(
857 core.MojoHandle handle, [ViewTreeListener impl]) 890 core.MojoHandle handle, [ViewTreeListener impl])
858 : super.fromHandle(handle, autoBegin: impl != null) { 891 : super.fromHandle(handle, autoBegin: impl != null) {
859 _impl = impl; 892 _impl = impl;
860 } 893 }
861 894
862 ViewTreeListenerStub.unbound([this._impl]) : super.unbound(); 895 _ViewTreeListenerStubControl.unbound([this._impl]) : super.unbound();
863
864 static ViewTreeListenerStub newFromEndpoint(
865 core.MojoMessagePipeEndpoint endpoint) {
866 assert(endpoint.setDescription("For ViewTreeListenerStub"));
867 return new ViewTreeListenerStub.fromEndpoint(endpoint);
868 }
869 896
870 897
871 ViewTreeListenerOnRendererDiedResponseParams _viewTreeListenerOnRendererDiedRe sponseParamsFactory() { 898 ViewTreeListenerOnRendererDiedResponseParams _viewTreeListenerOnRendererDiedRe sponseParamsFactory() {
872 var result = new ViewTreeListenerOnRendererDiedResponseParams(); 899 var result = new ViewTreeListenerOnRendererDiedResponseParams();
873 return result; 900 return result;
874 } 901 }
875 902
876 dynamic handleMessage(bindings.ServiceMessage message) { 903 dynamic handleMessage(bindings.ServiceMessage message) {
877 if (bindings.ControlMessageHandler.isControlMessage(message)) { 904 if (bindings.ControlMessageHandler.isControlMessage(message)) {
878 return bindings.ControlMessageHandler.handleMessage(this, 905 return bindings.ControlMessageHandler.handleMessage(this,
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
922 } 949 }
923 950
924 @override 951 @override
925 void bind(core.MojoMessagePipeEndpoint endpoint) { 952 void bind(core.MojoMessagePipeEndpoint endpoint) {
926 super.bind(endpoint); 953 super.bind(endpoint);
927 if (!isOpen && (_impl != null)) { 954 if (!isOpen && (_impl != null)) {
928 beginHandlingEvents(); 955 beginHandlingEvents();
929 } 956 }
930 } 957 }
931 958
959 @override
932 String toString() { 960 String toString() {
933 var superString = super.toString(); 961 var superString = super.toString();
934 return "ViewTreeListenerStub($superString)"; 962 return "_ViewTreeListenerStubControl($superString)";
935 } 963 }
936 964
937 int get version => 0; 965 int get version => 0;
938 966
939 static service_describer.ServiceDescription _cachedServiceDescription; 967 static service_describer.ServiceDescription _cachedServiceDescription;
940 static service_describer.ServiceDescription get serviceDescription { 968 static service_describer.ServiceDescription get serviceDescription {
941 if (_cachedServiceDescription == null) { 969 if (_cachedServiceDescription == null) {
942 _cachedServiceDescription = new _ViewTreeListenerServiceDescription(); 970 _cachedServiceDescription = new _ViewTreeListenerServiceDescription();
943 } 971 }
944 return _cachedServiceDescription; 972 return _cachedServiceDescription;
945 } 973 }
946 } 974 }
947 975
976 class ViewTreeListenerStub
977 extends bindings.Stub<ViewTreeListener>
978 implements ViewTreeListener {
979 ViewTreeListenerStub.fromEndpoint(
980 core.MojoMessagePipeEndpoint endpoint, [ViewTreeListener impl])
981 : super(new _ViewTreeListenerStubControl.fromEndpoint(endpoint, impl));
982
983 ViewTreeListenerStub.fromHandle(
984 core.MojoHandle handle, [ViewTreeListener impl])
985 : super(new _ViewTreeListenerStubControl.fromHandle(handle, impl));
986
987 ViewTreeListenerStub.unbound([ViewTreeListener impl])
988 : super(new _ViewTreeListenerStubControl.unbound(impl));
989
990 static ViewTreeListenerStub newFromEndpoint(
991 core.MojoMessagePipeEndpoint endpoint) {
992 assert(endpoint.setDescription("For ViewTreeListenerStub"));
993 return new ViewTreeListenerStub.fromEndpoint(endpoint);
994 }
995
996 static service_describer.ServiceDescription get serviceDescription =>
997 _ViewTreeListenerStubControl.serviceDescription;
998
999
1000 dynamic onRendererDied([Function responseFactory = null]) {
1001 return impl.onRendererDied(responseFactory);
1002 }
1003 }
1004
948 1005
949 1006
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698