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 authentication_mojom; | 5 library authentication_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 793 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
804 | 804 |
805 abstract class AuthenticationService { | 805 abstract class AuthenticationService { |
806 static const String serviceName = "authentication::AuthenticationService"; | 806 static const String serviceName = "authentication::AuthenticationService"; |
807 dynamic selectAccount(bool returnLastSelected,[Function responseFactory = null
]); | 807 dynamic selectAccount(bool returnLastSelected,[Function responseFactory = null
]); |
808 dynamic getOAuth2Token(String username,List<String> scopes,[Function responseF
actory = null]); | 808 dynamic getOAuth2Token(String username,List<String> scopes,[Function responseF
actory = null]); |
809 void clearOAuth2Token(String token); | 809 void clearOAuth2Token(String token); |
810 dynamic getOAuth2DeviceCode(List<String> scopes,[Function responseFactory = nu
ll]); | 810 dynamic getOAuth2DeviceCode(List<String> scopes,[Function responseFactory = nu
ll]); |
811 dynamic addAccount(String deviceCode,[Function responseFactory = null]); | 811 dynamic addAccount(String deviceCode,[Function responseFactory = null]); |
812 } | 812 } |
813 | 813 |
814 | 814 class _AuthenticationServiceProxyControl |
815 class _AuthenticationServiceProxyControl extends bindings.ProxyMessageHandler | 815 extends bindings.ProxyMessageHandler |
816 implements bindings.ProxyControl { | 816 implements bindings.ProxyControl { |
817 _AuthenticationServiceProxyControl.fromEndpoint( | 817 _AuthenticationServiceProxyControl.fromEndpoint( |
818 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); | 818 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); |
819 | 819 |
820 _AuthenticationServiceProxyControl.fromHandle( | 820 _AuthenticationServiceProxyControl.fromHandle( |
821 core.MojoHandle handle) : super.fromHandle(handle); | 821 core.MojoHandle handle) : super.fromHandle(handle); |
822 | 822 |
823 _AuthenticationServiceProxyControl.unbound() : super.unbound(); | 823 _AuthenticationServiceProxyControl.unbound() : super.unbound(); |
824 | 824 |
825 service_describer.ServiceDescription get serviceDescription => | 825 service_describer.ServiceDescription get serviceDescription => |
826 new _AuthenticationServiceServiceDescription(); | 826 new _AuthenticationServiceServiceDescription(); |
827 | 827 |
828 String get serviceName => AuthenticationService.serviceName; | 828 String get serviceName => AuthenticationService.serviceName; |
829 | 829 |
830 @override | |
831 void handleResponse(bindings.ServiceMessage message) { | 830 void handleResponse(bindings.ServiceMessage message) { |
832 switch (message.header.type) { | 831 switch (message.header.type) { |
833 case _authenticationServiceMethodSelectAccountName: | 832 case _authenticationServiceMethodSelectAccountName: |
834 var r = AuthenticationServiceSelectAccountResponseParams.deserialize( | 833 var r = AuthenticationServiceSelectAccountResponseParams.deserialize( |
835 message.payload); | 834 message.payload); |
836 if (!message.header.hasRequestId) { | 835 if (!message.header.hasRequestId) { |
837 proxyError("Expected a message with a valid request Id."); | 836 proxyError("Expected a message with a valid request Id."); |
838 return; | 837 return; |
839 } | 838 } |
840 Completer c = completerMap[message.header.requestId]; | 839 Completer c = completerMap[message.header.requestId]; |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
917 } | 916 } |
918 } | 917 } |
919 | 918 |
920 @override | 919 @override |
921 String toString() { | 920 String toString() { |
922 var superString = super.toString(); | 921 var superString = super.toString(); |
923 return "_AuthenticationServiceProxyControl($superString)"; | 922 return "_AuthenticationServiceProxyControl($superString)"; |
924 } | 923 } |
925 } | 924 } |
926 | 925 |
927 | 926 class AuthenticationServiceProxy |
928 class AuthenticationServiceProxy extends bindings.Proxy | 927 extends bindings.Proxy |
929 implements AuthenticationService { | 928 implements AuthenticationService { |
930 AuthenticationServiceProxy.fromEndpoint( | 929 AuthenticationServiceProxy.fromEndpoint( |
931 core.MojoMessagePipeEndpoint endpoint) | 930 core.MojoMessagePipeEndpoint endpoint) |
932 : super(new _AuthenticationServiceProxyControl.fromEndpoint(endpoint)); | 931 : super(new _AuthenticationServiceProxyControl.fromEndpoint(endpoint)); |
933 | 932 |
934 AuthenticationServiceProxy.fromHandle(core.MojoHandle handle) | 933 AuthenticationServiceProxy.fromHandle(core.MojoHandle handle) |
935 : super(new _AuthenticationServiceProxyControl.fromHandle(handle)); | 934 : super(new _AuthenticationServiceProxyControl.fromHandle(handle)); |
936 | 935 |
937 AuthenticationServiceProxy.unbound() | 936 AuthenticationServiceProxy.unbound() |
938 : super(new _AuthenticationServiceProxyControl.unbound()); | 937 : super(new _AuthenticationServiceProxyControl.unbound()); |
939 | 938 |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
993 var params = new _AuthenticationServiceAddAccountParams(); | 992 var params = new _AuthenticationServiceAddAccountParams(); |
994 params.deviceCode = deviceCode; | 993 params.deviceCode = deviceCode; |
995 return ctrl.sendMessageWithRequestId( | 994 return ctrl.sendMessageWithRequestId( |
996 params, | 995 params, |
997 _authenticationServiceMethodAddAccountName, | 996 _authenticationServiceMethodAddAccountName, |
998 -1, | 997 -1, |
999 bindings.MessageHeader.kMessageExpectsResponse); | 998 bindings.MessageHeader.kMessageExpectsResponse); |
1000 } | 999 } |
1001 } | 1000 } |
1002 | 1001 |
1003 | 1002 class _AuthenticationServiceStubControl |
1004 class AuthenticationServiceStub extends bindings.Stub { | 1003 extends bindings.StubMessageHandler |
| 1004 implements bindings.StubControl<AuthenticationService> { |
1005 AuthenticationService _impl; | 1005 AuthenticationService _impl; |
1006 | 1006 |
1007 AuthenticationServiceStub.fromEndpoint( | 1007 _AuthenticationServiceStubControl.fromEndpoint( |
1008 core.MojoMessagePipeEndpoint endpoint, [AuthenticationService impl]) | 1008 core.MojoMessagePipeEndpoint endpoint, [AuthenticationService impl]) |
1009 : super.fromEndpoint(endpoint, autoBegin: impl != null) { | 1009 : super.fromEndpoint(endpoint, autoBegin: impl != null) { |
1010 _impl = impl; | 1010 _impl = impl; |
1011 } | 1011 } |
1012 | 1012 |
1013 AuthenticationServiceStub.fromHandle( | 1013 _AuthenticationServiceStubControl.fromHandle( |
1014 core.MojoHandle handle, [AuthenticationService impl]) | 1014 core.MojoHandle handle, [AuthenticationService impl]) |
1015 : super.fromHandle(handle, autoBegin: impl != null) { | 1015 : super.fromHandle(handle, autoBegin: impl != null) { |
1016 _impl = impl; | 1016 _impl = impl; |
1017 } | 1017 } |
1018 | 1018 |
1019 AuthenticationServiceStub.unbound([this._impl]) : super.unbound(); | 1019 _AuthenticationServiceStubControl.unbound([this._impl]) : super.unbound(); |
1020 | |
1021 static AuthenticationServiceStub newFromEndpoint( | |
1022 core.MojoMessagePipeEndpoint endpoint) { | |
1023 assert(endpoint.setDescription("For AuthenticationServiceStub")); | |
1024 return new AuthenticationServiceStub.fromEndpoint(endpoint); | |
1025 } | |
1026 | 1020 |
1027 | 1021 |
1028 AuthenticationServiceSelectAccountResponseParams _authenticationServiceSelectA
ccountResponseParamsFactory(String username, String error) { | 1022 AuthenticationServiceSelectAccountResponseParams _authenticationServiceSelectA
ccountResponseParamsFactory(String username, String error) { |
1029 var result = new AuthenticationServiceSelectAccountResponseParams(); | 1023 var result = new AuthenticationServiceSelectAccountResponseParams(); |
1030 result.username = username; | 1024 result.username = username; |
1031 result.error = error; | 1025 result.error = error; |
1032 return result; | 1026 return result; |
1033 } | 1027 } |
1034 AuthenticationServiceGetOAuth2TokenResponseParams _authenticationServiceGetOAu
th2TokenResponseParamsFactory(String token, String error) { | 1028 AuthenticationServiceGetOAuth2TokenResponseParams _authenticationServiceGetOAu
th2TokenResponseParamsFactory(String token, String error) { |
1035 var result = new AuthenticationServiceGetOAuth2TokenResponseParams(); | 1029 var result = new AuthenticationServiceGetOAuth2TokenResponseParams(); |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1174 } | 1168 } |
1175 | 1169 |
1176 @override | 1170 @override |
1177 void bind(core.MojoMessagePipeEndpoint endpoint) { | 1171 void bind(core.MojoMessagePipeEndpoint endpoint) { |
1178 super.bind(endpoint); | 1172 super.bind(endpoint); |
1179 if (!isOpen && (_impl != null)) { | 1173 if (!isOpen && (_impl != null)) { |
1180 beginHandlingEvents(); | 1174 beginHandlingEvents(); |
1181 } | 1175 } |
1182 } | 1176 } |
1183 | 1177 |
| 1178 @override |
1184 String toString() { | 1179 String toString() { |
1185 var superString = super.toString(); | 1180 var superString = super.toString(); |
1186 return "AuthenticationServiceStub($superString)"; | 1181 return "_AuthenticationServiceStubControl($superString)"; |
1187 } | 1182 } |
1188 | 1183 |
1189 int get version => 0; | 1184 int get version => 0; |
1190 | 1185 |
1191 static service_describer.ServiceDescription _cachedServiceDescription; | 1186 static service_describer.ServiceDescription _cachedServiceDescription; |
1192 static service_describer.ServiceDescription get serviceDescription { | 1187 static service_describer.ServiceDescription get serviceDescription { |
1193 if (_cachedServiceDescription == null) { | 1188 if (_cachedServiceDescription == null) { |
1194 _cachedServiceDescription = new _AuthenticationServiceServiceDescription()
; | 1189 _cachedServiceDescription = new _AuthenticationServiceServiceDescription()
; |
1195 } | 1190 } |
1196 return _cachedServiceDescription; | 1191 return _cachedServiceDescription; |
1197 } | 1192 } |
1198 } | 1193 } |
1199 | 1194 |
| 1195 class AuthenticationServiceStub |
| 1196 extends bindings.Stub<AuthenticationService> |
| 1197 implements AuthenticationService { |
| 1198 AuthenticationServiceStub.fromEndpoint( |
| 1199 core.MojoMessagePipeEndpoint endpoint, [AuthenticationService impl]) |
| 1200 : super(new _AuthenticationServiceStubControl.fromEndpoint(endpoint, impl)
); |
| 1201 |
| 1202 AuthenticationServiceStub.fromHandle( |
| 1203 core.MojoHandle handle, [AuthenticationService impl]) |
| 1204 : super(new _AuthenticationServiceStubControl.fromHandle(handle, impl)); |
| 1205 |
| 1206 AuthenticationServiceStub.unbound([AuthenticationService impl]) |
| 1207 : super(new _AuthenticationServiceStubControl.unbound(impl)); |
| 1208 |
| 1209 static AuthenticationServiceStub newFromEndpoint( |
| 1210 core.MojoMessagePipeEndpoint endpoint) { |
| 1211 assert(endpoint.setDescription("For AuthenticationServiceStub")); |
| 1212 return new AuthenticationServiceStub.fromEndpoint(endpoint); |
| 1213 } |
| 1214 |
| 1215 static service_describer.ServiceDescription get serviceDescription => |
| 1216 _AuthenticationServiceStubControl.serviceDescription; |
| 1217 |
| 1218 |
| 1219 dynamic selectAccount(bool returnLastSelected,[Function responseFactory = null
]) { |
| 1220 return impl.selectAccount(returnLastSelected,responseFactory); |
| 1221 } |
| 1222 dynamic getOAuth2Token(String username,List<String> scopes,[Function responseF
actory = null]) { |
| 1223 return impl.getOAuth2Token(username,scopes,responseFactory); |
| 1224 } |
| 1225 void clearOAuth2Token(String token) { |
| 1226 return impl.clearOAuth2Token(token); |
| 1227 } |
| 1228 dynamic getOAuth2DeviceCode(List<String> scopes,[Function responseFactory = nu
ll]) { |
| 1229 return impl.getOAuth2DeviceCode(scopes,responseFactory); |
| 1230 } |
| 1231 dynamic addAccount(String deviceCode,[Function responseFactory = null]) { |
| 1232 return impl.addAccount(deviceCode,responseFactory); |
| 1233 } |
| 1234 } |
| 1235 |
1200 | 1236 |
1201 | 1237 |
OLD | NEW |