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 views_mojom; | 5 library views_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 509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
520 } | 520 } |
521 | 521 |
522 abstract class View { | 522 abstract class View { |
523 static const String serviceName = null; | 523 static const String serviceName = null; |
524 dynamic getToken([Function responseFactory = null]); | 524 dynamic getToken([Function responseFactory = null]); |
525 void getServiceProvider(Object serviceProvider); | 525 void getServiceProvider(Object serviceProvider); |
526 void createScene(Object scene); | 526 void createScene(Object scene); |
527 void getContainer(Object container); | 527 void getContainer(Object container); |
528 } | 528 } |
529 | 529 |
530 | 530 class _ViewProxyControl |
531 class _ViewProxyControl extends bindings.ProxyMessageHandler | 531 extends bindings.ProxyMessageHandler |
532 implements bindings.ProxyControl { | 532 implements bindings.ProxyControl { |
533 _ViewProxyControl.fromEndpoint( | 533 _ViewProxyControl.fromEndpoint( |
534 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); | 534 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); |
535 | 535 |
536 _ViewProxyControl.fromHandle( | 536 _ViewProxyControl.fromHandle( |
537 core.MojoHandle handle) : super.fromHandle(handle); | 537 core.MojoHandle handle) : super.fromHandle(handle); |
538 | 538 |
539 _ViewProxyControl.unbound() : super.unbound(); | 539 _ViewProxyControl.unbound() : super.unbound(); |
540 | 540 |
541 service_describer.ServiceDescription get serviceDescription => | 541 service_describer.ServiceDescription get serviceDescription => |
542 new _ViewServiceDescription(); | 542 new _ViewServiceDescription(); |
543 | 543 |
544 String get serviceName => View.serviceName; | 544 String get serviceName => View.serviceName; |
545 | 545 |
546 @override | |
547 void handleResponse(bindings.ServiceMessage message) { | 546 void handleResponse(bindings.ServiceMessage message) { |
548 switch (message.header.type) { | 547 switch (message.header.type) { |
549 case _viewMethodGetTokenName: | 548 case _viewMethodGetTokenName: |
550 var r = ViewGetTokenResponseParams.deserialize( | 549 var r = ViewGetTokenResponseParams.deserialize( |
551 message.payload); | 550 message.payload); |
552 if (!message.header.hasRequestId) { | 551 if (!message.header.hasRequestId) { |
553 proxyError("Expected a message with a valid request Id."); | 552 proxyError("Expected a message with a valid request Id."); |
554 return; | 553 return; |
555 } | 554 } |
556 Completer c = completerMap[message.header.requestId]; | 555 Completer c = completerMap[message.header.requestId]; |
(...skipping 16 matching lines...) Expand all Loading... |
573 } | 572 } |
574 } | 573 } |
575 | 574 |
576 @override | 575 @override |
577 String toString() { | 576 String toString() { |
578 var superString = super.toString(); | 577 var superString = super.toString(); |
579 return "_ViewProxyControl($superString)"; | 578 return "_ViewProxyControl($superString)"; |
580 } | 579 } |
581 } | 580 } |
582 | 581 |
583 | 582 class ViewProxy |
584 class ViewProxy extends bindings.Proxy | 583 extends bindings.Proxy |
585 implements View { | 584 implements View { |
586 ViewProxy.fromEndpoint( | 585 ViewProxy.fromEndpoint( |
587 core.MojoMessagePipeEndpoint endpoint) | 586 core.MojoMessagePipeEndpoint endpoint) |
588 : super(new _ViewProxyControl.fromEndpoint(endpoint)); | 587 : super(new _ViewProxyControl.fromEndpoint(endpoint)); |
589 | 588 |
590 ViewProxy.fromHandle(core.MojoHandle handle) | 589 ViewProxy.fromHandle(core.MojoHandle handle) |
591 : super(new _ViewProxyControl.fromHandle(handle)); | 590 : super(new _ViewProxyControl.fromHandle(handle)); |
592 | 591 |
593 ViewProxy.unbound() | 592 ViewProxy.unbound() |
594 : super(new _ViewProxyControl.unbound()); | 593 : super(new _ViewProxyControl.unbound()); |
595 | 594 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
640 ctrl.proxyError("The Proxy is closed."); | 639 ctrl.proxyError("The Proxy is closed."); |
641 return; | 640 return; |
642 } | 641 } |
643 var params = new _ViewGetContainerParams(); | 642 var params = new _ViewGetContainerParams(); |
644 params.container = container; | 643 params.container = container; |
645 ctrl.sendMessage(params, | 644 ctrl.sendMessage(params, |
646 _viewMethodGetContainerName); | 645 _viewMethodGetContainerName); |
647 } | 646 } |
648 } | 647 } |
649 | 648 |
650 | 649 class _ViewStubControl |
651 class ViewStub extends bindings.Stub { | 650 extends bindings.StubMessageHandler |
| 651 implements bindings.StubControl<View> { |
652 View _impl; | 652 View _impl; |
653 | 653 |
654 ViewStub.fromEndpoint( | 654 _ViewStubControl.fromEndpoint( |
655 core.MojoMessagePipeEndpoint endpoint, [View impl]) | 655 core.MojoMessagePipeEndpoint endpoint, [View impl]) |
656 : super.fromEndpoint(endpoint, autoBegin: impl != null) { | 656 : super.fromEndpoint(endpoint, autoBegin: impl != null) { |
657 _impl = impl; | 657 _impl = impl; |
658 } | 658 } |
659 | 659 |
660 ViewStub.fromHandle( | 660 _ViewStubControl.fromHandle( |
661 core.MojoHandle handle, [View impl]) | 661 core.MojoHandle handle, [View impl]) |
662 : super.fromHandle(handle, autoBegin: impl != null) { | 662 : super.fromHandle(handle, autoBegin: impl != null) { |
663 _impl = impl; | 663 _impl = impl; |
664 } | 664 } |
665 | 665 |
666 ViewStub.unbound([this._impl]) : super.unbound(); | 666 _ViewStubControl.unbound([this._impl]) : super.unbound(); |
667 | |
668 static ViewStub newFromEndpoint( | |
669 core.MojoMessagePipeEndpoint endpoint) { | |
670 assert(endpoint.setDescription("For ViewStub")); | |
671 return new ViewStub.fromEndpoint(endpoint); | |
672 } | |
673 | 667 |
674 | 668 |
675 ViewGetTokenResponseParams _viewGetTokenResponseParamsFactory(view_token_mojom
.ViewToken token) { | 669 ViewGetTokenResponseParams _viewGetTokenResponseParamsFactory(view_token_mojom
.ViewToken token) { |
676 var result = new ViewGetTokenResponseParams(); | 670 var result = new ViewGetTokenResponseParams(); |
677 result.token = token; | 671 result.token = token; |
678 return result; | 672 return result; |
679 } | 673 } |
680 | 674 |
681 dynamic handleMessage(bindings.ServiceMessage message) { | 675 dynamic handleMessage(bindings.ServiceMessage message) { |
682 if (bindings.ControlMessageHandler.isControlMessage(message)) { | 676 if (bindings.ControlMessageHandler.isControlMessage(message)) { |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
742 } | 736 } |
743 | 737 |
744 @override | 738 @override |
745 void bind(core.MojoMessagePipeEndpoint endpoint) { | 739 void bind(core.MojoMessagePipeEndpoint endpoint) { |
746 super.bind(endpoint); | 740 super.bind(endpoint); |
747 if (!isOpen && (_impl != null)) { | 741 if (!isOpen && (_impl != null)) { |
748 beginHandlingEvents(); | 742 beginHandlingEvents(); |
749 } | 743 } |
750 } | 744 } |
751 | 745 |
| 746 @override |
752 String toString() { | 747 String toString() { |
753 var superString = super.toString(); | 748 var superString = super.toString(); |
754 return "ViewStub($superString)"; | 749 return "_ViewStubControl($superString)"; |
755 } | 750 } |
756 | 751 |
757 int get version => 0; | 752 int get version => 0; |
758 | 753 |
759 static service_describer.ServiceDescription _cachedServiceDescription; | 754 static service_describer.ServiceDescription _cachedServiceDescription; |
760 static service_describer.ServiceDescription get serviceDescription { | 755 static service_describer.ServiceDescription get serviceDescription { |
761 if (_cachedServiceDescription == null) { | 756 if (_cachedServiceDescription == null) { |
762 _cachedServiceDescription = new _ViewServiceDescription(); | 757 _cachedServiceDescription = new _ViewServiceDescription(); |
763 } | 758 } |
764 return _cachedServiceDescription; | 759 return _cachedServiceDescription; |
765 } | 760 } |
766 } | 761 } |
767 | 762 |
| 763 class ViewStub |
| 764 extends bindings.Stub<View> |
| 765 implements View { |
| 766 ViewStub.fromEndpoint( |
| 767 core.MojoMessagePipeEndpoint endpoint, [View impl]) |
| 768 : super(new _ViewStubControl.fromEndpoint(endpoint, impl)); |
| 769 |
| 770 ViewStub.fromHandle( |
| 771 core.MojoHandle handle, [View impl]) |
| 772 : super(new _ViewStubControl.fromHandle(handle, impl)); |
| 773 |
| 774 ViewStub.unbound([View impl]) |
| 775 : super(new _ViewStubControl.unbound(impl)); |
| 776 |
| 777 static ViewStub newFromEndpoint( |
| 778 core.MojoMessagePipeEndpoint endpoint) { |
| 779 assert(endpoint.setDescription("For ViewStub")); |
| 780 return new ViewStub.fromEndpoint(endpoint); |
| 781 } |
| 782 |
| 783 static service_describer.ServiceDescription get serviceDescription => |
| 784 _ViewStubControl.serviceDescription; |
| 785 |
| 786 |
| 787 dynamic getToken([Function responseFactory = null]) { |
| 788 return impl.getToken(responseFactory); |
| 789 } |
| 790 void getServiceProvider(Object serviceProvider) { |
| 791 return impl.getServiceProvider(serviceProvider); |
| 792 } |
| 793 void createScene(Object scene) { |
| 794 return impl.createScene(scene); |
| 795 } |
| 796 void getContainer(Object container) { |
| 797 return impl.getContainer(container); |
| 798 } |
| 799 } |
| 800 |
768 const int _viewListenerMethodOnPropertiesChangedName = 0; | 801 const int _viewListenerMethodOnPropertiesChangedName = 0; |
769 | 802 |
770 class _ViewListenerServiceDescription implements service_describer.ServiceDescri
ption { | 803 class _ViewListenerServiceDescription implements service_describer.ServiceDescri
ption { |
771 dynamic getTopLevelInterface([Function responseFactory]) => | 804 dynamic getTopLevelInterface([Function responseFactory]) => |
772 responseFactory(null); | 805 responseFactory(null); |
773 | 806 |
774 dynamic getTypeDefinition(String typeKey, [Function responseFactory]) => | 807 dynamic getTypeDefinition(String typeKey, [Function responseFactory]) => |
775 responseFactory(null); | 808 responseFactory(null); |
776 | 809 |
777 dynamic getAllTypeDefinitions([Function responseFactory]) => | 810 dynamic getAllTypeDefinitions([Function responseFactory]) => |
778 responseFactory(null); | 811 responseFactory(null); |
779 } | 812 } |
780 | 813 |
781 abstract class ViewListener { | 814 abstract class ViewListener { |
782 static const String serviceName = null; | 815 static const String serviceName = null; |
783 dynamic onPropertiesChanged(int sceneVersion,view_properties_mojom.ViewPropert
ies properties,[Function responseFactory = null]); | 816 dynamic onPropertiesChanged(int sceneVersion,view_properties_mojom.ViewPropert
ies properties,[Function responseFactory = null]); |
784 } | 817 } |
785 | 818 |
786 | 819 class _ViewListenerProxyControl |
787 class _ViewListenerProxyControl extends bindings.ProxyMessageHandler | 820 extends bindings.ProxyMessageHandler |
788 implements bindings.ProxyControl { | 821 implements bindings.ProxyControl { |
789 _ViewListenerProxyControl.fromEndpoint( | 822 _ViewListenerProxyControl.fromEndpoint( |
790 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); | 823 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); |
791 | 824 |
792 _ViewListenerProxyControl.fromHandle( | 825 _ViewListenerProxyControl.fromHandle( |
793 core.MojoHandle handle) : super.fromHandle(handle); | 826 core.MojoHandle handle) : super.fromHandle(handle); |
794 | 827 |
795 _ViewListenerProxyControl.unbound() : super.unbound(); | 828 _ViewListenerProxyControl.unbound() : super.unbound(); |
796 | 829 |
797 service_describer.ServiceDescription get serviceDescription => | 830 service_describer.ServiceDescription get serviceDescription => |
798 new _ViewListenerServiceDescription(); | 831 new _ViewListenerServiceDescription(); |
799 | 832 |
800 String get serviceName => ViewListener.serviceName; | 833 String get serviceName => ViewListener.serviceName; |
801 | 834 |
802 @override | |
803 void handleResponse(bindings.ServiceMessage message) { | 835 void handleResponse(bindings.ServiceMessage message) { |
804 switch (message.header.type) { | 836 switch (message.header.type) { |
805 case _viewListenerMethodOnPropertiesChangedName: | 837 case _viewListenerMethodOnPropertiesChangedName: |
806 var r = ViewListenerOnPropertiesChangedResponseParams.deserialize( | 838 var r = ViewListenerOnPropertiesChangedResponseParams.deserialize( |
807 message.payload); | 839 message.payload); |
808 if (!message.header.hasRequestId) { | 840 if (!message.header.hasRequestId) { |
809 proxyError("Expected a message with a valid request Id."); | 841 proxyError("Expected a message with a valid request Id."); |
810 return; | 842 return; |
811 } | 843 } |
812 Completer c = completerMap[message.header.requestId]; | 844 Completer c = completerMap[message.header.requestId]; |
(...skipping 16 matching lines...) Expand all Loading... |
829 } | 861 } |
830 } | 862 } |
831 | 863 |
832 @override | 864 @override |
833 String toString() { | 865 String toString() { |
834 var superString = super.toString(); | 866 var superString = super.toString(); |
835 return "_ViewListenerProxyControl($superString)"; | 867 return "_ViewListenerProxyControl($superString)"; |
836 } | 868 } |
837 } | 869 } |
838 | 870 |
839 | 871 class ViewListenerProxy |
840 class ViewListenerProxy extends bindings.Proxy | 872 extends bindings.Proxy |
841 implements ViewListener { | 873 implements ViewListener { |
842 ViewListenerProxy.fromEndpoint( | 874 ViewListenerProxy.fromEndpoint( |
843 core.MojoMessagePipeEndpoint endpoint) | 875 core.MojoMessagePipeEndpoint endpoint) |
844 : super(new _ViewListenerProxyControl.fromEndpoint(endpoint)); | 876 : super(new _ViewListenerProxyControl.fromEndpoint(endpoint)); |
845 | 877 |
846 ViewListenerProxy.fromHandle(core.MojoHandle handle) | 878 ViewListenerProxy.fromHandle(core.MojoHandle handle) |
847 : super(new _ViewListenerProxyControl.fromHandle(handle)); | 879 : super(new _ViewListenerProxyControl.fromHandle(handle)); |
848 | 880 |
849 ViewListenerProxy.unbound() | 881 ViewListenerProxy.unbound() |
850 : super(new _ViewListenerProxyControl.unbound()); | 882 : super(new _ViewListenerProxyControl.unbound()); |
851 | 883 |
(...skipping 16 matching lines...) Expand all Loading... |
868 params.sceneVersion = sceneVersion; | 900 params.sceneVersion = sceneVersion; |
869 params.properties = properties; | 901 params.properties = properties; |
870 return ctrl.sendMessageWithRequestId( | 902 return ctrl.sendMessageWithRequestId( |
871 params, | 903 params, |
872 _viewListenerMethodOnPropertiesChangedName, | 904 _viewListenerMethodOnPropertiesChangedName, |
873 -1, | 905 -1, |
874 bindings.MessageHeader.kMessageExpectsResponse); | 906 bindings.MessageHeader.kMessageExpectsResponse); |
875 } | 907 } |
876 } | 908 } |
877 | 909 |
878 | 910 class _ViewListenerStubControl |
879 class ViewListenerStub extends bindings.Stub { | 911 extends bindings.StubMessageHandler |
| 912 implements bindings.StubControl<ViewListener> { |
880 ViewListener _impl; | 913 ViewListener _impl; |
881 | 914 |
882 ViewListenerStub.fromEndpoint( | 915 _ViewListenerStubControl.fromEndpoint( |
883 core.MojoMessagePipeEndpoint endpoint, [ViewListener impl]) | 916 core.MojoMessagePipeEndpoint endpoint, [ViewListener impl]) |
884 : super.fromEndpoint(endpoint, autoBegin: impl != null) { | 917 : super.fromEndpoint(endpoint, autoBegin: impl != null) { |
885 _impl = impl; | 918 _impl = impl; |
886 } | 919 } |
887 | 920 |
888 ViewListenerStub.fromHandle( | 921 _ViewListenerStubControl.fromHandle( |
889 core.MojoHandle handle, [ViewListener impl]) | 922 core.MojoHandle handle, [ViewListener impl]) |
890 : super.fromHandle(handle, autoBegin: impl != null) { | 923 : super.fromHandle(handle, autoBegin: impl != null) { |
891 _impl = impl; | 924 _impl = impl; |
892 } | 925 } |
893 | 926 |
894 ViewListenerStub.unbound([this._impl]) : super.unbound(); | 927 _ViewListenerStubControl.unbound([this._impl]) : super.unbound(); |
895 | |
896 static ViewListenerStub newFromEndpoint( | |
897 core.MojoMessagePipeEndpoint endpoint) { | |
898 assert(endpoint.setDescription("For ViewListenerStub")); | |
899 return new ViewListenerStub.fromEndpoint(endpoint); | |
900 } | |
901 | 928 |
902 | 929 |
903 ViewListenerOnPropertiesChangedResponseParams _viewListenerOnPropertiesChanged
ResponseParamsFactory() { | 930 ViewListenerOnPropertiesChangedResponseParams _viewListenerOnPropertiesChanged
ResponseParamsFactory() { |
904 var result = new ViewListenerOnPropertiesChangedResponseParams(); | 931 var result = new ViewListenerOnPropertiesChangedResponseParams(); |
905 return result; | 932 return result; |
906 } | 933 } |
907 | 934 |
908 dynamic handleMessage(bindings.ServiceMessage message) { | 935 dynamic handleMessage(bindings.ServiceMessage message) { |
909 if (bindings.ControlMessageHandler.isControlMessage(message)) { | 936 if (bindings.ControlMessageHandler.isControlMessage(message)) { |
910 return bindings.ControlMessageHandler.handleMessage(this, | 937 return bindings.ControlMessageHandler.handleMessage(this, |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
956 } | 983 } |
957 | 984 |
958 @override | 985 @override |
959 void bind(core.MojoMessagePipeEndpoint endpoint) { | 986 void bind(core.MojoMessagePipeEndpoint endpoint) { |
960 super.bind(endpoint); | 987 super.bind(endpoint); |
961 if (!isOpen && (_impl != null)) { | 988 if (!isOpen && (_impl != null)) { |
962 beginHandlingEvents(); | 989 beginHandlingEvents(); |
963 } | 990 } |
964 } | 991 } |
965 | 992 |
| 993 @override |
966 String toString() { | 994 String toString() { |
967 var superString = super.toString(); | 995 var superString = super.toString(); |
968 return "ViewListenerStub($superString)"; | 996 return "_ViewListenerStubControl($superString)"; |
969 } | 997 } |
970 | 998 |
971 int get version => 0; | 999 int get version => 0; |
972 | 1000 |
973 static service_describer.ServiceDescription _cachedServiceDescription; | 1001 static service_describer.ServiceDescription _cachedServiceDescription; |
974 static service_describer.ServiceDescription get serviceDescription { | 1002 static service_describer.ServiceDescription get serviceDescription { |
975 if (_cachedServiceDescription == null) { | 1003 if (_cachedServiceDescription == null) { |
976 _cachedServiceDescription = new _ViewListenerServiceDescription(); | 1004 _cachedServiceDescription = new _ViewListenerServiceDescription(); |
977 } | 1005 } |
978 return _cachedServiceDescription; | 1006 return _cachedServiceDescription; |
979 } | 1007 } |
980 } | 1008 } |
981 | 1009 |
| 1010 class ViewListenerStub |
| 1011 extends bindings.Stub<ViewListener> |
| 1012 implements ViewListener { |
| 1013 ViewListenerStub.fromEndpoint( |
| 1014 core.MojoMessagePipeEndpoint endpoint, [ViewListener impl]) |
| 1015 : super(new _ViewListenerStubControl.fromEndpoint(endpoint, impl)); |
| 1016 |
| 1017 ViewListenerStub.fromHandle( |
| 1018 core.MojoHandle handle, [ViewListener impl]) |
| 1019 : super(new _ViewListenerStubControl.fromHandle(handle, impl)); |
| 1020 |
| 1021 ViewListenerStub.unbound([ViewListener impl]) |
| 1022 : super(new _ViewListenerStubControl.unbound(impl)); |
| 1023 |
| 1024 static ViewListenerStub newFromEndpoint( |
| 1025 core.MojoMessagePipeEndpoint endpoint) { |
| 1026 assert(endpoint.setDescription("For ViewListenerStub")); |
| 1027 return new ViewListenerStub.fromEndpoint(endpoint); |
| 1028 } |
| 1029 |
| 1030 static service_describer.ServiceDescription get serviceDescription => |
| 1031 _ViewListenerStubControl.serviceDescription; |
| 1032 |
| 1033 |
| 1034 dynamic onPropertiesChanged(int sceneVersion,view_properties_mojom.ViewPropert
ies properties,[Function responseFactory = null]) { |
| 1035 return impl.onPropertiesChanged(sceneVersion,properties,responseFactory); |
| 1036 } |
| 1037 } |
| 1038 |
982 | 1039 |
983 | 1040 |
OLD | NEW |