| 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 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 | 8 |
| 9 import 'package:mojo/bindings.dart' as bindings; | 9 import 'package:mojo/bindings.dart' as bindings; |
| 10 import 'package:mojo/core.dart' as core; | 10 import 'package:mojo/core.dart' as core; |
| (...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 381 "token: $token" ")"; | 381 "token: $token" ")"; |
| 382 } | 382 } |
| 383 | 383 |
| 384 Map toJson() { | 384 Map toJson() { |
| 385 Map map = new Map(); | 385 Map map = new Map(); |
| 386 map["token"] = token; | 386 map["token"] = token; |
| 387 return map; | 387 return map; |
| 388 } | 388 } |
| 389 } | 389 } |
| 390 | 390 |
| 391 |
| 392 class _AuthenticationServiceGetOAuth2DeviceCodeParams extends bindings.Struct { |
| 393 static const List<bindings.StructDataHeader> kVersions = const [ |
| 394 const bindings.StructDataHeader(16, 0) |
| 395 ]; |
| 396 List<String> scopes = null; |
| 397 |
| 398 _AuthenticationServiceGetOAuth2DeviceCodeParams() : super(kVersions.last.size)
; |
| 399 |
| 400 static _AuthenticationServiceGetOAuth2DeviceCodeParams deserialize(bindings.Me
ssage message) { |
| 401 var decoder = new bindings.Decoder(message); |
| 402 var result = decode(decoder); |
| 403 if (decoder.excessHandles != null) { |
| 404 decoder.excessHandles.forEach((h) => h.close()); |
| 405 } |
| 406 return result; |
| 407 } |
| 408 |
| 409 static _AuthenticationServiceGetOAuth2DeviceCodeParams decode(bindings.Decoder
decoder0) { |
| 410 if (decoder0 == null) { |
| 411 return null; |
| 412 } |
| 413 _AuthenticationServiceGetOAuth2DeviceCodeParams result = new _Authentication
ServiceGetOAuth2DeviceCodeParams(); |
| 414 |
| 415 var mainDataHeader = decoder0.decodeStructDataHeader(); |
| 416 if (mainDataHeader.version <= kVersions.last.version) { |
| 417 // Scan in reverse order to optimize for more recent versions. |
| 418 for (int i = kVersions.length - 1; i >= 0; --i) { |
| 419 if (mainDataHeader.version >= kVersions[i].version) { |
| 420 if (mainDataHeader.size == kVersions[i].size) { |
| 421 // Found a match. |
| 422 break; |
| 423 } |
| 424 throw new bindings.MojoCodecError( |
| 425 'Header size doesn\'t correspond to known version size.'); |
| 426 } |
| 427 } |
| 428 } else if (mainDataHeader.size < kVersions.last.size) { |
| 429 throw new bindings.MojoCodecError( |
| 430 'Message newer than the last known version cannot be shorter than ' |
| 431 'required by the last known version.'); |
| 432 } |
| 433 if (mainDataHeader.version >= 0) { |
| 434 |
| 435 var decoder1 = decoder0.decodePointer(8, false); |
| 436 { |
| 437 var si1 = decoder1.decodeDataHeaderForPointerArray(bindings.kUnspecified
ArrayLength); |
| 438 result.scopes = new List<String>(si1.numElements); |
| 439 for (int i1 = 0; i1 < si1.numElements; ++i1) { |
| 440 |
| 441 result.scopes[i1] = decoder1.decodeString(bindings.ArrayDataHeader.kHe
aderSize + bindings.kPointerSize * i1, false); |
| 442 } |
| 443 } |
| 444 } |
| 445 return result; |
| 446 } |
| 447 |
| 448 void encode(bindings.Encoder encoder) { |
| 449 var encoder0 = encoder.getStructEncoderAtOffset(kVersions.last); |
| 450 |
| 451 if (scopes == null) { |
| 452 encoder0.encodeNullPointer(8, false); |
| 453 } else { |
| 454 var encoder1 = encoder0.encodePointerArray(scopes.length, 8, bindings.kUns
pecifiedArrayLength); |
| 455 for (int i0 = 0; i0 < scopes.length; ++i0) { |
| 456 |
| 457 encoder1.encodeString(scopes[i0], bindings.ArrayDataHeader.kHeaderSize +
bindings.kPointerSize * i0, false); |
| 458 } |
| 459 } |
| 460 } |
| 461 |
| 462 String toString() { |
| 463 return "_AuthenticationServiceGetOAuth2DeviceCodeParams(" |
| 464 "scopes: $scopes" ")"; |
| 465 } |
| 466 |
| 467 Map toJson() { |
| 468 Map map = new Map(); |
| 469 map["scopes"] = scopes; |
| 470 return map; |
| 471 } |
| 472 } |
| 473 |
| 474 |
| 475 class AuthenticationServiceGetOAuth2DeviceCodeResponseParams extends bindings.St
ruct { |
| 476 static const List<bindings.StructDataHeader> kVersions = const [ |
| 477 const bindings.StructDataHeader(40, 0) |
| 478 ]; |
| 479 String verificationUrl = null; |
| 480 String deviceCode = null; |
| 481 String userCode = null; |
| 482 String error = null; |
| 483 |
| 484 AuthenticationServiceGetOAuth2DeviceCodeResponseParams() : super(kVersions.las
t.size); |
| 485 |
| 486 static AuthenticationServiceGetOAuth2DeviceCodeResponseParams deserialize(bind
ings.Message message) { |
| 487 var decoder = new bindings.Decoder(message); |
| 488 var result = decode(decoder); |
| 489 if (decoder.excessHandles != null) { |
| 490 decoder.excessHandles.forEach((h) => h.close()); |
| 491 } |
| 492 return result; |
| 493 } |
| 494 |
| 495 static AuthenticationServiceGetOAuth2DeviceCodeResponseParams decode(bindings.
Decoder decoder0) { |
| 496 if (decoder0 == null) { |
| 497 return null; |
| 498 } |
| 499 AuthenticationServiceGetOAuth2DeviceCodeResponseParams result = new Authenti
cationServiceGetOAuth2DeviceCodeResponseParams(); |
| 500 |
| 501 var mainDataHeader = decoder0.decodeStructDataHeader(); |
| 502 if (mainDataHeader.version <= kVersions.last.version) { |
| 503 // Scan in reverse order to optimize for more recent versions. |
| 504 for (int i = kVersions.length - 1; i >= 0; --i) { |
| 505 if (mainDataHeader.version >= kVersions[i].version) { |
| 506 if (mainDataHeader.size == kVersions[i].size) { |
| 507 // Found a match. |
| 508 break; |
| 509 } |
| 510 throw new bindings.MojoCodecError( |
| 511 'Header size doesn\'t correspond to known version size.'); |
| 512 } |
| 513 } |
| 514 } else if (mainDataHeader.size < kVersions.last.size) { |
| 515 throw new bindings.MojoCodecError( |
| 516 'Message newer than the last known version cannot be shorter than ' |
| 517 'required by the last known version.'); |
| 518 } |
| 519 if (mainDataHeader.version >= 0) { |
| 520 |
| 521 result.verificationUrl = decoder0.decodeString(8, true); |
| 522 } |
| 523 if (mainDataHeader.version >= 0) { |
| 524 |
| 525 result.deviceCode = decoder0.decodeString(16, true); |
| 526 } |
| 527 if (mainDataHeader.version >= 0) { |
| 528 |
| 529 result.userCode = decoder0.decodeString(24, true); |
| 530 } |
| 531 if (mainDataHeader.version >= 0) { |
| 532 |
| 533 result.error = decoder0.decodeString(32, true); |
| 534 } |
| 535 return result; |
| 536 } |
| 537 |
| 538 void encode(bindings.Encoder encoder) { |
| 539 var encoder0 = encoder.getStructEncoderAtOffset(kVersions.last); |
| 540 |
| 541 encoder0.encodeString(verificationUrl, 8, true); |
| 542 |
| 543 encoder0.encodeString(deviceCode, 16, true); |
| 544 |
| 545 encoder0.encodeString(userCode, 24, true); |
| 546 |
| 547 encoder0.encodeString(error, 32, true); |
| 548 } |
| 549 |
| 550 String toString() { |
| 551 return "AuthenticationServiceGetOAuth2DeviceCodeResponseParams(" |
| 552 "verificationUrl: $verificationUrl" ", " |
| 553 "deviceCode: $deviceCode" ", " |
| 554 "userCode: $userCode" ", " |
| 555 "error: $error" ")"; |
| 556 } |
| 557 |
| 558 Map toJson() { |
| 559 Map map = new Map(); |
| 560 map["verificationUrl"] = verificationUrl; |
| 561 map["deviceCode"] = deviceCode; |
| 562 map["userCode"] = userCode; |
| 563 map["error"] = error; |
| 564 return map; |
| 565 } |
| 566 } |
| 567 |
| 568 |
| 569 class _AuthenticationServiceAddAccountParams extends bindings.Struct { |
| 570 static const List<bindings.StructDataHeader> kVersions = const [ |
| 571 const bindings.StructDataHeader(16, 0) |
| 572 ]; |
| 573 String deviceCode = null; |
| 574 |
| 575 _AuthenticationServiceAddAccountParams() : super(kVersions.last.size); |
| 576 |
| 577 static _AuthenticationServiceAddAccountParams deserialize(bindings.Message mes
sage) { |
| 578 var decoder = new bindings.Decoder(message); |
| 579 var result = decode(decoder); |
| 580 if (decoder.excessHandles != null) { |
| 581 decoder.excessHandles.forEach((h) => h.close()); |
| 582 } |
| 583 return result; |
| 584 } |
| 585 |
| 586 static _AuthenticationServiceAddAccountParams decode(bindings.Decoder decoder0
) { |
| 587 if (decoder0 == null) { |
| 588 return null; |
| 589 } |
| 590 _AuthenticationServiceAddAccountParams result = new _AuthenticationServiceAd
dAccountParams(); |
| 591 |
| 592 var mainDataHeader = decoder0.decodeStructDataHeader(); |
| 593 if (mainDataHeader.version <= kVersions.last.version) { |
| 594 // Scan in reverse order to optimize for more recent versions. |
| 595 for (int i = kVersions.length - 1; i >= 0; --i) { |
| 596 if (mainDataHeader.version >= kVersions[i].version) { |
| 597 if (mainDataHeader.size == kVersions[i].size) { |
| 598 // Found a match. |
| 599 break; |
| 600 } |
| 601 throw new bindings.MojoCodecError( |
| 602 'Header size doesn\'t correspond to known version size.'); |
| 603 } |
| 604 } |
| 605 } else if (mainDataHeader.size < kVersions.last.size) { |
| 606 throw new bindings.MojoCodecError( |
| 607 'Message newer than the last known version cannot be shorter than ' |
| 608 'required by the last known version.'); |
| 609 } |
| 610 if (mainDataHeader.version >= 0) { |
| 611 |
| 612 result.deviceCode = decoder0.decodeString(8, false); |
| 613 } |
| 614 return result; |
| 615 } |
| 616 |
| 617 void encode(bindings.Encoder encoder) { |
| 618 var encoder0 = encoder.getStructEncoderAtOffset(kVersions.last); |
| 619 |
| 620 encoder0.encodeString(deviceCode, 8, false); |
| 621 } |
| 622 |
| 623 String toString() { |
| 624 return "_AuthenticationServiceAddAccountParams(" |
| 625 "deviceCode: $deviceCode" ")"; |
| 626 } |
| 627 |
| 628 Map toJson() { |
| 629 Map map = new Map(); |
| 630 map["deviceCode"] = deviceCode; |
| 631 return map; |
| 632 } |
| 633 } |
| 634 |
| 635 |
| 636 class AuthenticationServiceAddAccountResponseParams extends bindings.Struct { |
| 637 static const List<bindings.StructDataHeader> kVersions = const [ |
| 638 const bindings.StructDataHeader(24, 0) |
| 639 ]; |
| 640 String username = null; |
| 641 String error = null; |
| 642 |
| 643 AuthenticationServiceAddAccountResponseParams() : super(kVersions.last.size); |
| 644 |
| 645 static AuthenticationServiceAddAccountResponseParams deserialize(bindings.Mess
age message) { |
| 646 var decoder = new bindings.Decoder(message); |
| 647 var result = decode(decoder); |
| 648 if (decoder.excessHandles != null) { |
| 649 decoder.excessHandles.forEach((h) => h.close()); |
| 650 } |
| 651 return result; |
| 652 } |
| 653 |
| 654 static AuthenticationServiceAddAccountResponseParams decode(bindings.Decoder d
ecoder0) { |
| 655 if (decoder0 == null) { |
| 656 return null; |
| 657 } |
| 658 AuthenticationServiceAddAccountResponseParams result = new AuthenticationSer
viceAddAccountResponseParams(); |
| 659 |
| 660 var mainDataHeader = decoder0.decodeStructDataHeader(); |
| 661 if (mainDataHeader.version <= kVersions.last.version) { |
| 662 // Scan in reverse order to optimize for more recent versions. |
| 663 for (int i = kVersions.length - 1; i >= 0; --i) { |
| 664 if (mainDataHeader.version >= kVersions[i].version) { |
| 665 if (mainDataHeader.size == kVersions[i].size) { |
| 666 // Found a match. |
| 667 break; |
| 668 } |
| 669 throw new bindings.MojoCodecError( |
| 670 'Header size doesn\'t correspond to known version size.'); |
| 671 } |
| 672 } |
| 673 } else if (mainDataHeader.size < kVersions.last.size) { |
| 674 throw new bindings.MojoCodecError( |
| 675 'Message newer than the last known version cannot be shorter than ' |
| 676 'required by the last known version.'); |
| 677 } |
| 678 if (mainDataHeader.version >= 0) { |
| 679 |
| 680 result.username = decoder0.decodeString(8, true); |
| 681 } |
| 682 if (mainDataHeader.version >= 0) { |
| 683 |
| 684 result.error = decoder0.decodeString(16, true); |
| 685 } |
| 686 return result; |
| 687 } |
| 688 |
| 689 void encode(bindings.Encoder encoder) { |
| 690 var encoder0 = encoder.getStructEncoderAtOffset(kVersions.last); |
| 691 |
| 692 encoder0.encodeString(username, 8, true); |
| 693 |
| 694 encoder0.encodeString(error, 16, true); |
| 695 } |
| 696 |
| 697 String toString() { |
| 698 return "AuthenticationServiceAddAccountResponseParams(" |
| 699 "username: $username" ", " |
| 700 "error: $error" ")"; |
| 701 } |
| 702 |
| 703 Map toJson() { |
| 704 Map map = new Map(); |
| 705 map["username"] = username; |
| 706 map["error"] = error; |
| 707 return map; |
| 708 } |
| 709 } |
| 710 |
| 391 const int _AuthenticationService_selectAccountName = 0; | 711 const int _AuthenticationService_selectAccountName = 0; |
| 392 const int _AuthenticationService_getOAuth2TokenName = 1; | 712 const int _AuthenticationService_getOAuth2TokenName = 1; |
| 393 const int _AuthenticationService_clearOAuth2TokenName = 2; | 713 const int _AuthenticationService_clearOAuth2TokenName = 2; |
| 714 const int _AuthenticationService_getOAuth2DeviceCodeName = 3; |
| 715 const int _AuthenticationService_addAccountName = 4; |
| 394 | 716 |
| 395 abstract class AuthenticationService { | 717 abstract class AuthenticationService { |
| 396 static const String serviceName = "authentication::AuthenticationService"; | 718 static const String serviceName = "authentication::AuthenticationService"; |
| 397 dynamic selectAccount(bool returnLastSelected,[Function responseFactory = null
]); | 719 dynamic selectAccount(bool returnLastSelected,[Function responseFactory = null
]); |
| 398 dynamic getOAuth2Token(String username,List<String> scopes,[Function responseF
actory = null]); | 720 dynamic getOAuth2Token(String username,List<String> scopes,[Function responseF
actory = null]); |
| 399 void clearOAuth2Token(String token); | 721 void clearOAuth2Token(String token); |
| 400 } | 722 dynamic getOAuth2DeviceCode(List<String> scopes,[Function responseFactory = nu
ll]); |
| 401 | 723 dynamic addAccount(String deviceCode,[Function responseFactory = null]); |
| 402 | 724 } |
| 725 |
| 726 |
| 403 class _AuthenticationServiceProxyImpl extends bindings.Proxy { | 727 class _AuthenticationServiceProxyImpl extends bindings.Proxy { |
| 404 _AuthenticationServiceProxyImpl.fromEndpoint( | 728 _AuthenticationServiceProxyImpl.fromEndpoint( |
| 405 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); | 729 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); |
| 406 | 730 |
| 407 _AuthenticationServiceProxyImpl.fromHandle(core.MojoHandle handle) : | 731 _AuthenticationServiceProxyImpl.fromHandle(core.MojoHandle handle) : |
| 408 super.fromHandle(handle); | 732 super.fromHandle(handle); |
| 409 | 733 |
| 410 _AuthenticationServiceProxyImpl.unbound() : super.unbound(); | 734 _AuthenticationServiceProxyImpl.unbound() : super.unbound(); |
| 411 | 735 |
| 412 static _AuthenticationServiceProxyImpl newFromEndpoint( | 736 static _AuthenticationServiceProxyImpl newFromEndpoint( |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 450 "Message had unknown request Id: ${message.header.requestId}"); | 774 "Message had unknown request Id: ${message.header.requestId}"); |
| 451 return; | 775 return; |
| 452 } | 776 } |
| 453 completerMap.remove(message.header.requestId); | 777 completerMap.remove(message.header.requestId); |
| 454 if (c.isCompleted) { | 778 if (c.isCompleted) { |
| 455 proxyError("Response completer already completed"); | 779 proxyError("Response completer already completed"); |
| 456 return; | 780 return; |
| 457 } | 781 } |
| 458 c.complete(r); | 782 c.complete(r); |
| 459 break; | 783 break; |
| 784 case _AuthenticationService_getOAuth2DeviceCodeName: |
| 785 var r = AuthenticationServiceGetOAuth2DeviceCodeResponseParams.deseriali
ze( |
| 786 message.payload); |
| 787 if (!message.header.hasRequestId) { |
| 788 proxyError("Expected a message with a valid request Id."); |
| 789 return; |
| 790 } |
| 791 Completer c = completerMap[message.header.requestId]; |
| 792 if (c == null) { |
| 793 proxyError( |
| 794 "Message had unknown request Id: ${message.header.requestId}"); |
| 795 return; |
| 796 } |
| 797 completerMap.remove(message.header.requestId); |
| 798 if (c.isCompleted) { |
| 799 proxyError("Response completer already completed"); |
| 800 return; |
| 801 } |
| 802 c.complete(r); |
| 803 break; |
| 804 case _AuthenticationService_addAccountName: |
| 805 var r = AuthenticationServiceAddAccountResponseParams.deserialize( |
| 806 message.payload); |
| 807 if (!message.header.hasRequestId) { |
| 808 proxyError("Expected a message with a valid request Id."); |
| 809 return; |
| 810 } |
| 811 Completer c = completerMap[message.header.requestId]; |
| 812 if (c == null) { |
| 813 proxyError( |
| 814 "Message had unknown request Id: ${message.header.requestId}"); |
| 815 return; |
| 816 } |
| 817 completerMap.remove(message.header.requestId); |
| 818 if (c.isCompleted) { |
| 819 proxyError("Response completer already completed"); |
| 820 return; |
| 821 } |
| 822 c.complete(r); |
| 823 break; |
| 460 default: | 824 default: |
| 461 proxyError("Unexpected message type: ${message.header.type}"); | 825 proxyError("Unexpected message type: ${message.header.type}"); |
| 462 close(immediate: true); | 826 close(immediate: true); |
| 463 break; | 827 break; |
| 464 } | 828 } |
| 465 } | 829 } |
| 466 | 830 |
| 467 String toString() { | 831 String toString() { |
| 468 var superString = super.toString(); | 832 var superString = super.toString(); |
| 469 return "_AuthenticationServiceProxyImpl($superString)"; | 833 return "_AuthenticationServiceProxyImpl($superString)"; |
| (...skipping 26 matching lines...) Expand all Loading... |
| 496 } | 860 } |
| 497 void clearOAuth2Token(String token) { | 861 void clearOAuth2Token(String token) { |
| 498 if (!_proxyImpl.isBound) { | 862 if (!_proxyImpl.isBound) { |
| 499 _proxyImpl.proxyError("The Proxy is closed."); | 863 _proxyImpl.proxyError("The Proxy is closed."); |
| 500 return; | 864 return; |
| 501 } | 865 } |
| 502 var params = new _AuthenticationServiceClearOAuth2TokenParams(); | 866 var params = new _AuthenticationServiceClearOAuth2TokenParams(); |
| 503 params.token = token; | 867 params.token = token; |
| 504 _proxyImpl.sendMessage(params, _AuthenticationService_clearOAuth2TokenName
); | 868 _proxyImpl.sendMessage(params, _AuthenticationService_clearOAuth2TokenName
); |
| 505 } | 869 } |
| 870 dynamic getOAuth2DeviceCode(List<String> scopes,[Function responseFactory =
null]) { |
| 871 var params = new _AuthenticationServiceGetOAuth2DeviceCodeParams(); |
| 872 params.scopes = scopes; |
| 873 return _proxyImpl.sendMessageWithRequestId( |
| 874 params, |
| 875 _AuthenticationService_getOAuth2DeviceCodeName, |
| 876 -1, |
| 877 bindings.MessageHeader.kMessageExpectsResponse); |
| 878 } |
| 879 dynamic addAccount(String deviceCode,[Function responseFactory = null]) { |
| 880 var params = new _AuthenticationServiceAddAccountParams(); |
| 881 params.deviceCode = deviceCode; |
| 882 return _proxyImpl.sendMessageWithRequestId( |
| 883 params, |
| 884 _AuthenticationService_addAccountName, |
| 885 -1, |
| 886 bindings.MessageHeader.kMessageExpectsResponse); |
| 887 } |
| 506 } | 888 } |
| 507 | 889 |
| 508 | 890 |
| 509 class AuthenticationServiceProxy implements bindings.ProxyBase { | 891 class AuthenticationServiceProxy implements bindings.ProxyBase { |
| 510 final bindings.Proxy impl; | 892 final bindings.Proxy impl; |
| 511 AuthenticationService ptr; | 893 AuthenticationService ptr; |
| 512 | 894 |
| 513 AuthenticationServiceProxy(_AuthenticationServiceProxyImpl proxyImpl) : | 895 AuthenticationServiceProxy(_AuthenticationServiceProxyImpl proxyImpl) : |
| 514 impl = proxyImpl, | 896 impl = proxyImpl, |
| 515 ptr = new _AuthenticationServiceProxyCalls(proxyImpl); | 897 ptr = new _AuthenticationServiceProxyCalls(proxyImpl); |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 589 mojo_factory_result.username = username; | 971 mojo_factory_result.username = username; |
| 590 mojo_factory_result.error = error; | 972 mojo_factory_result.error = error; |
| 591 return mojo_factory_result; | 973 return mojo_factory_result; |
| 592 } | 974 } |
| 593 AuthenticationServiceGetOAuth2TokenResponseParams _AuthenticationServiceGetOAu
th2TokenResponseParamsFactory(String token, String error) { | 975 AuthenticationServiceGetOAuth2TokenResponseParams _AuthenticationServiceGetOAu
th2TokenResponseParamsFactory(String token, String error) { |
| 594 var mojo_factory_result = new AuthenticationServiceGetOAuth2TokenResponsePar
ams(); | 976 var mojo_factory_result = new AuthenticationServiceGetOAuth2TokenResponsePar
ams(); |
| 595 mojo_factory_result.token = token; | 977 mojo_factory_result.token = token; |
| 596 mojo_factory_result.error = error; | 978 mojo_factory_result.error = error; |
| 597 return mojo_factory_result; | 979 return mojo_factory_result; |
| 598 } | 980 } |
| 981 AuthenticationServiceGetOAuth2DeviceCodeResponseParams _AuthenticationServiceG
etOAuth2DeviceCodeResponseParamsFactory(String verificationUrl, String deviceCod
e, String userCode, String error) { |
| 982 var mojo_factory_result = new AuthenticationServiceGetOAuth2DeviceCodeRespon
seParams(); |
| 983 mojo_factory_result.verificationUrl = verificationUrl; |
| 984 mojo_factory_result.deviceCode = deviceCode; |
| 985 mojo_factory_result.userCode = userCode; |
| 986 mojo_factory_result.error = error; |
| 987 return mojo_factory_result; |
| 988 } |
| 989 AuthenticationServiceAddAccountResponseParams _AuthenticationServiceAddAccount
ResponseParamsFactory(String username, String error) { |
| 990 var mojo_factory_result = new AuthenticationServiceAddAccountResponseParams(
); |
| 991 mojo_factory_result.username = username; |
| 992 mojo_factory_result.error = error; |
| 993 return mojo_factory_result; |
| 994 } |
| 599 | 995 |
| 600 dynamic handleMessage(bindings.ServiceMessage message) { | 996 dynamic handleMessage(bindings.ServiceMessage message) { |
| 601 if (bindings.ControlMessageHandler.isControlMessage(message)) { | 997 if (bindings.ControlMessageHandler.isControlMessage(message)) { |
| 602 return bindings.ControlMessageHandler.handleMessage(this, | 998 return bindings.ControlMessageHandler.handleMessage(this, |
| 603 0, | 999 0, |
| 604 message); | 1000 message); |
| 605 } | 1001 } |
| 606 assert(_impl != null); | 1002 assert(_impl != null); |
| 607 switch (message.header.type) { | 1003 switch (message.header.type) { |
| 608 case _AuthenticationService_selectAccountName: | 1004 case _AuthenticationService_selectAccountName: |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 647 _AuthenticationService_getOAuth2TokenName, | 1043 _AuthenticationService_getOAuth2TokenName, |
| 648 message.header.requestId, | 1044 message.header.requestId, |
| 649 bindings.MessageHeader.kMessageIsResponse); | 1045 bindings.MessageHeader.kMessageIsResponse); |
| 650 } | 1046 } |
| 651 break; | 1047 break; |
| 652 case _AuthenticationService_clearOAuth2TokenName: | 1048 case _AuthenticationService_clearOAuth2TokenName: |
| 653 var params = _AuthenticationServiceClearOAuth2TokenParams.deserialize( | 1049 var params = _AuthenticationServiceClearOAuth2TokenParams.deserialize( |
| 654 message.payload); | 1050 message.payload); |
| 655 _impl.clearOAuth2Token(params.token); | 1051 _impl.clearOAuth2Token(params.token); |
| 656 break; | 1052 break; |
| 1053 case _AuthenticationService_getOAuth2DeviceCodeName: |
| 1054 var params = _AuthenticationServiceGetOAuth2DeviceCodeParams.deserialize
( |
| 1055 message.payload); |
| 1056 var response = _impl.getOAuth2DeviceCode(params.scopes,_AuthenticationSe
rviceGetOAuth2DeviceCodeResponseParamsFactory); |
| 1057 if (response is Future) { |
| 1058 return response.then((response) { |
| 1059 if (response != null) { |
| 1060 return buildResponseWithId( |
| 1061 response, |
| 1062 _AuthenticationService_getOAuth2DeviceCodeName, |
| 1063 message.header.requestId, |
| 1064 bindings.MessageHeader.kMessageIsResponse); |
| 1065 } |
| 1066 }); |
| 1067 } else if (response != null) { |
| 1068 return buildResponseWithId( |
| 1069 response, |
| 1070 _AuthenticationService_getOAuth2DeviceCodeName, |
| 1071 message.header.requestId, |
| 1072 bindings.MessageHeader.kMessageIsResponse); |
| 1073 } |
| 1074 break; |
| 1075 case _AuthenticationService_addAccountName: |
| 1076 var params = _AuthenticationServiceAddAccountParams.deserialize( |
| 1077 message.payload); |
| 1078 var response = _impl.addAccount(params.deviceCode,_AuthenticationService
AddAccountResponseParamsFactory); |
| 1079 if (response is Future) { |
| 1080 return response.then((response) { |
| 1081 if (response != null) { |
| 1082 return buildResponseWithId( |
| 1083 response, |
| 1084 _AuthenticationService_addAccountName, |
| 1085 message.header.requestId, |
| 1086 bindings.MessageHeader.kMessageIsResponse); |
| 1087 } |
| 1088 }); |
| 1089 } else if (response != null) { |
| 1090 return buildResponseWithId( |
| 1091 response, |
| 1092 _AuthenticationService_addAccountName, |
| 1093 message.header.requestId, |
| 1094 bindings.MessageHeader.kMessageIsResponse); |
| 1095 } |
| 1096 break; |
| 657 default: | 1097 default: |
| 658 throw new bindings.MojoCodecError("Unexpected message name"); | 1098 throw new bindings.MojoCodecError("Unexpected message name"); |
| 659 break; | 1099 break; |
| 660 } | 1100 } |
| 661 return null; | 1101 return null; |
| 662 } | 1102 } |
| 663 | 1103 |
| 664 AuthenticationService get impl => _impl; | 1104 AuthenticationService get impl => _impl; |
| 665 set impl(AuthenticationService d) { | 1105 set impl(AuthenticationService d) { |
| 666 assert(_impl == null); | 1106 assert(_impl == null); |
| 667 _impl = d; | 1107 _impl = d; |
| 668 } | 1108 } |
| 669 | 1109 |
| 670 String toString() { | 1110 String toString() { |
| 671 var superString = super.toString(); | 1111 var superString = super.toString(); |
| 672 return "AuthenticationServiceStub($superString)"; | 1112 return "AuthenticationServiceStub($superString)"; |
| 673 } | 1113 } |
| 674 | 1114 |
| 675 int get version => 0; | 1115 int get version => 0; |
| 676 } | 1116 } |
| 677 | 1117 |
| 678 | 1118 |
| OLD | NEW |