| 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 notifications_mojom; | 5 library notifications_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 602 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 613 impl.requireVersion(requiredVersion); | 613 impl.requireVersion(requiredVersion); |
| 614 } | 614 } |
| 615 | 615 |
| 616 String toString() { | 616 String toString() { |
| 617 return "NotificationClientProxy($impl)"; | 617 return "NotificationClientProxy($impl)"; |
| 618 } | 618 } |
| 619 } | 619 } |
| 620 | 620 |
| 621 | 621 |
| 622 class NotificationClientStub extends bindings.Stub { | 622 class NotificationClientStub extends bindings.Stub { |
| 623 NotificationClient _impl = null; | 623 NotificationClient _impl; |
| 624 | 624 |
| 625 NotificationClientStub.fromEndpoint( | 625 NotificationClientStub.fromEndpoint( |
| 626 core.MojoMessagePipeEndpoint endpoint, [this._impl]) | 626 core.MojoMessagePipeEndpoint endpoint, [NotificationClient impl]) |
| 627 : super.fromEndpoint(endpoint); | 627 : super.fromEndpoint(endpoint, autoBegin: impl != null) { |
| 628 _impl = impl; |
| 629 } |
| 628 | 630 |
| 629 NotificationClientStub.fromHandle(core.MojoHandle handle, [this._impl]) | 631 NotificationClientStub.fromHandle( |
| 630 : super.fromHandle(handle); | 632 core.MojoHandle handle, [NotificationClient impl]) |
| 633 : super.fromHandle(handle, autoBegin: impl != null) { |
| 634 _impl = impl; |
| 635 } |
| 631 | 636 |
| 632 NotificationClientStub.unbound() : super.unbound(); | 637 NotificationClientStub.unbound() : super.unbound(); |
| 633 | 638 |
| 634 static NotificationClientStub newFromEndpoint( | 639 static NotificationClientStub newFromEndpoint( |
| 635 core.MojoMessagePipeEndpoint endpoint) { | 640 core.MojoMessagePipeEndpoint endpoint) { |
| 636 assert(endpoint.setDescription("For NotificationClientStub")); | 641 assert(endpoint.setDescription("For NotificationClientStub")); |
| 637 return new NotificationClientStub.fromEndpoint(endpoint); | 642 return new NotificationClientStub.fromEndpoint(endpoint); |
| 638 } | 643 } |
| 639 | 644 |
| 640 | 645 |
| 641 | 646 |
| 642 dynamic handleMessage(bindings.ServiceMessage message) { | 647 dynamic handleMessage(bindings.ServiceMessage message) { |
| 643 if (bindings.ControlMessageHandler.isControlMessage(message)) { | 648 if (bindings.ControlMessageHandler.isControlMessage(message)) { |
| 644 return bindings.ControlMessageHandler.handleMessage(this, | 649 return bindings.ControlMessageHandler.handleMessage(this, |
| 645 0, | 650 0, |
| 646 message); | 651 message); |
| 647 } | 652 } |
| 648 assert(_impl != null); | 653 if (_impl == null) { |
| 654 throw new core.MojoApiError("$this has no implementation set"); |
| 655 } |
| 649 switch (message.header.type) { | 656 switch (message.header.type) { |
| 650 case _notificationClientMethodOnSelectedName: | 657 case _notificationClientMethodOnSelectedName: |
| 651 _impl.onSelected(); | 658 _impl.onSelected(); |
| 652 break; | 659 break; |
| 653 case _notificationClientMethodOnDismissedName: | 660 case _notificationClientMethodOnDismissedName: |
| 654 _impl.onDismissed(); | 661 _impl.onDismissed(); |
| 655 break; | 662 break; |
| 656 default: | 663 default: |
| 657 throw new bindings.MojoCodecError("Unexpected message name"); | 664 throw new bindings.MojoCodecError("Unexpected message name"); |
| 658 break; | 665 break; |
| 659 } | 666 } |
| 660 return null; | 667 return null; |
| 661 } | 668 } |
| 662 | 669 |
| 663 NotificationClient get impl => _impl; | 670 NotificationClient get impl => _impl; |
| 664 set impl(NotificationClient d) { | 671 set impl(NotificationClient d) { |
| 665 assert(_impl == null); | 672 if (d == null) { |
| 673 throw new core.MojoApiError("$this: Cannot set a null implementation"); |
| 674 } |
| 675 if (isBound && (_impl == null)) { |
| 676 beginHandlingEvents(); |
| 677 } |
| 666 _impl = d; | 678 _impl = d; |
| 667 } | 679 } |
| 668 | 680 |
| 681 @override |
| 682 void bind(core.MojoMessagePipeEndpoint endpoint) { |
| 683 super.bind(endpoint); |
| 684 if (!isOpen && (_impl != null)) { |
| 685 beginHandlingEvents(); |
| 686 } |
| 687 } |
| 688 |
| 669 String toString() { | 689 String toString() { |
| 670 var superString = super.toString(); | 690 var superString = super.toString(); |
| 671 return "NotificationClientStub($superString)"; | 691 return "NotificationClientStub($superString)"; |
| 672 } | 692 } |
| 673 | 693 |
| 674 int get version => 0; | 694 int get version => 0; |
| 675 | 695 |
| 676 static service_describer.ServiceDescription _cachedServiceDescription; | 696 static service_describer.ServiceDescription _cachedServiceDescription; |
| 677 static service_describer.ServiceDescription get serviceDescription { | 697 static service_describer.ServiceDescription get serviceDescription { |
| 678 if (_cachedServiceDescription == null) { | 698 if (_cachedServiceDescription == null) { |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 814 impl.requireVersion(requiredVersion); | 834 impl.requireVersion(requiredVersion); |
| 815 } | 835 } |
| 816 | 836 |
| 817 String toString() { | 837 String toString() { |
| 818 return "NotificationProxy($impl)"; | 838 return "NotificationProxy($impl)"; |
| 819 } | 839 } |
| 820 } | 840 } |
| 821 | 841 |
| 822 | 842 |
| 823 class NotificationStub extends bindings.Stub { | 843 class NotificationStub extends bindings.Stub { |
| 824 Notification _impl = null; | 844 Notification _impl; |
| 825 | 845 |
| 826 NotificationStub.fromEndpoint( | 846 NotificationStub.fromEndpoint( |
| 827 core.MojoMessagePipeEndpoint endpoint, [this._impl]) | 847 core.MojoMessagePipeEndpoint endpoint, [Notification impl]) |
| 828 : super.fromEndpoint(endpoint); | 848 : super.fromEndpoint(endpoint, autoBegin: impl != null) { |
| 849 _impl = impl; |
| 850 } |
| 829 | 851 |
| 830 NotificationStub.fromHandle(core.MojoHandle handle, [this._impl]) | 852 NotificationStub.fromHandle( |
| 831 : super.fromHandle(handle); | 853 core.MojoHandle handle, [Notification impl]) |
| 854 : super.fromHandle(handle, autoBegin: impl != null) { |
| 855 _impl = impl; |
| 856 } |
| 832 | 857 |
| 833 NotificationStub.unbound() : super.unbound(); | 858 NotificationStub.unbound() : super.unbound(); |
| 834 | 859 |
| 835 static NotificationStub newFromEndpoint( | 860 static NotificationStub newFromEndpoint( |
| 836 core.MojoMessagePipeEndpoint endpoint) { | 861 core.MojoMessagePipeEndpoint endpoint) { |
| 837 assert(endpoint.setDescription("For NotificationStub")); | 862 assert(endpoint.setDescription("For NotificationStub")); |
| 838 return new NotificationStub.fromEndpoint(endpoint); | 863 return new NotificationStub.fromEndpoint(endpoint); |
| 839 } | 864 } |
| 840 | 865 |
| 841 | 866 |
| 842 | 867 |
| 843 dynamic handleMessage(bindings.ServiceMessage message) { | 868 dynamic handleMessage(bindings.ServiceMessage message) { |
| 844 if (bindings.ControlMessageHandler.isControlMessage(message)) { | 869 if (bindings.ControlMessageHandler.isControlMessage(message)) { |
| 845 return bindings.ControlMessageHandler.handleMessage(this, | 870 return bindings.ControlMessageHandler.handleMessage(this, |
| 846 0, | 871 0, |
| 847 message); | 872 message); |
| 848 } | 873 } |
| 849 assert(_impl != null); | 874 if (_impl == null) { |
| 875 throw new core.MojoApiError("$this has no implementation set"); |
| 876 } |
| 850 switch (message.header.type) { | 877 switch (message.header.type) { |
| 851 case _notificationMethodUpdateName: | 878 case _notificationMethodUpdateName: |
| 852 var params = _NotificationUpdateParams.deserialize( | 879 var params = _NotificationUpdateParams.deserialize( |
| 853 message.payload); | 880 message.payload); |
| 854 _impl.update(params.notificationData); | 881 _impl.update(params.notificationData); |
| 855 break; | 882 break; |
| 856 case _notificationMethodCancelName: | 883 case _notificationMethodCancelName: |
| 857 _impl.cancel(); | 884 _impl.cancel(); |
| 858 break; | 885 break; |
| 859 default: | 886 default: |
| 860 throw new bindings.MojoCodecError("Unexpected message name"); | 887 throw new bindings.MojoCodecError("Unexpected message name"); |
| 861 break; | 888 break; |
| 862 } | 889 } |
| 863 return null; | 890 return null; |
| 864 } | 891 } |
| 865 | 892 |
| 866 Notification get impl => _impl; | 893 Notification get impl => _impl; |
| 867 set impl(Notification d) { | 894 set impl(Notification d) { |
| 868 assert(_impl == null); | 895 if (d == null) { |
| 896 throw new core.MojoApiError("$this: Cannot set a null implementation"); |
| 897 } |
| 898 if (isBound && (_impl == null)) { |
| 899 beginHandlingEvents(); |
| 900 } |
| 869 _impl = d; | 901 _impl = d; |
| 870 } | 902 } |
| 871 | 903 |
| 904 @override |
| 905 void bind(core.MojoMessagePipeEndpoint endpoint) { |
| 906 super.bind(endpoint); |
| 907 if (!isOpen && (_impl != null)) { |
| 908 beginHandlingEvents(); |
| 909 } |
| 910 } |
| 911 |
| 872 String toString() { | 912 String toString() { |
| 873 var superString = super.toString(); | 913 var superString = super.toString(); |
| 874 return "NotificationStub($superString)"; | 914 return "NotificationStub($superString)"; |
| 875 } | 915 } |
| 876 | 916 |
| 877 int get version => 0; | 917 int get version => 0; |
| 878 | 918 |
| 879 static service_describer.ServiceDescription _cachedServiceDescription; | 919 static service_describer.ServiceDescription _cachedServiceDescription; |
| 880 static service_describer.ServiceDescription get serviceDescription { | 920 static service_describer.ServiceDescription get serviceDescription { |
| 881 if (_cachedServiceDescription == null) { | 921 if (_cachedServiceDescription == null) { |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1009 impl.requireVersion(requiredVersion); | 1049 impl.requireVersion(requiredVersion); |
| 1010 } | 1050 } |
| 1011 | 1051 |
| 1012 String toString() { | 1052 String toString() { |
| 1013 return "NotificationServiceProxy($impl)"; | 1053 return "NotificationServiceProxy($impl)"; |
| 1014 } | 1054 } |
| 1015 } | 1055 } |
| 1016 | 1056 |
| 1017 | 1057 |
| 1018 class NotificationServiceStub extends bindings.Stub { | 1058 class NotificationServiceStub extends bindings.Stub { |
| 1019 NotificationService _impl = null; | 1059 NotificationService _impl; |
| 1020 | 1060 |
| 1021 NotificationServiceStub.fromEndpoint( | 1061 NotificationServiceStub.fromEndpoint( |
| 1022 core.MojoMessagePipeEndpoint endpoint, [this._impl]) | 1062 core.MojoMessagePipeEndpoint endpoint, [NotificationService impl]) |
| 1023 : super.fromEndpoint(endpoint); | 1063 : super.fromEndpoint(endpoint, autoBegin: impl != null) { |
| 1064 _impl = impl; |
| 1065 } |
| 1024 | 1066 |
| 1025 NotificationServiceStub.fromHandle(core.MojoHandle handle, [this._impl]) | 1067 NotificationServiceStub.fromHandle( |
| 1026 : super.fromHandle(handle); | 1068 core.MojoHandle handle, [NotificationService impl]) |
| 1069 : super.fromHandle(handle, autoBegin: impl != null) { |
| 1070 _impl = impl; |
| 1071 } |
| 1027 | 1072 |
| 1028 NotificationServiceStub.unbound() : super.unbound(); | 1073 NotificationServiceStub.unbound() : super.unbound(); |
| 1029 | 1074 |
| 1030 static NotificationServiceStub newFromEndpoint( | 1075 static NotificationServiceStub newFromEndpoint( |
| 1031 core.MojoMessagePipeEndpoint endpoint) { | 1076 core.MojoMessagePipeEndpoint endpoint) { |
| 1032 assert(endpoint.setDescription("For NotificationServiceStub")); | 1077 assert(endpoint.setDescription("For NotificationServiceStub")); |
| 1033 return new NotificationServiceStub.fromEndpoint(endpoint); | 1078 return new NotificationServiceStub.fromEndpoint(endpoint); |
| 1034 } | 1079 } |
| 1035 | 1080 |
| 1036 | 1081 |
| 1037 | 1082 |
| 1038 dynamic handleMessage(bindings.ServiceMessage message) { | 1083 dynamic handleMessage(bindings.ServiceMessage message) { |
| 1039 if (bindings.ControlMessageHandler.isControlMessage(message)) { | 1084 if (bindings.ControlMessageHandler.isControlMessage(message)) { |
| 1040 return bindings.ControlMessageHandler.handleMessage(this, | 1085 return bindings.ControlMessageHandler.handleMessage(this, |
| 1041 0, | 1086 0, |
| 1042 message); | 1087 message); |
| 1043 } | 1088 } |
| 1044 assert(_impl != null); | 1089 if (_impl == null) { |
| 1090 throw new core.MojoApiError("$this has no implementation set"); |
| 1091 } |
| 1045 switch (message.header.type) { | 1092 switch (message.header.type) { |
| 1046 case _notificationServiceMethodPostName: | 1093 case _notificationServiceMethodPostName: |
| 1047 var params = _NotificationServicePostParams.deserialize( | 1094 var params = _NotificationServicePostParams.deserialize( |
| 1048 message.payload); | 1095 message.payload); |
| 1049 _impl.post(params.notificationData, params.client, params.notification); | 1096 _impl.post(params.notificationData, params.client, params.notification); |
| 1050 break; | 1097 break; |
| 1051 default: | 1098 default: |
| 1052 throw new bindings.MojoCodecError("Unexpected message name"); | 1099 throw new bindings.MojoCodecError("Unexpected message name"); |
| 1053 break; | 1100 break; |
| 1054 } | 1101 } |
| 1055 return null; | 1102 return null; |
| 1056 } | 1103 } |
| 1057 | 1104 |
| 1058 NotificationService get impl => _impl; | 1105 NotificationService get impl => _impl; |
| 1059 set impl(NotificationService d) { | 1106 set impl(NotificationService d) { |
| 1060 assert(_impl == null); | 1107 if (d == null) { |
| 1108 throw new core.MojoApiError("$this: Cannot set a null implementation"); |
| 1109 } |
| 1110 if (isBound && (_impl == null)) { |
| 1111 beginHandlingEvents(); |
| 1112 } |
| 1061 _impl = d; | 1113 _impl = d; |
| 1062 } | 1114 } |
| 1063 | 1115 |
| 1116 @override |
| 1117 void bind(core.MojoMessagePipeEndpoint endpoint) { |
| 1118 super.bind(endpoint); |
| 1119 if (!isOpen && (_impl != null)) { |
| 1120 beginHandlingEvents(); |
| 1121 } |
| 1122 } |
| 1123 |
| 1064 String toString() { | 1124 String toString() { |
| 1065 var superString = super.toString(); | 1125 var superString = super.toString(); |
| 1066 return "NotificationServiceStub($superString)"; | 1126 return "NotificationServiceStub($superString)"; |
| 1067 } | 1127 } |
| 1068 | 1128 |
| 1069 int get version => 0; | 1129 int get version => 0; |
| 1070 | 1130 |
| 1071 static service_describer.ServiceDescription _cachedServiceDescription; | 1131 static service_describer.ServiceDescription _cachedServiceDescription; |
| 1072 static service_describer.ServiceDescription get serviceDescription { | 1132 static service_describer.ServiceDescription get serviceDescription { |
| 1073 if (_cachedServiceDescription == null) { | 1133 if (_cachedServiceDescription == null) { |
| 1074 _cachedServiceDescription = new _NotificationServiceServiceDescription(); | 1134 _cachedServiceDescription = new _NotificationServiceServiceDescription(); |
| 1075 } | 1135 } |
| 1076 return _cachedServiceDescription; | 1136 return _cachedServiceDescription; |
| 1077 } | 1137 } |
| 1078 } | 1138 } |
| 1079 | 1139 |
| 1080 | 1140 |
| 1081 | 1141 |
| OLD | NEW |