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_admin_mojom; | 5 library authentication_admin_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 |
11 | 11 |
12 | 12 |
13 class _AuthenticationAdminServiceGetOAuth2DeviceCodeParams extends bindings.Stru
ct { | 13 class _AuthenticationAdminServiceGetOAuth2DeviceCodeParams extends bindings.Stru
ct { |
14 static const List<bindings.StructDataHeader> kVersions = const [ | 14 static const List<bindings.StructDataHeader> kVersions = const [ |
15 const bindings.StructDataHeader(16, 0) | 15 const bindings.StructDataHeader(16, 0) |
16 ]; | 16 ]; |
17 List<String> scopes = null; | 17 List<String> scopes = null; |
18 | 18 |
19 _AuthenticationAdminServiceGetOAuth2DeviceCodeParams() : super(kVersions.last.
size); | 19 _AuthenticationAdminServiceGetOAuth2DeviceCodeParams() : super(kVersions.last.
size); |
20 | 20 |
| 21 _AuthenticationAdminServiceGetOAuth2DeviceCodeParams.init( |
| 22 List<String> this.scopes |
| 23 ) : super(kVersions.last.size); |
| 24 |
21 static _AuthenticationAdminServiceGetOAuth2DeviceCodeParams deserialize(bindin
gs.Message message) { | 25 static _AuthenticationAdminServiceGetOAuth2DeviceCodeParams deserialize(bindin
gs.Message message) { |
22 var decoder = new bindings.Decoder(message); | 26 var decoder = new bindings.Decoder(message); |
23 var result = decode(decoder); | 27 var result = decode(decoder); |
24 if (decoder.excessHandles != null) { | 28 if (decoder.excessHandles != null) { |
25 decoder.excessHandles.forEach((h) => h.close()); | 29 decoder.excessHandles.forEach((h) => h.close()); |
26 } | 30 } |
27 return result; | 31 return result; |
28 } | 32 } |
29 | 33 |
30 static _AuthenticationAdminServiceGetOAuth2DeviceCodeParams decode(bindings.De
coder decoder0) { | 34 static _AuthenticationAdminServiceGetOAuth2DeviceCodeParams decode(bindings.De
coder decoder0) { |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 static const List<bindings.StructDataHeader> kVersions = const [ | 105 static const List<bindings.StructDataHeader> kVersions = const [ |
102 const bindings.StructDataHeader(40, 0) | 106 const bindings.StructDataHeader(40, 0) |
103 ]; | 107 ]; |
104 String verificationUrl = null; | 108 String verificationUrl = null; |
105 String deviceCode = null; | 109 String deviceCode = null; |
106 String userCode = null; | 110 String userCode = null; |
107 String error = null; | 111 String error = null; |
108 | 112 |
109 AuthenticationAdminServiceGetOAuth2DeviceCodeResponseParams() : super(kVersion
s.last.size); | 113 AuthenticationAdminServiceGetOAuth2DeviceCodeResponseParams() : super(kVersion
s.last.size); |
110 | 114 |
| 115 AuthenticationAdminServiceGetOAuth2DeviceCodeResponseParams.init( |
| 116 String this.verificationUrl, |
| 117 String this.deviceCode, |
| 118 String this.userCode, |
| 119 String this.error |
| 120 ) : super(kVersions.last.size); |
| 121 |
111 static AuthenticationAdminServiceGetOAuth2DeviceCodeResponseParams deserialize
(bindings.Message message) { | 122 static AuthenticationAdminServiceGetOAuth2DeviceCodeResponseParams deserialize
(bindings.Message message) { |
112 var decoder = new bindings.Decoder(message); | 123 var decoder = new bindings.Decoder(message); |
113 var result = decode(decoder); | 124 var result = decode(decoder); |
114 if (decoder.excessHandles != null) { | 125 if (decoder.excessHandles != null) { |
115 decoder.excessHandles.forEach((h) => h.close()); | 126 decoder.excessHandles.forEach((h) => h.close()); |
116 } | 127 } |
117 return result; | 128 return result; |
118 } | 129 } |
119 | 130 |
120 static AuthenticationAdminServiceGetOAuth2DeviceCodeResponseParams decode(bind
ings.Decoder decoder0) { | 131 static AuthenticationAdminServiceGetOAuth2DeviceCodeResponseParams decode(bind
ings.Decoder decoder0) { |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 | 223 |
213 | 224 |
214 class _AuthenticationAdminServiceAddAccountParams extends bindings.Struct { | 225 class _AuthenticationAdminServiceAddAccountParams extends bindings.Struct { |
215 static const List<bindings.StructDataHeader> kVersions = const [ | 226 static const List<bindings.StructDataHeader> kVersions = const [ |
216 const bindings.StructDataHeader(16, 0) | 227 const bindings.StructDataHeader(16, 0) |
217 ]; | 228 ]; |
218 String deviceCode = null; | 229 String deviceCode = null; |
219 | 230 |
220 _AuthenticationAdminServiceAddAccountParams() : super(kVersions.last.size); | 231 _AuthenticationAdminServiceAddAccountParams() : super(kVersions.last.size); |
221 | 232 |
| 233 _AuthenticationAdminServiceAddAccountParams.init( |
| 234 String this.deviceCode |
| 235 ) : super(kVersions.last.size); |
| 236 |
222 static _AuthenticationAdminServiceAddAccountParams deserialize(bindings.Messag
e message) { | 237 static _AuthenticationAdminServiceAddAccountParams deserialize(bindings.Messag
e message) { |
223 var decoder = new bindings.Decoder(message); | 238 var decoder = new bindings.Decoder(message); |
224 var result = decode(decoder); | 239 var result = decode(decoder); |
225 if (decoder.excessHandles != null) { | 240 if (decoder.excessHandles != null) { |
226 decoder.excessHandles.forEach((h) => h.close()); | 241 decoder.excessHandles.forEach((h) => h.close()); |
227 } | 242 } |
228 return result; | 243 return result; |
229 } | 244 } |
230 | 245 |
231 static _AuthenticationAdminServiceAddAccountParams decode(bindings.Decoder dec
oder0) { | 246 static _AuthenticationAdminServiceAddAccountParams decode(bindings.Decoder dec
oder0) { |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 | 300 |
286 class AuthenticationAdminServiceAddAccountResponseParams extends bindings.Struct
{ | 301 class AuthenticationAdminServiceAddAccountResponseParams extends bindings.Struct
{ |
287 static const List<bindings.StructDataHeader> kVersions = const [ | 302 static const List<bindings.StructDataHeader> kVersions = const [ |
288 const bindings.StructDataHeader(24, 0) | 303 const bindings.StructDataHeader(24, 0) |
289 ]; | 304 ]; |
290 String username = null; | 305 String username = null; |
291 String error = null; | 306 String error = null; |
292 | 307 |
293 AuthenticationAdminServiceAddAccountResponseParams() : super(kVersions.last.si
ze); | 308 AuthenticationAdminServiceAddAccountResponseParams() : super(kVersions.last.si
ze); |
294 | 309 |
| 310 AuthenticationAdminServiceAddAccountResponseParams.init( |
| 311 String this.username, |
| 312 String this.error |
| 313 ) : super(kVersions.last.size); |
| 314 |
295 static AuthenticationAdminServiceAddAccountResponseParams deserialize(bindings
.Message message) { | 315 static AuthenticationAdminServiceAddAccountResponseParams deserialize(bindings
.Message message) { |
296 var decoder = new bindings.Decoder(message); | 316 var decoder = new bindings.Decoder(message); |
297 var result = decode(decoder); | 317 var result = decode(decoder); |
298 if (decoder.excessHandles != null) { | 318 if (decoder.excessHandles != null) { |
299 decoder.excessHandles.forEach((h) => h.close()); | 319 decoder.excessHandles.forEach((h) => h.close()); |
300 } | 320 } |
301 return result; | 321 return result; |
302 } | 322 } |
303 | 323 |
304 static AuthenticationAdminServiceAddAccountResponseParams decode(bindings.Deco
der decoder0) { | 324 static AuthenticationAdminServiceAddAccountResponseParams decode(bindings.Deco
der decoder0) { |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
369 } | 389 } |
370 | 390 |
371 | 391 |
372 class _AuthenticationAdminServiceGetAllUsersParams extends bindings.Struct { | 392 class _AuthenticationAdminServiceGetAllUsersParams extends bindings.Struct { |
373 static const List<bindings.StructDataHeader> kVersions = const [ | 393 static const List<bindings.StructDataHeader> kVersions = const [ |
374 const bindings.StructDataHeader(8, 0) | 394 const bindings.StructDataHeader(8, 0) |
375 ]; | 395 ]; |
376 | 396 |
377 _AuthenticationAdminServiceGetAllUsersParams() : super(kVersions.last.size); | 397 _AuthenticationAdminServiceGetAllUsersParams() : super(kVersions.last.size); |
378 | 398 |
| 399 _AuthenticationAdminServiceGetAllUsersParams.init( |
| 400 ) : super(kVersions.last.size); |
| 401 |
379 static _AuthenticationAdminServiceGetAllUsersParams deserialize(bindings.Messa
ge message) { | 402 static _AuthenticationAdminServiceGetAllUsersParams deserialize(bindings.Messa
ge message) { |
380 var decoder = new bindings.Decoder(message); | 403 var decoder = new bindings.Decoder(message); |
381 var result = decode(decoder); | 404 var result = decode(decoder); |
382 if (decoder.excessHandles != null) { | 405 if (decoder.excessHandles != null) { |
383 decoder.excessHandles.forEach((h) => h.close()); | 406 decoder.excessHandles.forEach((h) => h.close()); |
384 } | 407 } |
385 return result; | 408 return result; |
386 } | 409 } |
387 | 410 |
388 static _AuthenticationAdminServiceGetAllUsersParams decode(bindings.Decoder de
coder0) { | 411 static _AuthenticationAdminServiceGetAllUsersParams decode(bindings.Decoder de
coder0) { |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
429 | 452 |
430 class AuthenticationAdminServiceGetAllUsersResponseParams extends bindings.Struc
t { | 453 class AuthenticationAdminServiceGetAllUsersResponseParams extends bindings.Struc
t { |
431 static const List<bindings.StructDataHeader> kVersions = const [ | 454 static const List<bindings.StructDataHeader> kVersions = const [ |
432 const bindings.StructDataHeader(24, 0) | 455 const bindings.StructDataHeader(24, 0) |
433 ]; | 456 ]; |
434 List<String> usernames = null; | 457 List<String> usernames = null; |
435 String error = null; | 458 String error = null; |
436 | 459 |
437 AuthenticationAdminServiceGetAllUsersResponseParams() : super(kVersions.last.s
ize); | 460 AuthenticationAdminServiceGetAllUsersResponseParams() : super(kVersions.last.s
ize); |
438 | 461 |
| 462 AuthenticationAdminServiceGetAllUsersResponseParams.init( |
| 463 List<String> this.usernames, |
| 464 String this.error |
| 465 ) : super(kVersions.last.size); |
| 466 |
439 static AuthenticationAdminServiceGetAllUsersResponseParams deserialize(binding
s.Message message) { | 467 static AuthenticationAdminServiceGetAllUsersResponseParams deserialize(binding
s.Message message) { |
440 var decoder = new bindings.Decoder(message); | 468 var decoder = new bindings.Decoder(message); |
441 var result = decode(decoder); | 469 var result = decode(decoder); |
442 if (decoder.excessHandles != null) { | 470 if (decoder.excessHandles != null) { |
443 decoder.excessHandles.forEach((h) => h.close()); | 471 decoder.excessHandles.forEach((h) => h.close()); |
444 } | 472 } |
445 return result; | 473 return result; |
446 } | 474 } |
447 | 475 |
448 static AuthenticationAdminServiceGetAllUsersResponseParams decode(bindings.Dec
oder decoder0) { | 476 static AuthenticationAdminServiceGetAllUsersResponseParams decode(bindings.Dec
oder decoder0) { |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
525 map["error"] = error; | 553 map["error"] = error; |
526 return map; | 554 return map; |
527 } | 555 } |
528 } | 556 } |
529 | 557 |
530 const int _authenticationAdminServiceMethodGetOAuth2DeviceCodeName = 0; | 558 const int _authenticationAdminServiceMethodGetOAuth2DeviceCodeName = 0; |
531 const int _authenticationAdminServiceMethodAddAccountName = 1; | 559 const int _authenticationAdminServiceMethodAddAccountName = 1; |
532 const int _authenticationAdminServiceMethodGetAllUsersName = 2; | 560 const int _authenticationAdminServiceMethodGetAllUsersName = 2; |
533 | 561 |
534 class _AuthenticationAdminServiceServiceDescription implements service_describer
.ServiceDescription { | 562 class _AuthenticationAdminServiceServiceDescription implements service_describer
.ServiceDescription { |
535 dynamic getTopLevelInterface([Function responseFactory]) => | 563 void getTopLevelInterface(Function responder) { |
536 responseFactory(null); | 564 responder(null); |
| 565 } |
537 | 566 |
538 dynamic getTypeDefinition(String typeKey, [Function responseFactory]) => | 567 void getTypeDefinition(String typeKey, Function responder) { |
539 responseFactory(null); | 568 responder(null); |
| 569 } |
540 | 570 |
541 dynamic getAllTypeDefinitions([Function responseFactory]) => | 571 void getAllTypeDefinitions(Function responder) { |
542 responseFactory(null); | 572 responder(null); |
| 573 } |
543 } | 574 } |
544 | 575 |
545 abstract class AuthenticationAdminService { | 576 abstract class AuthenticationAdminService { |
546 static const String serviceName = "authentication::AuthenticationAdminService"
; | 577 static const String serviceName = "authentication::AuthenticationAdminService"
; |
547 | 578 |
548 static service_describer.ServiceDescription _cachedServiceDescription; | 579 static service_describer.ServiceDescription _cachedServiceDescription; |
549 static service_describer.ServiceDescription get serviceDescription { | 580 static service_describer.ServiceDescription get serviceDescription { |
550 if (_cachedServiceDescription == null) { | 581 if (_cachedServiceDescription == null) { |
551 _cachedServiceDescription = new _AuthenticationAdminServiceServiceDescript
ion(); | 582 _cachedServiceDescription = new _AuthenticationAdminServiceServiceDescript
ion(); |
552 } | 583 } |
553 return _cachedServiceDescription; | 584 return _cachedServiceDescription; |
554 } | 585 } |
555 | 586 |
556 static AuthenticationAdminServiceProxy connectToService( | 587 static AuthenticationAdminServiceProxy connectToService( |
557 bindings.ServiceConnector s, String url, [String serviceName]) { | 588 bindings.ServiceConnector s, String url, [String serviceName]) { |
558 AuthenticationAdminServiceProxy p = new AuthenticationAdminServiceProxy.unbo
und(); | 589 AuthenticationAdminServiceProxy p = new AuthenticationAdminServiceProxy.unbo
und(); |
559 String name = serviceName ?? AuthenticationAdminService.serviceName; | 590 String name = serviceName ?? AuthenticationAdminService.serviceName; |
560 if ((name == null) || name.isEmpty) { | 591 if ((name == null) || name.isEmpty) { |
561 throw new core.MojoApiError( | 592 throw new core.MojoApiError( |
562 "If an interface has no ServiceName, then one must be provided."); | 593 "If an interface has no ServiceName, then one must be provided."); |
563 } | 594 } |
564 s.connectToService(url, p, name); | 595 s.connectToService(url, p, name); |
565 return p; | 596 return p; |
566 } | 597 } |
567 dynamic getOAuth2DeviceCode(List<String> scopes,[Function responseFactory = nu
ll]); | 598 void getOAuth2DeviceCode(List<String> scopes,void callback(String verification
Url, String deviceCode, String userCode, String error)); |
568 dynamic addAccount(String deviceCode,[Function responseFactory = null]); | 599 void addAccount(String deviceCode,void callback(String username, String error)
); |
569 dynamic getAllUsers([Function responseFactory = null]); | 600 void getAllUsers(void callback(List<String> usernames, String error)); |
570 } | 601 } |
571 | 602 |
572 abstract class AuthenticationAdminServiceInterface | 603 abstract class AuthenticationAdminServiceInterface |
573 implements bindings.MojoInterface<AuthenticationAdminService>, | 604 implements bindings.MojoInterface<AuthenticationAdminService>, |
574 AuthenticationAdminService { | 605 AuthenticationAdminService { |
575 factory AuthenticationAdminServiceInterface([AuthenticationAdminService impl])
=> | 606 factory AuthenticationAdminServiceInterface([AuthenticationAdminService impl])
=> |
576 new AuthenticationAdminServiceStub.unbound(impl); | 607 new AuthenticationAdminServiceStub.unbound(impl); |
577 | 608 |
578 factory AuthenticationAdminServiceInterface.fromEndpoint( | 609 factory AuthenticationAdminServiceInterface.fromEndpoint( |
579 core.MojoMessagePipeEndpoint endpoint, | 610 core.MojoMessagePipeEndpoint endpoint, |
(...skipping 29 matching lines...) Expand all Loading... |
609 | 640 |
610 void handleResponse(bindings.ServiceMessage message) { | 641 void handleResponse(bindings.ServiceMessage message) { |
611 switch (message.header.type) { | 642 switch (message.header.type) { |
612 case _authenticationAdminServiceMethodGetOAuth2DeviceCodeName: | 643 case _authenticationAdminServiceMethodGetOAuth2DeviceCodeName: |
613 var r = AuthenticationAdminServiceGetOAuth2DeviceCodeResponseParams.dese
rialize( | 644 var r = AuthenticationAdminServiceGetOAuth2DeviceCodeResponseParams.dese
rialize( |
614 message.payload); | 645 message.payload); |
615 if (!message.header.hasRequestId) { | 646 if (!message.header.hasRequestId) { |
616 proxyError("Expected a message with a valid request Id."); | 647 proxyError("Expected a message with a valid request Id."); |
617 return; | 648 return; |
618 } | 649 } |
619 Completer c = completerMap[message.header.requestId]; | 650 Function callback = callbackMap[message.header.requestId]; |
620 if (c == null) { | 651 if (callback == null) { |
621 proxyError( | 652 proxyError( |
622 "Message had unknown request Id: ${message.header.requestId}"); | 653 "Message had unknown request Id: ${message.header.requestId}"); |
623 return; | 654 return; |
624 } | 655 } |
625 completerMap.remove(message.header.requestId); | 656 callbackMap.remove(message.header.requestId); |
626 if (c.isCompleted) { | 657 callback(r.verificationUrl , r.deviceCode , r.userCode , r.error ); |
627 proxyError("Response completer already completed"); | |
628 return; | |
629 } | |
630 c.complete(r); | |
631 break; | 658 break; |
632 case _authenticationAdminServiceMethodAddAccountName: | 659 case _authenticationAdminServiceMethodAddAccountName: |
633 var r = AuthenticationAdminServiceAddAccountResponseParams.deserialize( | 660 var r = AuthenticationAdminServiceAddAccountResponseParams.deserialize( |
634 message.payload); | 661 message.payload); |
635 if (!message.header.hasRequestId) { | 662 if (!message.header.hasRequestId) { |
636 proxyError("Expected a message with a valid request Id."); | 663 proxyError("Expected a message with a valid request Id."); |
637 return; | 664 return; |
638 } | 665 } |
639 Completer c = completerMap[message.header.requestId]; | 666 Function callback = callbackMap[message.header.requestId]; |
640 if (c == null) { | 667 if (callback == null) { |
641 proxyError( | 668 proxyError( |
642 "Message had unknown request Id: ${message.header.requestId}"); | 669 "Message had unknown request Id: ${message.header.requestId}"); |
643 return; | 670 return; |
644 } | 671 } |
645 completerMap.remove(message.header.requestId); | 672 callbackMap.remove(message.header.requestId); |
646 if (c.isCompleted) { | 673 callback(r.username , r.error ); |
647 proxyError("Response completer already completed"); | |
648 return; | |
649 } | |
650 c.complete(r); | |
651 break; | 674 break; |
652 case _authenticationAdminServiceMethodGetAllUsersName: | 675 case _authenticationAdminServiceMethodGetAllUsersName: |
653 var r = AuthenticationAdminServiceGetAllUsersResponseParams.deserialize( | 676 var r = AuthenticationAdminServiceGetAllUsersResponseParams.deserialize( |
654 message.payload); | 677 message.payload); |
655 if (!message.header.hasRequestId) { | 678 if (!message.header.hasRequestId) { |
656 proxyError("Expected a message with a valid request Id."); | 679 proxyError("Expected a message with a valid request Id."); |
657 return; | 680 return; |
658 } | 681 } |
659 Completer c = completerMap[message.header.requestId]; | 682 Function callback = callbackMap[message.header.requestId]; |
660 if (c == null) { | 683 if (callback == null) { |
661 proxyError( | 684 proxyError( |
662 "Message had unknown request Id: ${message.header.requestId}"); | 685 "Message had unknown request Id: ${message.header.requestId}"); |
663 return; | 686 return; |
664 } | 687 } |
665 completerMap.remove(message.header.requestId); | 688 callbackMap.remove(message.header.requestId); |
666 if (c.isCompleted) { | 689 callback(r.usernames , r.error ); |
667 proxyError("Response completer already completed"); | |
668 return; | |
669 } | |
670 c.complete(r); | |
671 break; | 690 break; |
672 default: | 691 default: |
673 proxyError("Unexpected message type: ${message.header.type}"); | 692 proxyError("Unexpected message type: ${message.header.type}"); |
674 close(immediate: true); | 693 close(immediate: true); |
675 break; | 694 break; |
676 } | 695 } |
677 } | 696 } |
678 | 697 |
679 @override | 698 @override |
680 String toString() { | 699 String toString() { |
(...skipping 24 matching lines...) Expand all Loading... |
705 return newMockedProxy; | 724 return newMockedProxy; |
706 } | 725 } |
707 | 726 |
708 static AuthenticationAdminServiceProxy newFromEndpoint( | 727 static AuthenticationAdminServiceProxy newFromEndpoint( |
709 core.MojoMessagePipeEndpoint endpoint) { | 728 core.MojoMessagePipeEndpoint endpoint) { |
710 assert(endpoint.setDescription("For AuthenticationAdminServiceProxy")); | 729 assert(endpoint.setDescription("For AuthenticationAdminServiceProxy")); |
711 return new AuthenticationAdminServiceProxy.fromEndpoint(endpoint); | 730 return new AuthenticationAdminServiceProxy.fromEndpoint(endpoint); |
712 } | 731 } |
713 | 732 |
714 | 733 |
715 dynamic getOAuth2DeviceCode(List<String> scopes,[Function responseFactory = nu
ll]) { | 734 void getOAuth2DeviceCode(List<String> scopes,void callback(String verification
Url, String deviceCode, String userCode, String error)) { |
716 if (impl != null) { | 735 if (impl != null) { |
717 return new Future(() => impl.getOAuth2DeviceCode(scopes,_AuthenticationAdm
inServiceStubControl._authenticationAdminServiceGetOAuth2DeviceCodeResponseParam
sFactory)); | 736 impl.getOAuth2DeviceCode(scopes,callback); |
| 737 return; |
718 } | 738 } |
719 var params = new _AuthenticationAdminServiceGetOAuth2DeviceCodeParams(); | 739 var params = new _AuthenticationAdminServiceGetOAuth2DeviceCodeParams(); |
720 params.scopes = scopes; | 740 params.scopes = scopes; |
721 return ctrl.sendMessageWithRequestId( | 741 ctrl.sendMessageWithRequestId( |
722 params, | 742 params, |
723 _authenticationAdminServiceMethodGetOAuth2DeviceCodeName, | 743 _authenticationAdminServiceMethodGetOAuth2DeviceCodeName, |
724 -1, | 744 -1, |
725 bindings.MessageHeader.kMessageExpectsResponse); | 745 bindings.MessageHeader.kMessageExpectsResponse, |
| 746 callback); |
726 } | 747 } |
727 dynamic addAccount(String deviceCode,[Function responseFactory = null]) { | 748 void addAccount(String deviceCode,void callback(String username, String error)
) { |
728 if (impl != null) { | 749 if (impl != null) { |
729 return new Future(() => impl.addAccount(deviceCode,_AuthenticationAdminSer
viceStubControl._authenticationAdminServiceAddAccountResponseParamsFactory)); | 750 impl.addAccount(deviceCode,callback); |
| 751 return; |
730 } | 752 } |
731 var params = new _AuthenticationAdminServiceAddAccountParams(); | 753 var params = new _AuthenticationAdminServiceAddAccountParams(); |
732 params.deviceCode = deviceCode; | 754 params.deviceCode = deviceCode; |
733 return ctrl.sendMessageWithRequestId( | 755 ctrl.sendMessageWithRequestId( |
734 params, | 756 params, |
735 _authenticationAdminServiceMethodAddAccountName, | 757 _authenticationAdminServiceMethodAddAccountName, |
736 -1, | 758 -1, |
737 bindings.MessageHeader.kMessageExpectsResponse); | 759 bindings.MessageHeader.kMessageExpectsResponse, |
| 760 callback); |
738 } | 761 } |
739 dynamic getAllUsers([Function responseFactory = null]) { | 762 void getAllUsers(void callback(List<String> usernames, String error)) { |
740 if (impl != null) { | 763 if (impl != null) { |
741 return new Future(() => impl.getAllUsers(_AuthenticationAdminServiceStubCo
ntrol._authenticationAdminServiceGetAllUsersResponseParamsFactory)); | 764 impl.getAllUsers(callback); |
| 765 return; |
742 } | 766 } |
743 var params = new _AuthenticationAdminServiceGetAllUsersParams(); | 767 var params = new _AuthenticationAdminServiceGetAllUsersParams(); |
744 return ctrl.sendMessageWithRequestId( | 768 ctrl.sendMessageWithRequestId( |
745 params, | 769 params, |
746 _authenticationAdminServiceMethodGetAllUsersName, | 770 _authenticationAdminServiceMethodGetAllUsersName, |
747 -1, | 771 -1, |
748 bindings.MessageHeader.kMessageExpectsResponse); | 772 bindings.MessageHeader.kMessageExpectsResponse, |
| 773 callback); |
749 } | 774 } |
750 } | 775 } |
751 | 776 |
752 class _AuthenticationAdminServiceStubControl | 777 class _AuthenticationAdminServiceStubControl |
753 extends bindings.StubMessageHandler | 778 extends bindings.StubMessageHandler |
754 implements bindings.StubControl<AuthenticationAdminService> { | 779 implements bindings.StubControl<AuthenticationAdminService> { |
755 AuthenticationAdminService _impl; | 780 AuthenticationAdminService _impl; |
756 | 781 |
757 _AuthenticationAdminServiceStubControl.fromEndpoint( | 782 _AuthenticationAdminServiceStubControl.fromEndpoint( |
758 core.MojoMessagePipeEndpoint endpoint, [AuthenticationAdminService impl]) | 783 core.MojoMessagePipeEndpoint endpoint, [AuthenticationAdminService impl]) |
759 : super.fromEndpoint(endpoint, autoBegin: impl != null) { | 784 : super.fromEndpoint(endpoint, autoBegin: impl != null) { |
760 _impl = impl; | 785 _impl = impl; |
761 } | 786 } |
762 | 787 |
763 _AuthenticationAdminServiceStubControl.fromHandle( | 788 _AuthenticationAdminServiceStubControl.fromHandle( |
764 core.MojoHandle handle, [AuthenticationAdminService impl]) | 789 core.MojoHandle handle, [AuthenticationAdminService impl]) |
765 : super.fromHandle(handle, autoBegin: impl != null) { | 790 : super.fromHandle(handle, autoBegin: impl != null) { |
766 _impl = impl; | 791 _impl = impl; |
767 } | 792 } |
768 | 793 |
769 _AuthenticationAdminServiceStubControl.unbound([this._impl]) : super.unbound()
; | 794 _AuthenticationAdminServiceStubControl.unbound([this._impl]) : super.unbound()
; |
770 | 795 |
771 String get serviceName => AuthenticationAdminService.serviceName; | 796 String get serviceName => AuthenticationAdminService.serviceName; |
772 | 797 |
773 | 798 |
774 static AuthenticationAdminServiceGetOAuth2DeviceCodeResponseParams _authentica
tionAdminServiceGetOAuth2DeviceCodeResponseParamsFactory(String verificationUrl,
String deviceCode, String userCode, String error) { | 799 Function _authenticationAdminServiceGetOAuth2DeviceCodeResponseParamsResponder
( |
775 var result = new AuthenticationAdminServiceGetOAuth2DeviceCodeResponseParams
(); | 800 int requestId) { |
776 result.verificationUrl = verificationUrl; | 801 return (String verificationUrl, String deviceCode, String userCode, String err
or) { |
777 result.deviceCode = deviceCode; | 802 var result = new AuthenticationAdminServiceGetOAuth2DeviceCodeResponsePara
ms(); |
778 result.userCode = userCode; | 803 result.verificationUrl = verificationUrl; |
779 result.error = error; | 804 result.deviceCode = deviceCode; |
780 return result; | 805 result.userCode = userCode; |
| 806 result.error = error; |
| 807 sendResponse(buildResponseWithId( |
| 808 result, |
| 809 _authenticationAdminServiceMethodGetOAuth2DeviceCodeName, |
| 810 requestId, |
| 811 bindings.MessageHeader.kMessageIsResponse)); |
| 812 }; |
781 } | 813 } |
782 static AuthenticationAdminServiceAddAccountResponseParams _authenticationAdmin
ServiceAddAccountResponseParamsFactory(String username, String error) { | 814 Function _authenticationAdminServiceAddAccountResponseParamsResponder( |
783 var result = new AuthenticationAdminServiceAddAccountResponseParams(); | 815 int requestId) { |
784 result.username = username; | 816 return (String username, String error) { |
785 result.error = error; | 817 var result = new AuthenticationAdminServiceAddAccountResponseParams(); |
786 return result; | 818 result.username = username; |
| 819 result.error = error; |
| 820 sendResponse(buildResponseWithId( |
| 821 result, |
| 822 _authenticationAdminServiceMethodAddAccountName, |
| 823 requestId, |
| 824 bindings.MessageHeader.kMessageIsResponse)); |
| 825 }; |
787 } | 826 } |
788 static AuthenticationAdminServiceGetAllUsersResponseParams _authenticationAdmi
nServiceGetAllUsersResponseParamsFactory(List<String> usernames, String error) { | 827 Function _authenticationAdminServiceGetAllUsersResponseParamsResponder( |
789 var result = new AuthenticationAdminServiceGetAllUsersResponseParams(); | 828 int requestId) { |
790 result.usernames = usernames; | 829 return (List<String> usernames, String error) { |
791 result.error = error; | 830 var result = new AuthenticationAdminServiceGetAllUsersResponseParams(); |
792 return result; | 831 result.usernames = usernames; |
| 832 result.error = error; |
| 833 sendResponse(buildResponseWithId( |
| 834 result, |
| 835 _authenticationAdminServiceMethodGetAllUsersName, |
| 836 requestId, |
| 837 bindings.MessageHeader.kMessageIsResponse)); |
| 838 }; |
793 } | 839 } |
794 | 840 |
795 dynamic handleMessage(bindings.ServiceMessage message) { | 841 void handleMessage(bindings.ServiceMessage message) { |
796 if (bindings.ControlMessageHandler.isControlMessage(message)) { | 842 if (bindings.ControlMessageHandler.isControlMessage(message)) { |
797 return bindings.ControlMessageHandler.handleMessage(this, | 843 bindings.ControlMessageHandler.handleMessage( |
798 0, | 844 this, 0, message); |
799 message); | 845 return; |
800 } | 846 } |
801 if (_impl == null) { | 847 if (_impl == null) { |
802 throw new core.MojoApiError("$this has no implementation set"); | 848 throw new core.MojoApiError("$this has no implementation set"); |
803 } | 849 } |
804 switch (message.header.type) { | 850 switch (message.header.type) { |
805 case _authenticationAdminServiceMethodGetOAuth2DeviceCodeName: | 851 case _authenticationAdminServiceMethodGetOAuth2DeviceCodeName: |
806 var params = _AuthenticationAdminServiceGetOAuth2DeviceCodeParams.deseri
alize( | 852 var params = _AuthenticationAdminServiceGetOAuth2DeviceCodeParams.deseri
alize( |
807 message.payload); | 853 message.payload); |
808 var response = _impl.getOAuth2DeviceCode(params.scopes,_authenticationAd
minServiceGetOAuth2DeviceCodeResponseParamsFactory); | 854 _impl.getOAuth2DeviceCode(params.scopes, _authenticationAdminServiceGetO
Auth2DeviceCodeResponseParamsResponder(message.header.requestId)); |
809 if (response is Future) { | |
810 return response.then((response) { | |
811 if (response != null) { | |
812 return buildResponseWithId( | |
813 response, | |
814 _authenticationAdminServiceMethodGetOAuth2DeviceCodeName, | |
815 message.header.requestId, | |
816 bindings.MessageHeader.kMessageIsResponse); | |
817 } | |
818 }); | |
819 } else if (response != null) { | |
820 return buildResponseWithId( | |
821 response, | |
822 _authenticationAdminServiceMethodGetOAuth2DeviceCodeName, | |
823 message.header.requestId, | |
824 bindings.MessageHeader.kMessageIsResponse); | |
825 } | |
826 break; | 855 break; |
827 case _authenticationAdminServiceMethodAddAccountName: | 856 case _authenticationAdminServiceMethodAddAccountName: |
828 var params = _AuthenticationAdminServiceAddAccountParams.deserialize( | 857 var params = _AuthenticationAdminServiceAddAccountParams.deserialize( |
829 message.payload); | 858 message.payload); |
830 var response = _impl.addAccount(params.deviceCode,_authenticationAdminSe
rviceAddAccountResponseParamsFactory); | 859 _impl.addAccount(params.deviceCode, _authenticationAdminServiceAddAccoun
tResponseParamsResponder(message.header.requestId)); |
831 if (response is Future) { | |
832 return response.then((response) { | |
833 if (response != null) { | |
834 return buildResponseWithId( | |
835 response, | |
836 _authenticationAdminServiceMethodAddAccountName, | |
837 message.header.requestId, | |
838 bindings.MessageHeader.kMessageIsResponse); | |
839 } | |
840 }); | |
841 } else if (response != null) { | |
842 return buildResponseWithId( | |
843 response, | |
844 _authenticationAdminServiceMethodAddAccountName, | |
845 message.header.requestId, | |
846 bindings.MessageHeader.kMessageIsResponse); | |
847 } | |
848 break; | 860 break; |
849 case _authenticationAdminServiceMethodGetAllUsersName: | 861 case _authenticationAdminServiceMethodGetAllUsersName: |
850 var response = _impl.getAllUsers(_authenticationAdminServiceGetAllUsersR
esponseParamsFactory); | 862 _impl.getAllUsers(_authenticationAdminServiceGetAllUsersResponseParamsRe
sponder(message.header.requestId)); |
851 if (response is Future) { | |
852 return response.then((response) { | |
853 if (response != null) { | |
854 return buildResponseWithId( | |
855 response, | |
856 _authenticationAdminServiceMethodGetAllUsersName, | |
857 message.header.requestId, | |
858 bindings.MessageHeader.kMessageIsResponse); | |
859 } | |
860 }); | |
861 } else if (response != null) { | |
862 return buildResponseWithId( | |
863 response, | |
864 _authenticationAdminServiceMethodGetAllUsersName, | |
865 message.header.requestId, | |
866 bindings.MessageHeader.kMessageIsResponse); | |
867 } | |
868 break; | 863 break; |
869 default: | 864 default: |
870 throw new bindings.MojoCodecError("Unexpected message name"); | 865 throw new bindings.MojoCodecError("Unexpected message name"); |
871 break; | 866 break; |
872 } | 867 } |
873 return null; | |
874 } | 868 } |
875 | 869 |
876 AuthenticationAdminService get impl => _impl; | 870 AuthenticationAdminService get impl => _impl; |
877 set impl(AuthenticationAdminService d) { | 871 set impl(AuthenticationAdminService d) { |
878 if (d == null) { | 872 if (d == null) { |
879 throw new core.MojoApiError("$this: Cannot set a null implementation"); | 873 throw new core.MojoApiError("$this: Cannot set a null implementation"); |
880 } | 874 } |
881 if (isBound && (_impl == null)) { | 875 if (isBound && (_impl == null)) { |
882 beginHandlingEvents(); | 876 beginHandlingEvents(); |
883 } | 877 } |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
917 core.MojoHandle handle, [AuthenticationAdminService impl]) | 911 core.MojoHandle handle, [AuthenticationAdminService impl]) |
918 : super(new _AuthenticationAdminServiceStubControl.fromHandle(handle, impl
)); | 912 : super(new _AuthenticationAdminServiceStubControl.fromHandle(handle, impl
)); |
919 | 913 |
920 static AuthenticationAdminServiceStub newFromEndpoint( | 914 static AuthenticationAdminServiceStub newFromEndpoint( |
921 core.MojoMessagePipeEndpoint endpoint) { | 915 core.MojoMessagePipeEndpoint endpoint) { |
922 assert(endpoint.setDescription("For AuthenticationAdminServiceStub")); | 916 assert(endpoint.setDescription("For AuthenticationAdminServiceStub")); |
923 return new AuthenticationAdminServiceStub.fromEndpoint(endpoint); | 917 return new AuthenticationAdminServiceStub.fromEndpoint(endpoint); |
924 } | 918 } |
925 | 919 |
926 | 920 |
927 dynamic getOAuth2DeviceCode(List<String> scopes,[Function responseFactory = nu
ll]) { | 921 void getOAuth2DeviceCode(List<String> scopes,void callback(String verification
Url, String deviceCode, String userCode, String error)) { |
928 return impl.getOAuth2DeviceCode(scopes,responseFactory); | 922 return impl.getOAuth2DeviceCode(scopes,callback); |
929 } | 923 } |
930 dynamic addAccount(String deviceCode,[Function responseFactory = null]) { | 924 void addAccount(String deviceCode,void callback(String username, String error)
) { |
931 return impl.addAccount(deviceCode,responseFactory); | 925 return impl.addAccount(deviceCode,callback); |
932 } | 926 } |
933 dynamic getAllUsers([Function responseFactory = null]) { | 927 void getAllUsers(void callback(List<String> usernames, String error)) { |
934 return impl.getAllUsers(responseFactory); | 928 return impl.getAllUsers(callback); |
935 } | 929 } |
936 } | 930 } |
937 | 931 |
938 | 932 |
939 | 933 |
OLD | NEW |