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

Side by Side Diff: mojo/dart/packages/mojo_services/lib/authentication/authentication.mojom.dart

Issue 1998433002: Dart: Adds Interface and InterfaceRequest interfaces. (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 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 786 matching lines...) Expand 10 before | Expand all | Expand 10 after
797 797
798 dynamic getTypeDefinition(String typeKey, [Function responseFactory]) => 798 dynamic getTypeDefinition(String typeKey, [Function responseFactory]) =>
799 responseFactory(null); 799 responseFactory(null);
800 800
801 dynamic getAllTypeDefinitions([Function responseFactory]) => 801 dynamic getAllTypeDefinitions([Function responseFactory]) =>
802 responseFactory(null); 802 responseFactory(null);
803 } 803 }
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
808 static service_describer.ServiceDescription _cachedServiceDescription;
809 static service_describer.ServiceDescription get serviceDescription {
810 if (_cachedServiceDescription == null) {
811 _cachedServiceDescription = new _AuthenticationServiceServiceDescription() ;
812 }
813 return _cachedServiceDescription;
814 }
815
816 static AuthenticationServiceProxy connectToService(
817 bindings.ServiceConnector s, String url, [String serviceName]) {
818 AuthenticationServiceProxy p = new AuthenticationServiceProxy.unbound();
819 String name = serviceName ?? AuthenticationService.serviceName;
820 if ((name == null) || name.isEmpty) {
821 throw new core.MojoApiError(
822 "If an interface has no ServiceName, then one must be provided.");
823 }
824 s.connectToService(url, p, name);
825 return p;
826 }
807 dynamic selectAccount(bool returnLastSelected,[Function responseFactory = null ]); 827 dynamic selectAccount(bool returnLastSelected,[Function responseFactory = null ]);
808 dynamic getOAuth2Token(String username,List<String> scopes,[Function responseF actory = null]); 828 dynamic getOAuth2Token(String username,List<String> scopes,[Function responseF actory = null]);
809 void clearOAuth2Token(String token); 829 void clearOAuth2Token(String token);
810 dynamic getOAuth2DeviceCode(List<String> scopes,[Function responseFactory = nu ll]); 830 dynamic getOAuth2DeviceCode(List<String> scopes,[Function responseFactory = nu ll]);
811 dynamic addAccount(String deviceCode,[Function responseFactory = null]); 831 dynamic addAccount(String deviceCode,[Function responseFactory = null]);
812 } 832 }
813 833
834 abstract class AuthenticationServiceInterface
835 implements bindings.MojoInterface<AuthenticationService>,
836 AuthenticationService {
837 factory AuthenticationServiceInterface([AuthenticationService impl]) =>
838 new AuthenticationServiceStub.unbound(impl);
839 factory AuthenticationServiceInterface.fromEndpoint(
840 core.MojoMessagePipeEndpoint endpoint,
841 [AuthenticationService impl]) =>
842 new AuthenticationServiceStub.fromEndpoint(endpoint, impl);
843 }
844
845 abstract class AuthenticationServiceInterfaceRequest
846 implements bindings.MojoInterface<AuthenticationService>,
847 AuthenticationService {
848 factory AuthenticationServiceInterfaceRequest() =>
849 new AuthenticationServiceProxy.unbound();
850 }
851
814 class _AuthenticationServiceProxyControl 852 class _AuthenticationServiceProxyControl
815 extends bindings.ProxyMessageHandler 853 extends bindings.ProxyMessageHandler
816 implements bindings.ProxyControl { 854 implements bindings.ProxyControl<AuthenticationService> {
817 _AuthenticationServiceProxyControl.fromEndpoint( 855 _AuthenticationServiceProxyControl.fromEndpoint(
818 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); 856 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint);
819 857
820 _AuthenticationServiceProxyControl.fromHandle( 858 _AuthenticationServiceProxyControl.fromHandle(
821 core.MojoHandle handle) : super.fromHandle(handle); 859 core.MojoHandle handle) : super.fromHandle(handle);
822 860
823 _AuthenticationServiceProxyControl.unbound() : super.unbound(); 861 _AuthenticationServiceProxyControl.unbound() : super.unbound();
824 862
825 service_describer.ServiceDescription get serviceDescription =>
826 new _AuthenticationServiceServiceDescription();
827
828 String get serviceName => AuthenticationService.serviceName; 863 String get serviceName => AuthenticationService.serviceName;
829 864
830 void handleResponse(bindings.ServiceMessage message) { 865 void handleResponse(bindings.ServiceMessage message) {
831 switch (message.header.type) { 866 switch (message.header.type) {
832 case _authenticationServiceMethodSelectAccountName: 867 case _authenticationServiceMethodSelectAccountName:
833 var r = AuthenticationServiceSelectAccountResponseParams.deserialize( 868 var r = AuthenticationServiceSelectAccountResponseParams.deserialize(
834 message.payload); 869 message.payload);
835 if (!message.header.hasRequestId) { 870 if (!message.header.hasRequestId) {
836 proxyError("Expected a message with a valid request Id."); 871 proxyError("Expected a message with a valid request Id.");
837 return; 872 return;
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
909 } 944 }
910 c.complete(r); 945 c.complete(r);
911 break; 946 break;
912 default: 947 default:
913 proxyError("Unexpected message type: ${message.header.type}"); 948 proxyError("Unexpected message type: ${message.header.type}");
914 close(immediate: true); 949 close(immediate: true);
915 break; 950 break;
916 } 951 }
917 } 952 }
918 953
954 AuthenticationService get impl => null;
955 set impl(AuthenticationService _) {
956 throw new core.MojoApiError("The impl of a Proxy cannot be set.");
957 }
958
919 @override 959 @override
920 String toString() { 960 String toString() {
921 var superString = super.toString(); 961 var superString = super.toString();
922 return "_AuthenticationServiceProxyControl($superString)"; 962 return "_AuthenticationServiceProxyControl($superString)";
923 } 963 }
924 } 964 }
925 965
926 class AuthenticationServiceProxy 966 class AuthenticationServiceProxy
927 extends bindings.Proxy 967 extends bindings.Proxy<AuthenticationService>
928 implements AuthenticationService { 968 implements AuthenticationService,
969 AuthenticationServiceInterface,
970 AuthenticationServiceInterfaceRequest {
929 AuthenticationServiceProxy.fromEndpoint( 971 AuthenticationServiceProxy.fromEndpoint(
930 core.MojoMessagePipeEndpoint endpoint) 972 core.MojoMessagePipeEndpoint endpoint)
931 : super(new _AuthenticationServiceProxyControl.fromEndpoint(endpoint)); 973 : super(new _AuthenticationServiceProxyControl.fromEndpoint(endpoint));
932 974
933 AuthenticationServiceProxy.fromHandle(core.MojoHandle handle) 975 AuthenticationServiceProxy.fromHandle(core.MojoHandle handle)
934 : super(new _AuthenticationServiceProxyControl.fromHandle(handle)); 976 : super(new _AuthenticationServiceProxyControl.fromHandle(handle));
935 977
936 AuthenticationServiceProxy.unbound() 978 AuthenticationServiceProxy.unbound()
937 : super(new _AuthenticationServiceProxyControl.unbound()); 979 : super(new _AuthenticationServiceProxyControl.unbound());
938 980
939 static AuthenticationServiceProxy newFromEndpoint( 981 static AuthenticationServiceProxy newFromEndpoint(
940 core.MojoMessagePipeEndpoint endpoint) { 982 core.MojoMessagePipeEndpoint endpoint) {
941 assert(endpoint.setDescription("For AuthenticationServiceProxy")); 983 assert(endpoint.setDescription("For AuthenticationServiceProxy"));
942 return new AuthenticationServiceProxy.fromEndpoint(endpoint); 984 return new AuthenticationServiceProxy.fromEndpoint(endpoint);
943 } 985 }
944 986
945 factory AuthenticationServiceProxy.connectToService(
946 bindings.ServiceConnector s, String url, [String serviceName]) {
947 AuthenticationServiceProxy p = new AuthenticationServiceProxy.unbound();
948 s.connectToService(url, p, serviceName);
949 return p;
950 }
951
952 987
953 dynamic selectAccount(bool returnLastSelected,[Function responseFactory = null ]) { 988 dynamic selectAccount(bool returnLastSelected,[Function responseFactory = null ]) {
954 var params = new _AuthenticationServiceSelectAccountParams(); 989 var params = new _AuthenticationServiceSelectAccountParams();
955 params.returnLastSelected = returnLastSelected; 990 params.returnLastSelected = returnLastSelected;
956 return ctrl.sendMessageWithRequestId( 991 return ctrl.sendMessageWithRequestId(
957 params, 992 params,
958 _authenticationServiceMethodSelectAccountName, 993 _authenticationServiceMethodSelectAccountName,
959 -1, 994 -1,
960 bindings.MessageHeader.kMessageExpectsResponse); 995 bindings.MessageHeader.kMessageExpectsResponse);
961 } 996 }
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
1011 } 1046 }
1012 1047
1013 _AuthenticationServiceStubControl.fromHandle( 1048 _AuthenticationServiceStubControl.fromHandle(
1014 core.MojoHandle handle, [AuthenticationService impl]) 1049 core.MojoHandle handle, [AuthenticationService impl])
1015 : super.fromHandle(handle, autoBegin: impl != null) { 1050 : super.fromHandle(handle, autoBegin: impl != null) {
1016 _impl = impl; 1051 _impl = impl;
1017 } 1052 }
1018 1053
1019 _AuthenticationServiceStubControl.unbound([this._impl]) : super.unbound(); 1054 _AuthenticationServiceStubControl.unbound([this._impl]) : super.unbound();
1020 1055
1056 String get serviceName => AuthenticationService.serviceName;
1057
1021 1058
1022 AuthenticationServiceSelectAccountResponseParams _authenticationServiceSelectA ccountResponseParamsFactory(String username, String error) { 1059 AuthenticationServiceSelectAccountResponseParams _authenticationServiceSelectA ccountResponseParamsFactory(String username, String error) {
1023 var result = new AuthenticationServiceSelectAccountResponseParams(); 1060 var result = new AuthenticationServiceSelectAccountResponseParams();
1024 result.username = username; 1061 result.username = username;
1025 result.error = error; 1062 result.error = error;
1026 return result; 1063 return result;
1027 } 1064 }
1028 AuthenticationServiceGetOAuth2TokenResponseParams _authenticationServiceGetOAu th2TokenResponseParamsFactory(String token, String error) { 1065 AuthenticationServiceGetOAuth2TokenResponseParams _authenticationServiceGetOAu th2TokenResponseParamsFactory(String token, String error) {
1029 var result = new AuthenticationServiceGetOAuth2TokenResponseParams(); 1066 var result = new AuthenticationServiceGetOAuth2TokenResponseParams();
1030 result.token = token; 1067 result.token = token;
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
1175 } 1212 }
1176 } 1213 }
1177 1214
1178 @override 1215 @override
1179 String toString() { 1216 String toString() {
1180 var superString = super.toString(); 1217 var superString = super.toString();
1181 return "_AuthenticationServiceStubControl($superString)"; 1218 return "_AuthenticationServiceStubControl($superString)";
1182 } 1219 }
1183 1220
1184 int get version => 0; 1221 int get version => 0;
1185
1186 static service_describer.ServiceDescription _cachedServiceDescription;
1187 static service_describer.ServiceDescription get serviceDescription {
1188 if (_cachedServiceDescription == null) {
1189 _cachedServiceDescription = new _AuthenticationServiceServiceDescription() ;
1190 }
1191 return _cachedServiceDescription;
1192 }
1193 } 1222 }
1194 1223
1195 class AuthenticationServiceStub 1224 class AuthenticationServiceStub
1196 extends bindings.Stub<AuthenticationService> 1225 extends bindings.Stub<AuthenticationService>
1197 implements AuthenticationService { 1226 implements AuthenticationService,
1227 AuthenticationServiceInterface,
1228 AuthenticationServiceInterfaceRequest {
1229 AuthenticationServiceStub.unbound([AuthenticationService impl])
1230 : super(new _AuthenticationServiceStubControl.unbound(impl));
1231
1198 AuthenticationServiceStub.fromEndpoint( 1232 AuthenticationServiceStub.fromEndpoint(
1199 core.MojoMessagePipeEndpoint endpoint, [AuthenticationService impl]) 1233 core.MojoMessagePipeEndpoint endpoint, [AuthenticationService impl])
1200 : super(new _AuthenticationServiceStubControl.fromEndpoint(endpoint, impl) ); 1234 : super(new _AuthenticationServiceStubControl.fromEndpoint(endpoint, impl) );
1201 1235
1202 AuthenticationServiceStub.fromHandle( 1236 AuthenticationServiceStub.fromHandle(
1203 core.MojoHandle handle, [AuthenticationService impl]) 1237 core.MojoHandle handle, [AuthenticationService impl])
1204 : super(new _AuthenticationServiceStubControl.fromHandle(handle, impl)); 1238 : super(new _AuthenticationServiceStubControl.fromHandle(handle, impl));
1205 1239
1206 AuthenticationServiceStub.unbound([AuthenticationService impl])
1207 : super(new _AuthenticationServiceStubControl.unbound(impl));
1208
1209 static AuthenticationServiceStub newFromEndpoint( 1240 static AuthenticationServiceStub newFromEndpoint(
1210 core.MojoMessagePipeEndpoint endpoint) { 1241 core.MojoMessagePipeEndpoint endpoint) {
1211 assert(endpoint.setDescription("For AuthenticationServiceStub")); 1242 assert(endpoint.setDescription("For AuthenticationServiceStub"));
1212 return new AuthenticationServiceStub.fromEndpoint(endpoint); 1243 return new AuthenticationServiceStub.fromEndpoint(endpoint);
1213 } 1244 }
1214 1245
1215 static service_describer.ServiceDescription get serviceDescription =>
1216 _AuthenticationServiceStubControl.serviceDescription;
1217
1218 1246
1219 dynamic selectAccount(bool returnLastSelected,[Function responseFactory = null ]) { 1247 dynamic selectAccount(bool returnLastSelected,[Function responseFactory = null ]) {
1220 return impl.selectAccount(returnLastSelected,responseFactory); 1248 return impl.selectAccount(returnLastSelected,responseFactory);
1221 } 1249 }
1222 dynamic getOAuth2Token(String username,List<String> scopes,[Function responseF actory = null]) { 1250 dynamic getOAuth2Token(String username,List<String> scopes,[Function responseF actory = null]) {
1223 return impl.getOAuth2Token(username,scopes,responseFactory); 1251 return impl.getOAuth2Token(username,scopes,responseFactory);
1224 } 1252 }
1225 void clearOAuth2Token(String token) { 1253 void clearOAuth2Token(String token) {
1226 return impl.clearOAuth2Token(token); 1254 return impl.clearOAuth2Token(token);
1227 } 1255 }
1228 dynamic getOAuth2DeviceCode(List<String> scopes,[Function responseFactory = nu ll]) { 1256 dynamic getOAuth2DeviceCode(List<String> scopes,[Function responseFactory = nu ll]) {
1229 return impl.getOAuth2DeviceCode(scopes,responseFactory); 1257 return impl.getOAuth2DeviceCode(scopes,responseFactory);
1230 } 1258 }
1231 dynamic addAccount(String deviceCode,[Function responseFactory = null]) { 1259 dynamic addAccount(String deviceCode,[Function responseFactory = null]) {
1232 return impl.addAccount(deviceCode,responseFactory); 1260 return impl.addAccount(deviceCode,responseFactory);
1233 } 1261 }
1234 } 1262 }
1235 1263
1236 1264
1237 1265
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698