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

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

Issue 2006093002: Dart: Futures -> Callbacks. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Cleanup Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 library authentication_mojom; 5 library authentication_mojom;
6 import 'dart:async'; 6 import 'dart:async';
7 import 'package:mojo/bindings.dart' as bindings; 7 import 'package:mojo/bindings.dart' as bindings;
8 import 'package:mojo/core.dart' as core; 8 import 'package:mojo/core.dart' as core;
9 import 'package:mojo/mojo/bindings/types/service_describer.mojom.dart' as servic e_describer; 9 import 'package:mojo/mojo/bindings/types/service_describer.mojom.dart' as servic e_describer;
10 10
11 11
12 12
13 class _AuthenticationServiceSelectAccountParams extends bindings.Struct { 13 class _AuthenticationServiceSelectAccountParams extends bindings.Struct {
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 bool returnLastSelected = false; 17 bool returnLastSelected = false;
18 18
19 _AuthenticationServiceSelectAccountParams() : super(kVersions.last.size); 19 _AuthenticationServiceSelectAccountParams() : super(kVersions.last.size);
20 20
21 _AuthenticationServiceSelectAccountParams.init(
22 bool this.returnLastSelected
23 ) : super(kVersions.last.size);
24
21 static _AuthenticationServiceSelectAccountParams deserialize(bindings.Message message) { 25 static _AuthenticationServiceSelectAccountParams deserialize(bindings.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 _AuthenticationServiceSelectAccountParams decode(bindings.Decoder decod er0) { 34 static _AuthenticationServiceSelectAccountParams decode(bindings.Decoder decod er0) {
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 88
85 class AuthenticationServiceSelectAccountResponseParams extends bindings.Struct { 89 class AuthenticationServiceSelectAccountResponseParams extends bindings.Struct {
86 static const List<bindings.StructDataHeader> kVersions = const [ 90 static const List<bindings.StructDataHeader> kVersions = const [
87 const bindings.StructDataHeader(24, 0) 91 const bindings.StructDataHeader(24, 0)
88 ]; 92 ];
89 String username = null; 93 String username = null;
90 String error = null; 94 String error = null;
91 95
92 AuthenticationServiceSelectAccountResponseParams() : super(kVersions.last.size ); 96 AuthenticationServiceSelectAccountResponseParams() : super(kVersions.last.size );
93 97
98 AuthenticationServiceSelectAccountResponseParams.init(
99 String this.username,
100 String this.error
101 ) : super(kVersions.last.size);
102
94 static AuthenticationServiceSelectAccountResponseParams deserialize(bindings.M essage message) { 103 static AuthenticationServiceSelectAccountResponseParams deserialize(bindings.M essage message) {
95 var decoder = new bindings.Decoder(message); 104 var decoder = new bindings.Decoder(message);
96 var result = decode(decoder); 105 var result = decode(decoder);
97 if (decoder.excessHandles != null) { 106 if (decoder.excessHandles != null) {
98 decoder.excessHandles.forEach((h) => h.close()); 107 decoder.excessHandles.forEach((h) => h.close());
99 } 108 }
100 return result; 109 return result;
101 } 110 }
102 111
103 static AuthenticationServiceSelectAccountResponseParams decode(bindings.Decode r decoder0) { 112 static AuthenticationServiceSelectAccountResponseParams decode(bindings.Decode r decoder0) {
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 179
171 class _AuthenticationServiceGetOAuth2TokenParams extends bindings.Struct { 180 class _AuthenticationServiceGetOAuth2TokenParams extends bindings.Struct {
172 static const List<bindings.StructDataHeader> kVersions = const [ 181 static const List<bindings.StructDataHeader> kVersions = const [
173 const bindings.StructDataHeader(24, 0) 182 const bindings.StructDataHeader(24, 0)
174 ]; 183 ];
175 String username = null; 184 String username = null;
176 List<String> scopes = null; 185 List<String> scopes = null;
177 186
178 _AuthenticationServiceGetOAuth2TokenParams() : super(kVersions.last.size); 187 _AuthenticationServiceGetOAuth2TokenParams() : super(kVersions.last.size);
179 188
189 _AuthenticationServiceGetOAuth2TokenParams.init(
190 String this.username,
191 List<String> this.scopes
192 ) : super(kVersions.last.size);
193
180 static _AuthenticationServiceGetOAuth2TokenParams deserialize(bindings.Message message) { 194 static _AuthenticationServiceGetOAuth2TokenParams deserialize(bindings.Message message) {
181 var decoder = new bindings.Decoder(message); 195 var decoder = new bindings.Decoder(message);
182 var result = decode(decoder); 196 var result = decode(decoder);
183 if (decoder.excessHandles != null) { 197 if (decoder.excessHandles != null) {
184 decoder.excessHandles.forEach((h) => h.close()); 198 decoder.excessHandles.forEach((h) => h.close());
185 } 199 }
186 return result; 200 return result;
187 } 201 }
188 202
189 static _AuthenticationServiceGetOAuth2TokenParams decode(bindings.Decoder deco der0) { 203 static _AuthenticationServiceGetOAuth2TokenParams decode(bindings.Decoder deco der0) {
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 285
272 class AuthenticationServiceGetOAuth2TokenResponseParams extends bindings.Struct { 286 class AuthenticationServiceGetOAuth2TokenResponseParams extends bindings.Struct {
273 static const List<bindings.StructDataHeader> kVersions = const [ 287 static const List<bindings.StructDataHeader> kVersions = const [
274 const bindings.StructDataHeader(24, 0) 288 const bindings.StructDataHeader(24, 0)
275 ]; 289 ];
276 String token = null; 290 String token = null;
277 String error = null; 291 String error = null;
278 292
279 AuthenticationServiceGetOAuth2TokenResponseParams() : super(kVersions.last.siz e); 293 AuthenticationServiceGetOAuth2TokenResponseParams() : super(kVersions.last.siz e);
280 294
295 AuthenticationServiceGetOAuth2TokenResponseParams.init(
296 String this.token,
297 String this.error
298 ) : super(kVersions.last.size);
299
281 static AuthenticationServiceGetOAuth2TokenResponseParams deserialize(bindings. Message message) { 300 static AuthenticationServiceGetOAuth2TokenResponseParams deserialize(bindings. Message message) {
282 var decoder = new bindings.Decoder(message); 301 var decoder = new bindings.Decoder(message);
283 var result = decode(decoder); 302 var result = decode(decoder);
284 if (decoder.excessHandles != null) { 303 if (decoder.excessHandles != null) {
285 decoder.excessHandles.forEach((h) => h.close()); 304 decoder.excessHandles.forEach((h) => h.close());
286 } 305 }
287 return result; 306 return result;
288 } 307 }
289 308
290 static AuthenticationServiceGetOAuth2TokenResponseParams decode(bindings.Decod er decoder0) { 309 static AuthenticationServiceGetOAuth2TokenResponseParams decode(bindings.Decod er decoder0) {
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
356 375
357 376
358 class _AuthenticationServiceClearOAuth2TokenParams extends bindings.Struct { 377 class _AuthenticationServiceClearOAuth2TokenParams extends bindings.Struct {
359 static const List<bindings.StructDataHeader> kVersions = const [ 378 static const List<bindings.StructDataHeader> kVersions = const [
360 const bindings.StructDataHeader(16, 0) 379 const bindings.StructDataHeader(16, 0)
361 ]; 380 ];
362 String token = null; 381 String token = null;
363 382
364 _AuthenticationServiceClearOAuth2TokenParams() : super(kVersions.last.size); 383 _AuthenticationServiceClearOAuth2TokenParams() : super(kVersions.last.size);
365 384
385 _AuthenticationServiceClearOAuth2TokenParams.init(
386 String this.token
387 ) : super(kVersions.last.size);
388
366 static _AuthenticationServiceClearOAuth2TokenParams deserialize(bindings.Messa ge message) { 389 static _AuthenticationServiceClearOAuth2TokenParams deserialize(bindings.Messa ge message) {
367 var decoder = new bindings.Decoder(message); 390 var decoder = new bindings.Decoder(message);
368 var result = decode(decoder); 391 var result = decode(decoder);
369 if (decoder.excessHandles != null) { 392 if (decoder.excessHandles != null) {
370 decoder.excessHandles.forEach((h) => h.close()); 393 decoder.excessHandles.forEach((h) => h.close());
371 } 394 }
372 return result; 395 return result;
373 } 396 }
374 397
375 static _AuthenticationServiceClearOAuth2TokenParams decode(bindings.Decoder de coder0) { 398 static _AuthenticationServiceClearOAuth2TokenParams decode(bindings.Decoder de coder0) {
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
424 map["token"] = token; 447 map["token"] = token;
425 return map; 448 return map;
426 } 449 }
427 } 450 }
428 451
429 const int _authenticationServiceMethodSelectAccountName = 0; 452 const int _authenticationServiceMethodSelectAccountName = 0;
430 const int _authenticationServiceMethodGetOAuth2TokenName = 1; 453 const int _authenticationServiceMethodGetOAuth2TokenName = 1;
431 const int _authenticationServiceMethodClearOAuth2TokenName = 2; 454 const int _authenticationServiceMethodClearOAuth2TokenName = 2;
432 455
433 class _AuthenticationServiceServiceDescription implements service_describer.Serv iceDescription { 456 class _AuthenticationServiceServiceDescription implements service_describer.Serv iceDescription {
434 dynamic getTopLevelInterface([Function responseFactory]) => 457 void getTopLevelInterface(Function responder) {
435 responseFactory(null); 458 responder(null);
459 }
436 460
437 dynamic getTypeDefinition(String typeKey, [Function responseFactory]) => 461 void getTypeDefinition(String typeKey, Function responder) {
438 responseFactory(null); 462 responder(null);
463 }
439 464
440 dynamic getAllTypeDefinitions([Function responseFactory]) => 465 void getAllTypeDefinitions(Function responder) {
441 responseFactory(null); 466 responder(null);
467 }
442 } 468 }
443 469
444 abstract class AuthenticationService { 470 abstract class AuthenticationService {
445 static const String serviceName = "authentication::AuthenticationService"; 471 static const String serviceName = "authentication::AuthenticationService";
446 472
447 static service_describer.ServiceDescription _cachedServiceDescription; 473 static service_describer.ServiceDescription _cachedServiceDescription;
448 static service_describer.ServiceDescription get serviceDescription { 474 static service_describer.ServiceDescription get serviceDescription {
449 if (_cachedServiceDescription == null) { 475 if (_cachedServiceDescription == null) {
450 _cachedServiceDescription = new _AuthenticationServiceServiceDescription() ; 476 _cachedServiceDescription = new _AuthenticationServiceServiceDescription() ;
451 } 477 }
452 return _cachedServiceDescription; 478 return _cachedServiceDescription;
453 } 479 }
454 480
455 static AuthenticationServiceProxy connectToService( 481 static AuthenticationServiceProxy connectToService(
456 bindings.ServiceConnector s, String url, [String serviceName]) { 482 bindings.ServiceConnector s, String url, [String serviceName]) {
457 AuthenticationServiceProxy p = new AuthenticationServiceProxy.unbound(); 483 AuthenticationServiceProxy p = new AuthenticationServiceProxy.unbound();
458 String name = serviceName ?? AuthenticationService.serviceName; 484 String name = serviceName ?? AuthenticationService.serviceName;
459 if ((name == null) || name.isEmpty) { 485 if ((name == null) || name.isEmpty) {
460 throw new core.MojoApiError( 486 throw new core.MojoApiError(
461 "If an interface has no ServiceName, then one must be provided."); 487 "If an interface has no ServiceName, then one must be provided.");
462 } 488 }
463 s.connectToService(url, p, name); 489 s.connectToService(url, p, name);
464 return p; 490 return p;
465 } 491 }
466 dynamic selectAccount(bool returnLastSelected,[Function responseFactory = null ]); 492 void selectAccount(bool returnLastSelected,void callback(String username, Stri ng error));
467 dynamic getOAuth2Token(String username,List<String> scopes,[Function responseF actory = null]); 493 void getOAuth2Token(String username,List<String> scopes,void callback(String t oken, String error));
468 void clearOAuth2Token(String token); 494 void clearOAuth2Token(String token);
469 } 495 }
470 496
471 abstract class AuthenticationServiceInterface 497 abstract class AuthenticationServiceInterface
472 implements bindings.MojoInterface<AuthenticationService>, 498 implements bindings.MojoInterface<AuthenticationService>,
473 AuthenticationService { 499 AuthenticationService {
474 factory AuthenticationServiceInterface([AuthenticationService impl]) => 500 factory AuthenticationServiceInterface([AuthenticationService impl]) =>
475 new AuthenticationServiceStub.unbound(impl); 501 new AuthenticationServiceStub.unbound(impl);
476 502
477 factory AuthenticationServiceInterface.fromEndpoint( 503 factory AuthenticationServiceInterface.fromEndpoint(
(...skipping 30 matching lines...) Expand all
508 534
509 void handleResponse(bindings.ServiceMessage message) { 535 void handleResponse(bindings.ServiceMessage message) {
510 switch (message.header.type) { 536 switch (message.header.type) {
511 case _authenticationServiceMethodSelectAccountName: 537 case _authenticationServiceMethodSelectAccountName:
512 var r = AuthenticationServiceSelectAccountResponseParams.deserialize( 538 var r = AuthenticationServiceSelectAccountResponseParams.deserialize(
513 message.payload); 539 message.payload);
514 if (!message.header.hasRequestId) { 540 if (!message.header.hasRequestId) {
515 proxyError("Expected a message with a valid request Id."); 541 proxyError("Expected a message with a valid request Id.");
516 return; 542 return;
517 } 543 }
518 Completer c = completerMap[message.header.requestId]; 544 Function callback = callbackMap[message.header.requestId];
519 if (c == null) { 545 if (callback == null) {
520 proxyError( 546 proxyError(
521 "Message had unknown request Id: ${message.header.requestId}"); 547 "Message had unknown request Id: ${message.header.requestId}");
522 return; 548 return;
523 } 549 }
524 completerMap.remove(message.header.requestId); 550 callbackMap.remove(message.header.requestId);
525 if (c.isCompleted) { 551 callback(r.username , r.error );
526 proxyError("Response completer already completed");
527 return;
528 }
529 c.complete(r);
530 break; 552 break;
531 case _authenticationServiceMethodGetOAuth2TokenName: 553 case _authenticationServiceMethodGetOAuth2TokenName:
532 var r = AuthenticationServiceGetOAuth2TokenResponseParams.deserialize( 554 var r = AuthenticationServiceGetOAuth2TokenResponseParams.deserialize(
533 message.payload); 555 message.payload);
534 if (!message.header.hasRequestId) { 556 if (!message.header.hasRequestId) {
535 proxyError("Expected a message with a valid request Id."); 557 proxyError("Expected a message with a valid request Id.");
536 return; 558 return;
537 } 559 }
538 Completer c = completerMap[message.header.requestId]; 560 Function callback = callbackMap[message.header.requestId];
539 if (c == null) { 561 if (callback == null) {
540 proxyError( 562 proxyError(
541 "Message had unknown request Id: ${message.header.requestId}"); 563 "Message had unknown request Id: ${message.header.requestId}");
542 return; 564 return;
543 } 565 }
544 completerMap.remove(message.header.requestId); 566 callbackMap.remove(message.header.requestId);
545 if (c.isCompleted) { 567 callback(r.token , r.error );
546 proxyError("Response completer already completed");
547 return;
548 }
549 c.complete(r);
550 break; 568 break;
551 default: 569 default:
552 proxyError("Unexpected message type: ${message.header.type}"); 570 proxyError("Unexpected message type: ${message.header.type}");
553 close(immediate: true); 571 close(immediate: true);
554 break; 572 break;
555 } 573 }
556 } 574 }
557 575
558 @override 576 @override
559 String toString() { 577 String toString() {
(...skipping 24 matching lines...) Expand all
584 return newMockedProxy; 602 return newMockedProxy;
585 } 603 }
586 604
587 static AuthenticationServiceProxy newFromEndpoint( 605 static AuthenticationServiceProxy newFromEndpoint(
588 core.MojoMessagePipeEndpoint endpoint) { 606 core.MojoMessagePipeEndpoint endpoint) {
589 assert(endpoint.setDescription("For AuthenticationServiceProxy")); 607 assert(endpoint.setDescription("For AuthenticationServiceProxy"));
590 return new AuthenticationServiceProxy.fromEndpoint(endpoint); 608 return new AuthenticationServiceProxy.fromEndpoint(endpoint);
591 } 609 }
592 610
593 611
594 dynamic selectAccount(bool returnLastSelected,[Function responseFactory = null ]) { 612 void selectAccount(bool returnLastSelected,void callback(String username, Stri ng error)) {
595 if (impl != null) { 613 if (impl != null) {
596 return new Future(() => impl.selectAccount(returnLastSelected,_Authenticat ionServiceStubControl._authenticationServiceSelectAccountResponseParamsFactory)) ; 614 impl.selectAccount(returnLastSelected,callback);
615 return;
597 } 616 }
598 var params = new _AuthenticationServiceSelectAccountParams(); 617 var params = new _AuthenticationServiceSelectAccountParams();
599 params.returnLastSelected = returnLastSelected; 618 params.returnLastSelected = returnLastSelected;
600 return ctrl.sendMessageWithRequestId( 619 ctrl.sendMessageWithRequestId(
601 params, 620 params,
602 _authenticationServiceMethodSelectAccountName, 621 _authenticationServiceMethodSelectAccountName,
603 -1, 622 -1,
604 bindings.MessageHeader.kMessageExpectsResponse); 623 bindings.MessageHeader.kMessageExpectsResponse,
624 callback);
605 } 625 }
606 dynamic getOAuth2Token(String username,List<String> scopes,[Function responseF actory = null]) { 626 void getOAuth2Token(String username,List<String> scopes,void callback(String t oken, String error)) {
607 if (impl != null) { 627 if (impl != null) {
608 return new Future(() => impl.getOAuth2Token(username,scopes,_Authenticatio nServiceStubControl._authenticationServiceGetOAuth2TokenResponseParamsFactory)); 628 impl.getOAuth2Token(username,scopes,callback);
629 return;
609 } 630 }
610 var params = new _AuthenticationServiceGetOAuth2TokenParams(); 631 var params = new _AuthenticationServiceGetOAuth2TokenParams();
611 params.username = username; 632 params.username = username;
612 params.scopes = scopes; 633 params.scopes = scopes;
613 return ctrl.sendMessageWithRequestId( 634 ctrl.sendMessageWithRequestId(
614 params, 635 params,
615 _authenticationServiceMethodGetOAuth2TokenName, 636 _authenticationServiceMethodGetOAuth2TokenName,
616 -1, 637 -1,
617 bindings.MessageHeader.kMessageExpectsResponse); 638 bindings.MessageHeader.kMessageExpectsResponse,
639 callback);
618 } 640 }
619 void clearOAuth2Token(String token) { 641 void clearOAuth2Token(String token) {
620 if (impl != null) { 642 if (impl != null) {
621 impl.clearOAuth2Token(token); 643 impl.clearOAuth2Token(token);
622 return; 644 return;
623 } 645 }
624 if (!ctrl.isBound) { 646 if (!ctrl.isBound) {
625 ctrl.proxyError("The Proxy is closed."); 647 ctrl.proxyError("The Proxy is closed.");
626 return; 648 return;
627 } 649 }
(...skipping 19 matching lines...) Expand all
647 core.MojoHandle handle, [AuthenticationService impl]) 669 core.MojoHandle handle, [AuthenticationService impl])
648 : super.fromHandle(handle, autoBegin: impl != null) { 670 : super.fromHandle(handle, autoBegin: impl != null) {
649 _impl = impl; 671 _impl = impl;
650 } 672 }
651 673
652 _AuthenticationServiceStubControl.unbound([this._impl]) : super.unbound(); 674 _AuthenticationServiceStubControl.unbound([this._impl]) : super.unbound();
653 675
654 String get serviceName => AuthenticationService.serviceName; 676 String get serviceName => AuthenticationService.serviceName;
655 677
656 678
657 static AuthenticationServiceSelectAccountResponseParams _authenticationService SelectAccountResponseParamsFactory(String username, String error) { 679 Function _authenticationServiceSelectAccountResponseParamsResponder(
658 var result = new AuthenticationServiceSelectAccountResponseParams(); 680 int requestId) {
659 result.username = username; 681 return (String username, String error) {
660 result.error = error; 682 var result = new AuthenticationServiceSelectAccountResponseParams();
661 return result; 683 result.username = username;
684 result.error = error;
685 sendResponse(buildResponseWithId(
686 result,
687 _authenticationServiceMethodSelectAccountName,
688 requestId,
689 bindings.MessageHeader.kMessageIsResponse));
690 };
662 } 691 }
663 static AuthenticationServiceGetOAuth2TokenResponseParams _authenticationServic eGetOAuth2TokenResponseParamsFactory(String token, String error) { 692 Function _authenticationServiceGetOAuth2TokenResponseParamsResponder(
664 var result = new AuthenticationServiceGetOAuth2TokenResponseParams(); 693 int requestId) {
665 result.token = token; 694 return (String token, String error) {
666 result.error = error; 695 var result = new AuthenticationServiceGetOAuth2TokenResponseParams();
667 return result; 696 result.token = token;
697 result.error = error;
698 sendResponse(buildResponseWithId(
699 result,
700 _authenticationServiceMethodGetOAuth2TokenName,
701 requestId,
702 bindings.MessageHeader.kMessageIsResponse));
703 };
668 } 704 }
669 705
670 dynamic handleMessage(bindings.ServiceMessage message) { 706 void handleMessage(bindings.ServiceMessage message) {
671 if (bindings.ControlMessageHandler.isControlMessage(message)) { 707 if (bindings.ControlMessageHandler.isControlMessage(message)) {
672 return bindings.ControlMessageHandler.handleMessage(this, 708 bindings.ControlMessageHandler.handleMessage(
673 0, 709 this, 0, message);
674 message); 710 return;
675 } 711 }
676 if (_impl == null) { 712 if (_impl == null) {
677 throw new core.MojoApiError("$this has no implementation set"); 713 throw new core.MojoApiError("$this has no implementation set");
678 } 714 }
679 switch (message.header.type) { 715 switch (message.header.type) {
680 case _authenticationServiceMethodSelectAccountName: 716 case _authenticationServiceMethodSelectAccountName:
681 var params = _AuthenticationServiceSelectAccountParams.deserialize( 717 var params = _AuthenticationServiceSelectAccountParams.deserialize(
682 message.payload); 718 message.payload);
683 var response = _impl.selectAccount(params.returnLastSelected,_authentica tionServiceSelectAccountResponseParamsFactory); 719 _impl.selectAccount(params.returnLastSelected, _authenticationServiceSel ectAccountResponseParamsResponder(message.header.requestId));
684 if (response is Future) {
685 return response.then((response) {
686 if (response != null) {
687 return buildResponseWithId(
688 response,
689 _authenticationServiceMethodSelectAccountName,
690 message.header.requestId,
691 bindings.MessageHeader.kMessageIsResponse);
692 }
693 });
694 } else if (response != null) {
695 return buildResponseWithId(
696 response,
697 _authenticationServiceMethodSelectAccountName,
698 message.header.requestId,
699 bindings.MessageHeader.kMessageIsResponse);
700 }
701 break; 720 break;
702 case _authenticationServiceMethodGetOAuth2TokenName: 721 case _authenticationServiceMethodGetOAuth2TokenName:
703 var params = _AuthenticationServiceGetOAuth2TokenParams.deserialize( 722 var params = _AuthenticationServiceGetOAuth2TokenParams.deserialize(
704 message.payload); 723 message.payload);
705 var response = _impl.getOAuth2Token(params.username,params.scopes,_authe nticationServiceGetOAuth2TokenResponseParamsFactory); 724 _impl.getOAuth2Token(params.username, params.scopes, _authenticationServ iceGetOAuth2TokenResponseParamsResponder(message.header.requestId));
706 if (response is Future) {
707 return response.then((response) {
708 if (response != null) {
709 return buildResponseWithId(
710 response,
711 _authenticationServiceMethodGetOAuth2TokenName,
712 message.header.requestId,
713 bindings.MessageHeader.kMessageIsResponse);
714 }
715 });
716 } else if (response != null) {
717 return buildResponseWithId(
718 response,
719 _authenticationServiceMethodGetOAuth2TokenName,
720 message.header.requestId,
721 bindings.MessageHeader.kMessageIsResponse);
722 }
723 break; 725 break;
724 case _authenticationServiceMethodClearOAuth2TokenName: 726 case _authenticationServiceMethodClearOAuth2TokenName:
725 var params = _AuthenticationServiceClearOAuth2TokenParams.deserialize( 727 var params = _AuthenticationServiceClearOAuth2TokenParams.deserialize(
726 message.payload); 728 message.payload);
727 _impl.clearOAuth2Token(params.token); 729 _impl.clearOAuth2Token(params.token);
728 break; 730 break;
729 default: 731 default:
730 throw new bindings.MojoCodecError("Unexpected message name"); 732 throw new bindings.MojoCodecError("Unexpected message name");
731 break; 733 break;
732 } 734 }
733 return null;
734 } 735 }
735 736
736 AuthenticationService get impl => _impl; 737 AuthenticationService get impl => _impl;
737 set impl(AuthenticationService d) { 738 set impl(AuthenticationService d) {
738 if (d == null) { 739 if (d == null) {
739 throw new core.MojoApiError("$this: Cannot set a null implementation"); 740 throw new core.MojoApiError("$this: Cannot set a null implementation");
740 } 741 }
741 if (isBound && (_impl == null)) { 742 if (isBound && (_impl == null)) {
742 beginHandlingEvents(); 743 beginHandlingEvents();
743 } 744 }
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
777 core.MojoHandle handle, [AuthenticationService impl]) 778 core.MojoHandle handle, [AuthenticationService impl])
778 : super(new _AuthenticationServiceStubControl.fromHandle(handle, impl)); 779 : super(new _AuthenticationServiceStubControl.fromHandle(handle, impl));
779 780
780 static AuthenticationServiceStub newFromEndpoint( 781 static AuthenticationServiceStub newFromEndpoint(
781 core.MojoMessagePipeEndpoint endpoint) { 782 core.MojoMessagePipeEndpoint endpoint) {
782 assert(endpoint.setDescription("For AuthenticationServiceStub")); 783 assert(endpoint.setDescription("For AuthenticationServiceStub"));
783 return new AuthenticationServiceStub.fromEndpoint(endpoint); 784 return new AuthenticationServiceStub.fromEndpoint(endpoint);
784 } 785 }
785 786
786 787
787 dynamic selectAccount(bool returnLastSelected,[Function responseFactory = null ]) { 788 void selectAccount(bool returnLastSelected,void callback(String username, Stri ng error)) {
788 return impl.selectAccount(returnLastSelected,responseFactory); 789 return impl.selectAccount(returnLastSelected,callback);
789 } 790 }
790 dynamic getOAuth2Token(String username,List<String> scopes,[Function responseF actory = null]) { 791 void getOAuth2Token(String username,List<String> scopes,void callback(String t oken, String error)) {
791 return impl.getOAuth2Token(username,scopes,responseFactory); 792 return impl.getOAuth2Token(username,scopes,callback);
792 } 793 }
793 void clearOAuth2Token(String token) { 794 void clearOAuth2Token(String token) {
794 return impl.clearOAuth2Token(token); 795 return impl.clearOAuth2Token(token);
795 } 796 }
796 } 797 }
797 798
798 799
799 800
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698