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 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
419 "token: $token" ")"; | 419 "token: $token" ")"; |
420 } | 420 } |
421 | 421 |
422 Map toJson() { | 422 Map toJson() { |
423 Map map = new Map(); | 423 Map map = new Map(); |
424 map["token"] = token; | 424 map["token"] = token; |
425 return map; | 425 return map; |
426 } | 426 } |
427 } | 427 } |
428 | 428 |
| 429 |
| 430 class _AuthenticationServiceGetOAuth2DeviceCodeParams extends bindings.Struct { |
| 431 static const List<bindings.StructDataHeader> kVersions = const [ |
| 432 const bindings.StructDataHeader(16, 0) |
| 433 ]; |
| 434 List<String> scopes = null; |
| 435 |
| 436 _AuthenticationServiceGetOAuth2DeviceCodeParams() : super(kVersions.last.size)
; |
| 437 |
| 438 static _AuthenticationServiceGetOAuth2DeviceCodeParams deserialize(bindings.Me
ssage message) { |
| 439 var decoder = new bindings.Decoder(message); |
| 440 var result = decode(decoder); |
| 441 if (decoder.excessHandles != null) { |
| 442 decoder.excessHandles.forEach((h) => h.close()); |
| 443 } |
| 444 return result; |
| 445 } |
| 446 |
| 447 static _AuthenticationServiceGetOAuth2DeviceCodeParams decode(bindings.Decoder
decoder0) { |
| 448 if (decoder0 == null) { |
| 449 return null; |
| 450 } |
| 451 _AuthenticationServiceGetOAuth2DeviceCodeParams result = new _Authentication
ServiceGetOAuth2DeviceCodeParams(); |
| 452 |
| 453 var mainDataHeader = decoder0.decodeStructDataHeader(); |
| 454 if (mainDataHeader.version <= kVersions.last.version) { |
| 455 // Scan in reverse order to optimize for more recent versions. |
| 456 for (int i = kVersions.length - 1; i >= 0; --i) { |
| 457 if (mainDataHeader.version >= kVersions[i].version) { |
| 458 if (mainDataHeader.size == kVersions[i].size) { |
| 459 // Found a match. |
| 460 break; |
| 461 } |
| 462 throw new bindings.MojoCodecError( |
| 463 'Header size doesn\'t correspond to known version size.'); |
| 464 } |
| 465 } |
| 466 } else if (mainDataHeader.size < kVersions.last.size) { |
| 467 throw new bindings.MojoCodecError( |
| 468 'Message newer than the last known version cannot be shorter than ' |
| 469 'required by the last known version.'); |
| 470 } |
| 471 if (mainDataHeader.version >= 0) { |
| 472 |
| 473 var decoder1 = decoder0.decodePointer(8, false); |
| 474 { |
| 475 var si1 = decoder1.decodeDataHeaderForPointerArray(bindings.kUnspecified
ArrayLength); |
| 476 result.scopes = new List<String>(si1.numElements); |
| 477 for (int i1 = 0; i1 < si1.numElements; ++i1) { |
| 478 |
| 479 result.scopes[i1] = decoder1.decodeString(bindings.ArrayDataHeader.kHe
aderSize + bindings.kPointerSize * i1, false); |
| 480 } |
| 481 } |
| 482 } |
| 483 return result; |
| 484 } |
| 485 |
| 486 void encode(bindings.Encoder encoder) { |
| 487 var encoder0 = encoder.getStructEncoderAtOffset(kVersions.last); |
| 488 try { |
| 489 if (scopes == null) { |
| 490 encoder0.encodeNullPointer(8, false); |
| 491 } else { |
| 492 var encoder1 = encoder0.encodePointerArray(scopes.length, 8, bindings.kU
nspecifiedArrayLength); |
| 493 for (int i0 = 0; i0 < scopes.length; ++i0) { |
| 494 encoder1.encodeString(scopes[i0], bindings.ArrayDataHeader.kHeaderSize
+ bindings.kPointerSize * i0, false); |
| 495 } |
| 496 } |
| 497 } on bindings.MojoCodecError catch(e) { |
| 498 e.message = "Error encountered while encoding field " |
| 499 "scopes of struct _AuthenticationServiceGetOAuth2DeviceCodeParams: $e"
; |
| 500 rethrow; |
| 501 } |
| 502 } |
| 503 |
| 504 String toString() { |
| 505 return "_AuthenticationServiceGetOAuth2DeviceCodeParams(" |
| 506 "scopes: $scopes" ")"; |
| 507 } |
| 508 |
| 509 Map toJson() { |
| 510 Map map = new Map(); |
| 511 map["scopes"] = scopes; |
| 512 return map; |
| 513 } |
| 514 } |
| 515 |
| 516 |
| 517 class AuthenticationServiceGetOAuth2DeviceCodeResponseParams extends bindings.St
ruct { |
| 518 static const List<bindings.StructDataHeader> kVersions = const [ |
| 519 const bindings.StructDataHeader(40, 0) |
| 520 ]; |
| 521 String verificationUrl = null; |
| 522 String deviceCode = null; |
| 523 String userCode = null; |
| 524 String error = null; |
| 525 |
| 526 AuthenticationServiceGetOAuth2DeviceCodeResponseParams() : super(kVersions.las
t.size); |
| 527 |
| 528 static AuthenticationServiceGetOAuth2DeviceCodeResponseParams deserialize(bind
ings.Message message) { |
| 529 var decoder = new bindings.Decoder(message); |
| 530 var result = decode(decoder); |
| 531 if (decoder.excessHandles != null) { |
| 532 decoder.excessHandles.forEach((h) => h.close()); |
| 533 } |
| 534 return result; |
| 535 } |
| 536 |
| 537 static AuthenticationServiceGetOAuth2DeviceCodeResponseParams decode(bindings.
Decoder decoder0) { |
| 538 if (decoder0 == null) { |
| 539 return null; |
| 540 } |
| 541 AuthenticationServiceGetOAuth2DeviceCodeResponseParams result = new Authenti
cationServiceGetOAuth2DeviceCodeResponseParams(); |
| 542 |
| 543 var mainDataHeader = decoder0.decodeStructDataHeader(); |
| 544 if (mainDataHeader.version <= kVersions.last.version) { |
| 545 // Scan in reverse order to optimize for more recent versions. |
| 546 for (int i = kVersions.length - 1; i >= 0; --i) { |
| 547 if (mainDataHeader.version >= kVersions[i].version) { |
| 548 if (mainDataHeader.size == kVersions[i].size) { |
| 549 // Found a match. |
| 550 break; |
| 551 } |
| 552 throw new bindings.MojoCodecError( |
| 553 'Header size doesn\'t correspond to known version size.'); |
| 554 } |
| 555 } |
| 556 } else if (mainDataHeader.size < kVersions.last.size) { |
| 557 throw new bindings.MojoCodecError( |
| 558 'Message newer than the last known version cannot be shorter than ' |
| 559 'required by the last known version.'); |
| 560 } |
| 561 if (mainDataHeader.version >= 0) { |
| 562 |
| 563 result.verificationUrl = decoder0.decodeString(8, true); |
| 564 } |
| 565 if (mainDataHeader.version >= 0) { |
| 566 |
| 567 result.deviceCode = decoder0.decodeString(16, true); |
| 568 } |
| 569 if (mainDataHeader.version >= 0) { |
| 570 |
| 571 result.userCode = decoder0.decodeString(24, true); |
| 572 } |
| 573 if (mainDataHeader.version >= 0) { |
| 574 |
| 575 result.error = decoder0.decodeString(32, true); |
| 576 } |
| 577 return result; |
| 578 } |
| 579 |
| 580 void encode(bindings.Encoder encoder) { |
| 581 var encoder0 = encoder.getStructEncoderAtOffset(kVersions.last); |
| 582 try { |
| 583 encoder0.encodeString(verificationUrl, 8, true); |
| 584 } on bindings.MojoCodecError catch(e) { |
| 585 e.message = "Error encountered while encoding field " |
| 586 "verificationUrl of struct AuthenticationServiceGetOAuth2DeviceCodeRes
ponseParams: $e"; |
| 587 rethrow; |
| 588 } |
| 589 try { |
| 590 encoder0.encodeString(deviceCode, 16, true); |
| 591 } on bindings.MojoCodecError catch(e) { |
| 592 e.message = "Error encountered while encoding field " |
| 593 "deviceCode of struct AuthenticationServiceGetOAuth2DeviceCodeResponse
Params: $e"; |
| 594 rethrow; |
| 595 } |
| 596 try { |
| 597 encoder0.encodeString(userCode, 24, true); |
| 598 } on bindings.MojoCodecError catch(e) { |
| 599 e.message = "Error encountered while encoding field " |
| 600 "userCode of struct AuthenticationServiceGetOAuth2DeviceCodeResponsePa
rams: $e"; |
| 601 rethrow; |
| 602 } |
| 603 try { |
| 604 encoder0.encodeString(error, 32, true); |
| 605 } on bindings.MojoCodecError catch(e) { |
| 606 e.message = "Error encountered while encoding field " |
| 607 "error of struct AuthenticationServiceGetOAuth2DeviceCodeResponseParam
s: $e"; |
| 608 rethrow; |
| 609 } |
| 610 } |
| 611 |
| 612 String toString() { |
| 613 return "AuthenticationServiceGetOAuth2DeviceCodeResponseParams(" |
| 614 "verificationUrl: $verificationUrl" ", " |
| 615 "deviceCode: $deviceCode" ", " |
| 616 "userCode: $userCode" ", " |
| 617 "error: $error" ")"; |
| 618 } |
| 619 |
| 620 Map toJson() { |
| 621 Map map = new Map(); |
| 622 map["verificationUrl"] = verificationUrl; |
| 623 map["deviceCode"] = deviceCode; |
| 624 map["userCode"] = userCode; |
| 625 map["error"] = error; |
| 626 return map; |
| 627 } |
| 628 } |
| 629 |
| 630 |
| 631 class _AuthenticationServiceAddAccountParams extends bindings.Struct { |
| 632 static const List<bindings.StructDataHeader> kVersions = const [ |
| 633 const bindings.StructDataHeader(16, 0) |
| 634 ]; |
| 635 String deviceCode = null; |
| 636 |
| 637 _AuthenticationServiceAddAccountParams() : super(kVersions.last.size); |
| 638 |
| 639 static _AuthenticationServiceAddAccountParams deserialize(bindings.Message mes
sage) { |
| 640 var decoder = new bindings.Decoder(message); |
| 641 var result = decode(decoder); |
| 642 if (decoder.excessHandles != null) { |
| 643 decoder.excessHandles.forEach((h) => h.close()); |
| 644 } |
| 645 return result; |
| 646 } |
| 647 |
| 648 static _AuthenticationServiceAddAccountParams decode(bindings.Decoder decoder0
) { |
| 649 if (decoder0 == null) { |
| 650 return null; |
| 651 } |
| 652 _AuthenticationServiceAddAccountParams result = new _AuthenticationServiceAd
dAccountParams(); |
| 653 |
| 654 var mainDataHeader = decoder0.decodeStructDataHeader(); |
| 655 if (mainDataHeader.version <= kVersions.last.version) { |
| 656 // Scan in reverse order to optimize for more recent versions. |
| 657 for (int i = kVersions.length - 1; i >= 0; --i) { |
| 658 if (mainDataHeader.version >= kVersions[i].version) { |
| 659 if (mainDataHeader.size == kVersions[i].size) { |
| 660 // Found a match. |
| 661 break; |
| 662 } |
| 663 throw new bindings.MojoCodecError( |
| 664 'Header size doesn\'t correspond to known version size.'); |
| 665 } |
| 666 } |
| 667 } else if (mainDataHeader.size < kVersions.last.size) { |
| 668 throw new bindings.MojoCodecError( |
| 669 'Message newer than the last known version cannot be shorter than ' |
| 670 'required by the last known version.'); |
| 671 } |
| 672 if (mainDataHeader.version >= 0) { |
| 673 |
| 674 result.deviceCode = decoder0.decodeString(8, false); |
| 675 } |
| 676 return result; |
| 677 } |
| 678 |
| 679 void encode(bindings.Encoder encoder) { |
| 680 var encoder0 = encoder.getStructEncoderAtOffset(kVersions.last); |
| 681 try { |
| 682 encoder0.encodeString(deviceCode, 8, false); |
| 683 } on bindings.MojoCodecError catch(e) { |
| 684 e.message = "Error encountered while encoding field " |
| 685 "deviceCode of struct _AuthenticationServiceAddAccountParams: $e"; |
| 686 rethrow; |
| 687 } |
| 688 } |
| 689 |
| 690 String toString() { |
| 691 return "_AuthenticationServiceAddAccountParams(" |
| 692 "deviceCode: $deviceCode" ")"; |
| 693 } |
| 694 |
| 695 Map toJson() { |
| 696 Map map = new Map(); |
| 697 map["deviceCode"] = deviceCode; |
| 698 return map; |
| 699 } |
| 700 } |
| 701 |
| 702 |
| 703 class AuthenticationServiceAddAccountResponseParams extends bindings.Struct { |
| 704 static const List<bindings.StructDataHeader> kVersions = const [ |
| 705 const bindings.StructDataHeader(24, 0) |
| 706 ]; |
| 707 String username = null; |
| 708 String error = null; |
| 709 |
| 710 AuthenticationServiceAddAccountResponseParams() : super(kVersions.last.size); |
| 711 |
| 712 static AuthenticationServiceAddAccountResponseParams deserialize(bindings.Mess
age message) { |
| 713 var decoder = new bindings.Decoder(message); |
| 714 var result = decode(decoder); |
| 715 if (decoder.excessHandles != null) { |
| 716 decoder.excessHandles.forEach((h) => h.close()); |
| 717 } |
| 718 return result; |
| 719 } |
| 720 |
| 721 static AuthenticationServiceAddAccountResponseParams decode(bindings.Decoder d
ecoder0) { |
| 722 if (decoder0 == null) { |
| 723 return null; |
| 724 } |
| 725 AuthenticationServiceAddAccountResponseParams result = new AuthenticationSer
viceAddAccountResponseParams(); |
| 726 |
| 727 var mainDataHeader = decoder0.decodeStructDataHeader(); |
| 728 if (mainDataHeader.version <= kVersions.last.version) { |
| 729 // Scan in reverse order to optimize for more recent versions. |
| 730 for (int i = kVersions.length - 1; i >= 0; --i) { |
| 731 if (mainDataHeader.version >= kVersions[i].version) { |
| 732 if (mainDataHeader.size == kVersions[i].size) { |
| 733 // Found a match. |
| 734 break; |
| 735 } |
| 736 throw new bindings.MojoCodecError( |
| 737 'Header size doesn\'t correspond to known version size.'); |
| 738 } |
| 739 } |
| 740 } else if (mainDataHeader.size < kVersions.last.size) { |
| 741 throw new bindings.MojoCodecError( |
| 742 'Message newer than the last known version cannot be shorter than ' |
| 743 'required by the last known version.'); |
| 744 } |
| 745 if (mainDataHeader.version >= 0) { |
| 746 |
| 747 result.username = decoder0.decodeString(8, true); |
| 748 } |
| 749 if (mainDataHeader.version >= 0) { |
| 750 |
| 751 result.error = decoder0.decodeString(16, true); |
| 752 } |
| 753 return result; |
| 754 } |
| 755 |
| 756 void encode(bindings.Encoder encoder) { |
| 757 var encoder0 = encoder.getStructEncoderAtOffset(kVersions.last); |
| 758 try { |
| 759 encoder0.encodeString(username, 8, true); |
| 760 } on bindings.MojoCodecError catch(e) { |
| 761 e.message = "Error encountered while encoding field " |
| 762 "username of struct AuthenticationServiceAddAccountResponseParams: $e"
; |
| 763 rethrow; |
| 764 } |
| 765 try { |
| 766 encoder0.encodeString(error, 16, true); |
| 767 } on bindings.MojoCodecError catch(e) { |
| 768 e.message = "Error encountered while encoding field " |
| 769 "error of struct AuthenticationServiceAddAccountResponseParams: $e"; |
| 770 rethrow; |
| 771 } |
| 772 } |
| 773 |
| 774 String toString() { |
| 775 return "AuthenticationServiceAddAccountResponseParams(" |
| 776 "username: $username" ", " |
| 777 "error: $error" ")"; |
| 778 } |
| 779 |
| 780 Map toJson() { |
| 781 Map map = new Map(); |
| 782 map["username"] = username; |
| 783 map["error"] = error; |
| 784 return map; |
| 785 } |
| 786 } |
| 787 |
429 const int _AuthenticationService_selectAccountName = 0; | 788 const int _AuthenticationService_selectAccountName = 0; |
430 const int _AuthenticationService_getOAuth2TokenName = 1; | 789 const int _AuthenticationService_getOAuth2TokenName = 1; |
431 const int _AuthenticationService_clearOAuth2TokenName = 2; | 790 const int _AuthenticationService_clearOAuth2TokenName = 2; |
| 791 const int _AuthenticationService_getOAuth2DeviceCodeName = 3; |
| 792 const int _AuthenticationService_addAccountName = 4; |
432 | 793 |
433 class _AuthenticationServiceServiceDescription implements service_describer.Serv
iceDescription { | 794 class _AuthenticationServiceServiceDescription implements service_describer.Serv
iceDescription { |
434 dynamic getTopLevelInterface([Function responseFactory]) => | 795 dynamic getTopLevelInterface([Function responseFactory]) => |
435 responseFactory(null); | 796 responseFactory(null); |
436 | 797 |
437 dynamic getTypeDefinition(String typeKey, [Function responseFactory]) => | 798 dynamic getTypeDefinition(String typeKey, [Function responseFactory]) => |
438 responseFactory(null); | 799 responseFactory(null); |
439 | 800 |
440 dynamic getAllTypeDefinitions([Function responseFactory]) => | 801 dynamic getAllTypeDefinitions([Function responseFactory]) => |
441 responseFactory(null); | 802 responseFactory(null); |
442 } | 803 } |
443 | 804 |
444 abstract class AuthenticationService { | 805 abstract class AuthenticationService { |
445 static const String serviceName = "authentication::AuthenticationService"; | 806 static const String serviceName = "authentication::AuthenticationService"; |
446 dynamic selectAccount(bool returnLastSelected,[Function responseFactory = null
]); | 807 dynamic selectAccount(bool returnLastSelected,[Function responseFactory = null
]); |
447 dynamic getOAuth2Token(String username,List<String> scopes,[Function responseF
actory = null]); | 808 dynamic getOAuth2Token(String username,List<String> scopes,[Function responseF
actory = null]); |
448 void clearOAuth2Token(String token); | 809 void clearOAuth2Token(String token); |
| 810 dynamic getOAuth2DeviceCode(List<String> scopes,[Function responseFactory = nu
ll]); |
| 811 dynamic addAccount(String deviceCode,[Function responseFactory = null]); |
449 } | 812 } |
450 | 813 |
451 | 814 |
452 class _AuthenticationServiceProxyImpl extends bindings.Proxy { | 815 class _AuthenticationServiceProxyImpl extends bindings.Proxy { |
453 _AuthenticationServiceProxyImpl.fromEndpoint( | 816 _AuthenticationServiceProxyImpl.fromEndpoint( |
454 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); | 817 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); |
455 | 818 |
456 _AuthenticationServiceProxyImpl.fromHandle(core.MojoHandle handle) : | 819 _AuthenticationServiceProxyImpl.fromHandle(core.MojoHandle handle) : |
457 super.fromHandle(handle); | 820 super.fromHandle(handle); |
458 | 821 |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
502 "Message had unknown request Id: ${message.header.requestId}"); | 865 "Message had unknown request Id: ${message.header.requestId}"); |
503 return; | 866 return; |
504 } | 867 } |
505 completerMap.remove(message.header.requestId); | 868 completerMap.remove(message.header.requestId); |
506 if (c.isCompleted) { | 869 if (c.isCompleted) { |
507 proxyError("Response completer already completed"); | 870 proxyError("Response completer already completed"); |
508 return; | 871 return; |
509 } | 872 } |
510 c.complete(r); | 873 c.complete(r); |
511 break; | 874 break; |
| 875 case _AuthenticationService_getOAuth2DeviceCodeName: |
| 876 var r = AuthenticationServiceGetOAuth2DeviceCodeResponseParams.deseriali
ze( |
| 877 message.payload); |
| 878 if (!message.header.hasRequestId) { |
| 879 proxyError("Expected a message with a valid request Id."); |
| 880 return; |
| 881 } |
| 882 Completer c = completerMap[message.header.requestId]; |
| 883 if (c == null) { |
| 884 proxyError( |
| 885 "Message had unknown request Id: ${message.header.requestId}"); |
| 886 return; |
| 887 } |
| 888 completerMap.remove(message.header.requestId); |
| 889 if (c.isCompleted) { |
| 890 proxyError("Response completer already completed"); |
| 891 return; |
| 892 } |
| 893 c.complete(r); |
| 894 break; |
| 895 case _AuthenticationService_addAccountName: |
| 896 var r = AuthenticationServiceAddAccountResponseParams.deserialize( |
| 897 message.payload); |
| 898 if (!message.header.hasRequestId) { |
| 899 proxyError("Expected a message with a valid request Id."); |
| 900 return; |
| 901 } |
| 902 Completer c = completerMap[message.header.requestId]; |
| 903 if (c == null) { |
| 904 proxyError( |
| 905 "Message had unknown request Id: ${message.header.requestId}"); |
| 906 return; |
| 907 } |
| 908 completerMap.remove(message.header.requestId); |
| 909 if (c.isCompleted) { |
| 910 proxyError("Response completer already completed"); |
| 911 return; |
| 912 } |
| 913 c.complete(r); |
| 914 break; |
512 default: | 915 default: |
513 proxyError("Unexpected message type: ${message.header.type}"); | 916 proxyError("Unexpected message type: ${message.header.type}"); |
514 close(immediate: true); | 917 close(immediate: true); |
515 break; | 918 break; |
516 } | 919 } |
517 } | 920 } |
518 | 921 |
519 String toString() { | 922 String toString() { |
520 var superString = super.toString(); | 923 var superString = super.toString(); |
521 return "_AuthenticationServiceProxyImpl($superString)"; | 924 return "_AuthenticationServiceProxyImpl($superString)"; |
(...skipping 26 matching lines...) Expand all Loading... |
548 } | 951 } |
549 void clearOAuth2Token(String token) { | 952 void clearOAuth2Token(String token) { |
550 if (!_proxyImpl.isBound) { | 953 if (!_proxyImpl.isBound) { |
551 _proxyImpl.proxyError("The Proxy is closed."); | 954 _proxyImpl.proxyError("The Proxy is closed."); |
552 return; | 955 return; |
553 } | 956 } |
554 var params = new _AuthenticationServiceClearOAuth2TokenParams(); | 957 var params = new _AuthenticationServiceClearOAuth2TokenParams(); |
555 params.token = token; | 958 params.token = token; |
556 _proxyImpl.sendMessage(params, _AuthenticationService_clearOAuth2TokenName
); | 959 _proxyImpl.sendMessage(params, _AuthenticationService_clearOAuth2TokenName
); |
557 } | 960 } |
| 961 dynamic getOAuth2DeviceCode(List<String> scopes,[Function responseFactory =
null]) { |
| 962 var params = new _AuthenticationServiceGetOAuth2DeviceCodeParams(); |
| 963 params.scopes = scopes; |
| 964 return _proxyImpl.sendMessageWithRequestId( |
| 965 params, |
| 966 _AuthenticationService_getOAuth2DeviceCodeName, |
| 967 -1, |
| 968 bindings.MessageHeader.kMessageExpectsResponse); |
| 969 } |
| 970 dynamic addAccount(String deviceCode,[Function responseFactory = null]) { |
| 971 var params = new _AuthenticationServiceAddAccountParams(); |
| 972 params.deviceCode = deviceCode; |
| 973 return _proxyImpl.sendMessageWithRequestId( |
| 974 params, |
| 975 _AuthenticationService_addAccountName, |
| 976 -1, |
| 977 bindings.MessageHeader.kMessageExpectsResponse); |
| 978 } |
558 } | 979 } |
559 | 980 |
560 | 981 |
561 class AuthenticationServiceProxy implements bindings.ProxyBase { | 982 class AuthenticationServiceProxy implements bindings.ProxyBase { |
562 final bindings.Proxy impl; | 983 final bindings.Proxy impl; |
563 AuthenticationService ptr; | 984 AuthenticationService ptr; |
564 | 985 |
565 AuthenticationServiceProxy(_AuthenticationServiceProxyImpl proxyImpl) : | 986 AuthenticationServiceProxy(_AuthenticationServiceProxyImpl proxyImpl) : |
566 impl = proxyImpl, | 987 impl = proxyImpl, |
567 ptr = new _AuthenticationServiceProxyCalls(proxyImpl); | 988 ptr = new _AuthenticationServiceProxyCalls(proxyImpl); |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
641 mojo_factory_result.username = username; | 1062 mojo_factory_result.username = username; |
642 mojo_factory_result.error = error; | 1063 mojo_factory_result.error = error; |
643 return mojo_factory_result; | 1064 return mojo_factory_result; |
644 } | 1065 } |
645 AuthenticationServiceGetOAuth2TokenResponseParams _AuthenticationServiceGetOAu
th2TokenResponseParamsFactory(String token, String error) { | 1066 AuthenticationServiceGetOAuth2TokenResponseParams _AuthenticationServiceGetOAu
th2TokenResponseParamsFactory(String token, String error) { |
646 var mojo_factory_result = new AuthenticationServiceGetOAuth2TokenResponsePar
ams(); | 1067 var mojo_factory_result = new AuthenticationServiceGetOAuth2TokenResponsePar
ams(); |
647 mojo_factory_result.token = token; | 1068 mojo_factory_result.token = token; |
648 mojo_factory_result.error = error; | 1069 mojo_factory_result.error = error; |
649 return mojo_factory_result; | 1070 return mojo_factory_result; |
650 } | 1071 } |
| 1072 AuthenticationServiceGetOAuth2DeviceCodeResponseParams _AuthenticationServiceG
etOAuth2DeviceCodeResponseParamsFactory(String verificationUrl, String deviceCod
e, String userCode, String error) { |
| 1073 var mojo_factory_result = new AuthenticationServiceGetOAuth2DeviceCodeRespon
seParams(); |
| 1074 mojo_factory_result.verificationUrl = verificationUrl; |
| 1075 mojo_factory_result.deviceCode = deviceCode; |
| 1076 mojo_factory_result.userCode = userCode; |
| 1077 mojo_factory_result.error = error; |
| 1078 return mojo_factory_result; |
| 1079 } |
| 1080 AuthenticationServiceAddAccountResponseParams _AuthenticationServiceAddAccount
ResponseParamsFactory(String username, String error) { |
| 1081 var mojo_factory_result = new AuthenticationServiceAddAccountResponseParams(
); |
| 1082 mojo_factory_result.username = username; |
| 1083 mojo_factory_result.error = error; |
| 1084 return mojo_factory_result; |
| 1085 } |
651 | 1086 |
652 dynamic handleMessage(bindings.ServiceMessage message) { | 1087 dynamic handleMessage(bindings.ServiceMessage message) { |
653 if (bindings.ControlMessageHandler.isControlMessage(message)) { | 1088 if (bindings.ControlMessageHandler.isControlMessage(message)) { |
654 return bindings.ControlMessageHandler.handleMessage(this, | 1089 return bindings.ControlMessageHandler.handleMessage(this, |
655 0, | 1090 0, |
656 message); | 1091 message); |
657 } | 1092 } |
658 assert(_impl != null); | 1093 assert(_impl != null); |
659 switch (message.header.type) { | 1094 switch (message.header.type) { |
660 case _AuthenticationService_selectAccountName: | 1095 case _AuthenticationService_selectAccountName: |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
699 _AuthenticationService_getOAuth2TokenName, | 1134 _AuthenticationService_getOAuth2TokenName, |
700 message.header.requestId, | 1135 message.header.requestId, |
701 bindings.MessageHeader.kMessageIsResponse); | 1136 bindings.MessageHeader.kMessageIsResponse); |
702 } | 1137 } |
703 break; | 1138 break; |
704 case _AuthenticationService_clearOAuth2TokenName: | 1139 case _AuthenticationService_clearOAuth2TokenName: |
705 var params = _AuthenticationServiceClearOAuth2TokenParams.deserialize( | 1140 var params = _AuthenticationServiceClearOAuth2TokenParams.deserialize( |
706 message.payload); | 1141 message.payload); |
707 _impl.clearOAuth2Token(params.token); | 1142 _impl.clearOAuth2Token(params.token); |
708 break; | 1143 break; |
| 1144 case _AuthenticationService_getOAuth2DeviceCodeName: |
| 1145 var params = _AuthenticationServiceGetOAuth2DeviceCodeParams.deserialize
( |
| 1146 message.payload); |
| 1147 var response = _impl.getOAuth2DeviceCode(params.scopes,_AuthenticationSe
rviceGetOAuth2DeviceCodeResponseParamsFactory); |
| 1148 if (response is Future) { |
| 1149 return response.then((response) { |
| 1150 if (response != null) { |
| 1151 return buildResponseWithId( |
| 1152 response, |
| 1153 _AuthenticationService_getOAuth2DeviceCodeName, |
| 1154 message.header.requestId, |
| 1155 bindings.MessageHeader.kMessageIsResponse); |
| 1156 } |
| 1157 }); |
| 1158 } else if (response != null) { |
| 1159 return buildResponseWithId( |
| 1160 response, |
| 1161 _AuthenticationService_getOAuth2DeviceCodeName, |
| 1162 message.header.requestId, |
| 1163 bindings.MessageHeader.kMessageIsResponse); |
| 1164 } |
| 1165 break; |
| 1166 case _AuthenticationService_addAccountName: |
| 1167 var params = _AuthenticationServiceAddAccountParams.deserialize( |
| 1168 message.payload); |
| 1169 var response = _impl.addAccount(params.deviceCode,_AuthenticationService
AddAccountResponseParamsFactory); |
| 1170 if (response is Future) { |
| 1171 return response.then((response) { |
| 1172 if (response != null) { |
| 1173 return buildResponseWithId( |
| 1174 response, |
| 1175 _AuthenticationService_addAccountName, |
| 1176 message.header.requestId, |
| 1177 bindings.MessageHeader.kMessageIsResponse); |
| 1178 } |
| 1179 }); |
| 1180 } else if (response != null) { |
| 1181 return buildResponseWithId( |
| 1182 response, |
| 1183 _AuthenticationService_addAccountName, |
| 1184 message.header.requestId, |
| 1185 bindings.MessageHeader.kMessageIsResponse); |
| 1186 } |
| 1187 break; |
709 default: | 1188 default: |
710 throw new bindings.MojoCodecError("Unexpected message name"); | 1189 throw new bindings.MojoCodecError("Unexpected message name"); |
711 break; | 1190 break; |
712 } | 1191 } |
713 return null; | 1192 return null; |
714 } | 1193 } |
715 | 1194 |
716 AuthenticationService get impl => _impl; | 1195 AuthenticationService get impl => _impl; |
717 set impl(AuthenticationService d) { | 1196 set impl(AuthenticationService d) { |
718 assert(_impl == null); | 1197 assert(_impl == null); |
(...skipping 11 matching lines...) Expand all Loading... |
730 static service_describer.ServiceDescription get serviceDescription { | 1209 static service_describer.ServiceDescription get serviceDescription { |
731 if (_cachedServiceDescription == null) { | 1210 if (_cachedServiceDescription == null) { |
732 _cachedServiceDescription = new _AuthenticationServiceServiceDescription()
; | 1211 _cachedServiceDescription = new _AuthenticationServiceServiceDescription()
; |
733 } | 1212 } |
734 return _cachedServiceDescription; | 1213 return _cachedServiceDescription; |
735 } | 1214 } |
736 } | 1215 } |
737 | 1216 |
738 | 1217 |
739 | 1218 |
OLD | NEW |