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.Mes
sage 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 AuthenticationSe
rviceGetOAuth2DeviceCodeParams(); |
| 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 mess
age) { |
| 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 AuthenticationServiceAddA
ccountParams(); |
| 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 kAuthenticationService_selectAccount_name = 0; | 711 const int kAuthenticationService_selectAccount_name = 0; |
392 const int kAuthenticationService_getOAuth2Token_name = 1; | 712 const int kAuthenticationService_getOAuth2Token_name = 1; |
393 const int kAuthenticationService_clearOAuth2Token_name = 2; | 713 const int kAuthenticationService_clearOAuth2Token_name = 2; |
| 714 const int kAuthenticationService_getOAuth2DeviceCode_name = 3; |
| 715 const int kAuthenticationService_addAccount_name = 4; |
394 | 716 |
395 const String AuthenticationServiceName = | 717 const String AuthenticationServiceName = |
396 'authentication::AuthenticationService'; | 718 'authentication::AuthenticationService'; |
397 | 719 |
398 abstract class AuthenticationService { | 720 abstract class AuthenticationService { |
399 dynamic selectAccount(bool returnLastSelected,[Function responseFactory = null
]); | 721 dynamic selectAccount(bool returnLastSelected,[Function responseFactory = null
]); |
400 dynamic getOAuth2Token(String username,List<String> scopes,[Function responseF
actory = null]); | 722 dynamic getOAuth2Token(String username,List<String> scopes,[Function responseF
actory = null]); |
401 void clearOAuth2Token(String token); | 723 void clearOAuth2Token(String token); |
| 724 dynamic getOAuth2DeviceCode(List<String> scopes,[Function responseFactory = nu
ll]); |
| 725 dynamic addAccount(String deviceCode,[Function responseFactory = null]); |
402 | 726 |
403 } | 727 } |
404 | 728 |
405 | 729 |
406 class AuthenticationServiceProxyImpl extends bindings.Proxy { | 730 class AuthenticationServiceProxyImpl extends bindings.Proxy { |
407 AuthenticationServiceProxyImpl.fromEndpoint( | 731 AuthenticationServiceProxyImpl.fromEndpoint( |
408 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); | 732 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); |
409 | 733 |
410 AuthenticationServiceProxyImpl.fromHandle(core.MojoHandle handle) : | 734 AuthenticationServiceProxyImpl.fromHandle(core.MojoHandle handle) : |
411 super.fromHandle(handle); | 735 super.fromHandle(handle); |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
455 "Message had unknown request Id: ${message.header.requestId}"); | 779 "Message had unknown request Id: ${message.header.requestId}"); |
456 return; | 780 return; |
457 } | 781 } |
458 completerMap.remove(message.header.requestId); | 782 completerMap.remove(message.header.requestId); |
459 if (c.isCompleted) { | 783 if (c.isCompleted) { |
460 proxyError("Response completer already completed"); | 784 proxyError("Response completer already completed"); |
461 return; | 785 return; |
462 } | 786 } |
463 c.complete(r); | 787 c.complete(r); |
464 break; | 788 break; |
| 789 case kAuthenticationService_getOAuth2DeviceCode_name: |
| 790 var r = AuthenticationServiceGetOAuth2DeviceCodeResponseParams.deseriali
ze( |
| 791 message.payload); |
| 792 if (!message.header.hasRequestId) { |
| 793 proxyError("Expected a message with a valid request Id."); |
| 794 return; |
| 795 } |
| 796 Completer c = completerMap[message.header.requestId]; |
| 797 if (c == null) { |
| 798 proxyError( |
| 799 "Message had unknown request Id: ${message.header.requestId}"); |
| 800 return; |
| 801 } |
| 802 completerMap.remove(message.header.requestId); |
| 803 if (c.isCompleted) { |
| 804 proxyError("Response completer already completed"); |
| 805 return; |
| 806 } |
| 807 c.complete(r); |
| 808 break; |
| 809 case kAuthenticationService_addAccount_name: |
| 810 var r = AuthenticationServiceAddAccountResponseParams.deserialize( |
| 811 message.payload); |
| 812 if (!message.header.hasRequestId) { |
| 813 proxyError("Expected a message with a valid request Id."); |
| 814 return; |
| 815 } |
| 816 Completer c = completerMap[message.header.requestId]; |
| 817 if (c == null) { |
| 818 proxyError( |
| 819 "Message had unknown request Id: ${message.header.requestId}"); |
| 820 return; |
| 821 } |
| 822 completerMap.remove(message.header.requestId); |
| 823 if (c.isCompleted) { |
| 824 proxyError("Response completer already completed"); |
| 825 return; |
| 826 } |
| 827 c.complete(r); |
| 828 break; |
465 default: | 829 default: |
466 proxyError("Unexpected message type: ${message.header.type}"); | 830 proxyError("Unexpected message type: ${message.header.type}"); |
467 close(immediate: true); | 831 close(immediate: true); |
468 break; | 832 break; |
469 } | 833 } |
470 } | 834 } |
471 | 835 |
472 String toString() { | 836 String toString() { |
473 var superString = super.toString(); | 837 var superString = super.toString(); |
474 return "AuthenticationServiceProxyImpl($superString)"; | 838 return "AuthenticationServiceProxyImpl($superString)"; |
(...skipping 27 matching lines...) Expand all Loading... |
502 void clearOAuth2Token(String token) { | 866 void clearOAuth2Token(String token) { |
503 if (!_proxyImpl.isBound) { | 867 if (!_proxyImpl.isBound) { |
504 _proxyImpl.proxyError("The Proxy is closed."); | 868 _proxyImpl.proxyError("The Proxy is closed."); |
505 return; | 869 return; |
506 } | 870 } |
507 var params = new AuthenticationServiceClearOAuth2TokenParams(); | 871 var params = new AuthenticationServiceClearOAuth2TokenParams(); |
508 params.token = token; | 872 params.token = token; |
509 _proxyImpl.sendMessage(params, kAuthenticationService_clearOAuth2Token_nam
e); | 873 _proxyImpl.sendMessage(params, kAuthenticationService_clearOAuth2Token_nam
e); |
510 } | 874 } |
511 | 875 |
| 876 dynamic getOAuth2DeviceCode(List<String> scopes,[Function responseFactory =
null]) { |
| 877 var params = new AuthenticationServiceGetOAuth2DeviceCodeParams(); |
| 878 params.scopes = scopes; |
| 879 return _proxyImpl.sendMessageWithRequestId( |
| 880 params, |
| 881 kAuthenticationService_getOAuth2DeviceCode_name, |
| 882 -1, |
| 883 bindings.MessageHeader.kMessageExpectsResponse); |
| 884 } |
| 885 dynamic addAccount(String deviceCode,[Function responseFactory = null]) { |
| 886 var params = new AuthenticationServiceAddAccountParams(); |
| 887 params.deviceCode = deviceCode; |
| 888 return _proxyImpl.sendMessageWithRequestId( |
| 889 params, |
| 890 kAuthenticationService_addAccount_name, |
| 891 -1, |
| 892 bindings.MessageHeader.kMessageExpectsResponse); |
| 893 } |
512 } | 894 } |
513 | 895 |
514 | 896 |
515 class AuthenticationServiceProxy implements bindings.ProxyBase { | 897 class AuthenticationServiceProxy implements bindings.ProxyBase { |
516 final bindings.Proxy impl; | 898 final bindings.Proxy impl; |
517 AuthenticationService ptr; | 899 AuthenticationService ptr; |
518 final String name = AuthenticationServiceName; | 900 final String name = AuthenticationServiceName; |
519 | 901 |
520 AuthenticationServiceProxy(AuthenticationServiceProxyImpl proxyImpl) : | 902 AuthenticationServiceProxy(AuthenticationServiceProxyImpl proxyImpl) : |
521 impl = proxyImpl, | 903 impl = proxyImpl, |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
596 mojo_factory_result.username = username; | 978 mojo_factory_result.username = username; |
597 mojo_factory_result.error = error; | 979 mojo_factory_result.error = error; |
598 return mojo_factory_result; | 980 return mojo_factory_result; |
599 } | 981 } |
600 AuthenticationServiceGetOAuth2TokenResponseParams _AuthenticationServiceGetOAu
th2TokenResponseParamsFactory(String token, String error) { | 982 AuthenticationServiceGetOAuth2TokenResponseParams _AuthenticationServiceGetOAu
th2TokenResponseParamsFactory(String token, String error) { |
601 var mojo_factory_result = new AuthenticationServiceGetOAuth2TokenResponsePar
ams(); | 983 var mojo_factory_result = new AuthenticationServiceGetOAuth2TokenResponsePar
ams(); |
602 mojo_factory_result.token = token; | 984 mojo_factory_result.token = token; |
603 mojo_factory_result.error = error; | 985 mojo_factory_result.error = error; |
604 return mojo_factory_result; | 986 return mojo_factory_result; |
605 } | 987 } |
| 988 AuthenticationServiceGetOAuth2DeviceCodeResponseParams _AuthenticationServiceG
etOAuth2DeviceCodeResponseParamsFactory(String verificationUrl, String deviceCod
e, String userCode, String error) { |
| 989 var mojo_factory_result = new AuthenticationServiceGetOAuth2DeviceCodeRespon
seParams(); |
| 990 mojo_factory_result.verificationUrl = verificationUrl; |
| 991 mojo_factory_result.deviceCode = deviceCode; |
| 992 mojo_factory_result.userCode = userCode; |
| 993 mojo_factory_result.error = error; |
| 994 return mojo_factory_result; |
| 995 } |
| 996 AuthenticationServiceAddAccountResponseParams _AuthenticationServiceAddAccount
ResponseParamsFactory(String username, String error) { |
| 997 var mojo_factory_result = new AuthenticationServiceAddAccountResponseParams(
); |
| 998 mojo_factory_result.username = username; |
| 999 mojo_factory_result.error = error; |
| 1000 return mojo_factory_result; |
| 1001 } |
606 | 1002 |
607 dynamic handleMessage(bindings.ServiceMessage message) { | 1003 dynamic handleMessage(bindings.ServiceMessage message) { |
608 if (bindings.ControlMessageHandler.isControlMessage(message)) { | 1004 if (bindings.ControlMessageHandler.isControlMessage(message)) { |
609 return bindings.ControlMessageHandler.handleMessage(this, | 1005 return bindings.ControlMessageHandler.handleMessage(this, |
610 0, | 1006 0, |
611 message); | 1007 message); |
612 } | 1008 } |
613 assert(_impl != null); | 1009 assert(_impl != null); |
614 switch (message.header.type) { | 1010 switch (message.header.type) { |
615 case kAuthenticationService_selectAccount_name: | 1011 case kAuthenticationService_selectAccount_name: |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
654 kAuthenticationService_getOAuth2Token_name, | 1050 kAuthenticationService_getOAuth2Token_name, |
655 message.header.requestId, | 1051 message.header.requestId, |
656 bindings.MessageHeader.kMessageIsResponse); | 1052 bindings.MessageHeader.kMessageIsResponse); |
657 } | 1053 } |
658 break; | 1054 break; |
659 case kAuthenticationService_clearOAuth2Token_name: | 1055 case kAuthenticationService_clearOAuth2Token_name: |
660 var params = AuthenticationServiceClearOAuth2TokenParams.deserialize( | 1056 var params = AuthenticationServiceClearOAuth2TokenParams.deserialize( |
661 message.payload); | 1057 message.payload); |
662 _impl.clearOAuth2Token(params.token); | 1058 _impl.clearOAuth2Token(params.token); |
663 break; | 1059 break; |
| 1060 case kAuthenticationService_getOAuth2DeviceCode_name: |
| 1061 var params = AuthenticationServiceGetOAuth2DeviceCodeParams.deserialize( |
| 1062 message.payload); |
| 1063 var response = _impl.getOAuth2DeviceCode(params.scopes,_AuthenticationSe
rviceGetOAuth2DeviceCodeResponseParamsFactory); |
| 1064 if (response is Future) { |
| 1065 return response.then((response) { |
| 1066 if (response != null) { |
| 1067 return buildResponseWithId( |
| 1068 response, |
| 1069 kAuthenticationService_getOAuth2DeviceCode_name, |
| 1070 message.header.requestId, |
| 1071 bindings.MessageHeader.kMessageIsResponse); |
| 1072 } |
| 1073 }); |
| 1074 } else if (response != null) { |
| 1075 return buildResponseWithId( |
| 1076 response, |
| 1077 kAuthenticationService_getOAuth2DeviceCode_name, |
| 1078 message.header.requestId, |
| 1079 bindings.MessageHeader.kMessageIsResponse); |
| 1080 } |
| 1081 break; |
| 1082 case kAuthenticationService_addAccount_name: |
| 1083 var params = AuthenticationServiceAddAccountParams.deserialize( |
| 1084 message.payload); |
| 1085 var response = _impl.addAccount(params.deviceCode,_AuthenticationService
AddAccountResponseParamsFactory); |
| 1086 if (response is Future) { |
| 1087 return response.then((response) { |
| 1088 if (response != null) { |
| 1089 return buildResponseWithId( |
| 1090 response, |
| 1091 kAuthenticationService_addAccount_name, |
| 1092 message.header.requestId, |
| 1093 bindings.MessageHeader.kMessageIsResponse); |
| 1094 } |
| 1095 }); |
| 1096 } else if (response != null) { |
| 1097 return buildResponseWithId( |
| 1098 response, |
| 1099 kAuthenticationService_addAccount_name, |
| 1100 message.header.requestId, |
| 1101 bindings.MessageHeader.kMessageIsResponse); |
| 1102 } |
| 1103 break; |
664 default: | 1104 default: |
665 throw new bindings.MojoCodecError("Unexpected message name"); | 1105 throw new bindings.MojoCodecError("Unexpected message name"); |
666 break; | 1106 break; |
667 } | 1107 } |
668 return null; | 1108 return null; |
669 } | 1109 } |
670 | 1110 |
671 AuthenticationService get impl => _impl; | 1111 AuthenticationService get impl => _impl; |
672 set impl(AuthenticationService d) { | 1112 set impl(AuthenticationService d) { |
673 assert(_impl == null); | 1113 assert(_impl == null); |
674 _impl = d; | 1114 _impl = d; |
675 } | 1115 } |
676 | 1116 |
677 String toString() { | 1117 String toString() { |
678 var superString = super.toString(); | 1118 var superString = super.toString(); |
679 return "AuthenticationServiceStub($superString)"; | 1119 return "AuthenticationServiceStub($superString)"; |
680 } | 1120 } |
681 | 1121 |
682 int get version => 0; | 1122 int get version => 0; |
683 } | 1123 } |
684 | 1124 |
685 | 1125 |
OLD | NEW |