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 clipboard_mojom; | 5 library clipboard_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 693 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
704 static const String serviceName = "mojo::Clipboard"; | 704 static const String serviceName = "mojo::Clipboard"; |
705 dynamic getSequenceNumber(ClipboardType clipboardType,[Function responseFactor
y = null]); | 705 dynamic getSequenceNumber(ClipboardType clipboardType,[Function responseFactor
y = null]); |
706 dynamic getAvailableMimeTypes(ClipboardType clipboardTypes,[Function responseF
actory = null]); | 706 dynamic getAvailableMimeTypes(ClipboardType clipboardTypes,[Function responseF
actory = null]); |
707 dynamic readMimeType(ClipboardType clipboardType,String mimeType,[Function res
ponseFactory = null]); | 707 dynamic readMimeType(ClipboardType clipboardType,String mimeType,[Function res
ponseFactory = null]); |
708 void writeClipboardData(ClipboardType clipboardType, Map<String, List<int>> da
ta); | 708 void writeClipboardData(ClipboardType clipboardType, Map<String, List<int>> da
ta); |
709 static const String mimeTypeText = "text/plain"; | 709 static const String mimeTypeText = "text/plain"; |
710 static const String mimeTypeHtml = "text/html"; | 710 static const String mimeTypeHtml = "text/html"; |
711 static const String mimeTypeUrl = "text/url"; | 711 static const String mimeTypeUrl = "text/url"; |
712 } | 712 } |
713 | 713 |
714 | 714 class _ClipboardProxyControl |
715 class _ClipboardProxyControl extends bindings.ProxyMessageHandler | 715 extends bindings.ProxyMessageHandler |
716 implements bindings.ProxyControl { | 716 implements bindings.ProxyControl { |
717 _ClipboardProxyControl.fromEndpoint( | 717 _ClipboardProxyControl.fromEndpoint( |
718 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); | 718 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); |
719 | 719 |
720 _ClipboardProxyControl.fromHandle( | 720 _ClipboardProxyControl.fromHandle( |
721 core.MojoHandle handle) : super.fromHandle(handle); | 721 core.MojoHandle handle) : super.fromHandle(handle); |
722 | 722 |
723 _ClipboardProxyControl.unbound() : super.unbound(); | 723 _ClipboardProxyControl.unbound() : super.unbound(); |
724 | 724 |
725 service_describer.ServiceDescription get serviceDescription => | 725 service_describer.ServiceDescription get serviceDescription => |
726 new _ClipboardServiceDescription(); | 726 new _ClipboardServiceDescription(); |
727 | 727 |
728 String get serviceName => Clipboard.serviceName; | 728 String get serviceName => Clipboard.serviceName; |
729 | 729 |
730 @override | |
731 void handleResponse(bindings.ServiceMessage message) { | 730 void handleResponse(bindings.ServiceMessage message) { |
732 switch (message.header.type) { | 731 switch (message.header.type) { |
733 case _clipboardMethodGetSequenceNumberName: | 732 case _clipboardMethodGetSequenceNumberName: |
734 var r = ClipboardGetSequenceNumberResponseParams.deserialize( | 733 var r = ClipboardGetSequenceNumberResponseParams.deserialize( |
735 message.payload); | 734 message.payload); |
736 if (!message.header.hasRequestId) { | 735 if (!message.header.hasRequestId) { |
737 proxyError("Expected a message with a valid request Id."); | 736 proxyError("Expected a message with a valid request Id."); |
738 return; | 737 return; |
739 } | 738 } |
740 Completer c = completerMap[message.header.requestId]; | 739 Completer c = completerMap[message.header.requestId]; |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
797 } | 796 } |
798 } | 797 } |
799 | 798 |
800 @override | 799 @override |
801 String toString() { | 800 String toString() { |
802 var superString = super.toString(); | 801 var superString = super.toString(); |
803 return "_ClipboardProxyControl($superString)"; | 802 return "_ClipboardProxyControl($superString)"; |
804 } | 803 } |
805 } | 804 } |
806 | 805 |
807 | 806 class ClipboardProxy |
808 class ClipboardProxy extends bindings.Proxy | 807 extends bindings.Proxy |
809 implements Clipboard { | 808 implements Clipboard { |
810 ClipboardProxy.fromEndpoint( | 809 ClipboardProxy.fromEndpoint( |
811 core.MojoMessagePipeEndpoint endpoint) | 810 core.MojoMessagePipeEndpoint endpoint) |
812 : super(new _ClipboardProxyControl.fromEndpoint(endpoint)); | 811 : super(new _ClipboardProxyControl.fromEndpoint(endpoint)); |
813 | 812 |
814 ClipboardProxy.fromHandle(core.MojoHandle handle) | 813 ClipboardProxy.fromHandle(core.MojoHandle handle) |
815 : super(new _ClipboardProxyControl.fromHandle(handle)); | 814 : super(new _ClipboardProxyControl.fromHandle(handle)); |
816 | 815 |
817 ClipboardProxy.unbound() | 816 ClipboardProxy.unbound() |
818 : super(new _ClipboardProxyControl.unbound()); | 817 : super(new _ClipboardProxyControl.unbound()); |
819 | 818 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
865 return; | 864 return; |
866 } | 865 } |
867 var params = new _ClipboardWriteClipboardDataParams(); | 866 var params = new _ClipboardWriteClipboardDataParams(); |
868 params.clipboardType = clipboardType; | 867 params.clipboardType = clipboardType; |
869 params.data = data; | 868 params.data = data; |
870 ctrl.sendMessage(params, | 869 ctrl.sendMessage(params, |
871 _clipboardMethodWriteClipboardDataName); | 870 _clipboardMethodWriteClipboardDataName); |
872 } | 871 } |
873 } | 872 } |
874 | 873 |
875 | 874 class _ClipboardStubControl |
876 class ClipboardStub extends bindings.Stub { | 875 extends bindings.StubMessageHandler |
| 876 implements bindings.StubControl<Clipboard> { |
877 Clipboard _impl; | 877 Clipboard _impl; |
878 | 878 |
879 ClipboardStub.fromEndpoint( | 879 _ClipboardStubControl.fromEndpoint( |
880 core.MojoMessagePipeEndpoint endpoint, [Clipboard impl]) | 880 core.MojoMessagePipeEndpoint endpoint, [Clipboard impl]) |
881 : super.fromEndpoint(endpoint, autoBegin: impl != null) { | 881 : super.fromEndpoint(endpoint, autoBegin: impl != null) { |
882 _impl = impl; | 882 _impl = impl; |
883 } | 883 } |
884 | 884 |
885 ClipboardStub.fromHandle( | 885 _ClipboardStubControl.fromHandle( |
886 core.MojoHandle handle, [Clipboard impl]) | 886 core.MojoHandle handle, [Clipboard impl]) |
887 : super.fromHandle(handle, autoBegin: impl != null) { | 887 : super.fromHandle(handle, autoBegin: impl != null) { |
888 _impl = impl; | 888 _impl = impl; |
889 } | 889 } |
890 | 890 |
891 ClipboardStub.unbound([this._impl]) : super.unbound(); | 891 _ClipboardStubControl.unbound([this._impl]) : super.unbound(); |
892 | |
893 static ClipboardStub newFromEndpoint( | |
894 core.MojoMessagePipeEndpoint endpoint) { | |
895 assert(endpoint.setDescription("For ClipboardStub")); | |
896 return new ClipboardStub.fromEndpoint(endpoint); | |
897 } | |
898 | 892 |
899 | 893 |
900 ClipboardGetSequenceNumberResponseParams _clipboardGetSequenceNumberResponsePa
ramsFactory(int sequence) { | 894 ClipboardGetSequenceNumberResponseParams _clipboardGetSequenceNumberResponsePa
ramsFactory(int sequence) { |
901 var result = new ClipboardGetSequenceNumberResponseParams(); | 895 var result = new ClipboardGetSequenceNumberResponseParams(); |
902 result.sequence = sequence; | 896 result.sequence = sequence; |
903 return result; | 897 return result; |
904 } | 898 } |
905 ClipboardGetAvailableMimeTypesResponseParams _clipboardGetAvailableMimeTypesRe
sponseParamsFactory(List<String> types) { | 899 ClipboardGetAvailableMimeTypesResponseParams _clipboardGetAvailableMimeTypesRe
sponseParamsFactory(List<String> types) { |
906 var result = new ClipboardGetAvailableMimeTypesResponseParams(); | 900 var result = new ClipboardGetAvailableMimeTypesResponseParams(); |
907 result.types = types; | 901 result.types = types; |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1013 } | 1007 } |
1014 | 1008 |
1015 @override | 1009 @override |
1016 void bind(core.MojoMessagePipeEndpoint endpoint) { | 1010 void bind(core.MojoMessagePipeEndpoint endpoint) { |
1017 super.bind(endpoint); | 1011 super.bind(endpoint); |
1018 if (!isOpen && (_impl != null)) { | 1012 if (!isOpen && (_impl != null)) { |
1019 beginHandlingEvents(); | 1013 beginHandlingEvents(); |
1020 } | 1014 } |
1021 } | 1015 } |
1022 | 1016 |
| 1017 @override |
1023 String toString() { | 1018 String toString() { |
1024 var superString = super.toString(); | 1019 var superString = super.toString(); |
1025 return "ClipboardStub($superString)"; | 1020 return "_ClipboardStubControl($superString)"; |
1026 } | 1021 } |
1027 | 1022 |
1028 int get version => 0; | 1023 int get version => 0; |
1029 | 1024 |
1030 static service_describer.ServiceDescription _cachedServiceDescription; | 1025 static service_describer.ServiceDescription _cachedServiceDescription; |
1031 static service_describer.ServiceDescription get serviceDescription { | 1026 static service_describer.ServiceDescription get serviceDescription { |
1032 if (_cachedServiceDescription == null) { | 1027 if (_cachedServiceDescription == null) { |
1033 _cachedServiceDescription = new _ClipboardServiceDescription(); | 1028 _cachedServiceDescription = new _ClipboardServiceDescription(); |
1034 } | 1029 } |
1035 return _cachedServiceDescription; | 1030 return _cachedServiceDescription; |
1036 } | 1031 } |
1037 } | 1032 } |
1038 | 1033 |
| 1034 class ClipboardStub |
| 1035 extends bindings.Stub<Clipboard> |
| 1036 implements Clipboard { |
| 1037 ClipboardStub.fromEndpoint( |
| 1038 core.MojoMessagePipeEndpoint endpoint, [Clipboard impl]) |
| 1039 : super(new _ClipboardStubControl.fromEndpoint(endpoint, impl)); |
| 1040 |
| 1041 ClipboardStub.fromHandle( |
| 1042 core.MojoHandle handle, [Clipboard impl]) |
| 1043 : super(new _ClipboardStubControl.fromHandle(handle, impl)); |
| 1044 |
| 1045 ClipboardStub.unbound([Clipboard impl]) |
| 1046 : super(new _ClipboardStubControl.unbound(impl)); |
| 1047 |
| 1048 static ClipboardStub newFromEndpoint( |
| 1049 core.MojoMessagePipeEndpoint endpoint) { |
| 1050 assert(endpoint.setDescription("For ClipboardStub")); |
| 1051 return new ClipboardStub.fromEndpoint(endpoint); |
| 1052 } |
| 1053 |
| 1054 static service_describer.ServiceDescription get serviceDescription => |
| 1055 _ClipboardStubControl.serviceDescription; |
| 1056 |
| 1057 |
| 1058 dynamic getSequenceNumber(ClipboardType clipboardType,[Function responseFactor
y = null]) { |
| 1059 return impl.getSequenceNumber(clipboardType,responseFactory); |
| 1060 } |
| 1061 dynamic getAvailableMimeTypes(ClipboardType clipboardTypes,[Function responseF
actory = null]) { |
| 1062 return impl.getAvailableMimeTypes(clipboardTypes,responseFactory); |
| 1063 } |
| 1064 dynamic readMimeType(ClipboardType clipboardType,String mimeType,[Function res
ponseFactory = null]) { |
| 1065 return impl.readMimeType(clipboardType,mimeType,responseFactory); |
| 1066 } |
| 1067 void writeClipboardData(ClipboardType clipboardType, Map<String, List<int>> da
ta) { |
| 1068 return impl.writeClipboardData(clipboardType, data); |
| 1069 } |
| 1070 } |
| 1071 |
1039 | 1072 |
1040 | 1073 |
OLD | NEW |