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 notifications_mojom; | 5 library notifications_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 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
383 return map; | 383 return map; |
384 } | 384 } |
385 } | 385 } |
386 | 386 |
387 | 387 |
388 class _NotificationServicePostParams extends bindings.Struct { | 388 class _NotificationServicePostParams extends bindings.Struct { |
389 static const List<bindings.StructDataHeader> kVersions = const [ | 389 static const List<bindings.StructDataHeader> kVersions = const [ |
390 const bindings.StructDataHeader(32, 0) | 390 const bindings.StructDataHeader(32, 0) |
391 ]; | 391 ]; |
392 NotificationData notificationData = null; | 392 NotificationData notificationData = null; |
393 Object client = null; | 393 NotificationClientInterface client = null; |
394 Object notification = null; | 394 NotificationInterfaceRequest notification = null; |
395 | 395 |
396 _NotificationServicePostParams() : super(kVersions.last.size); | 396 _NotificationServicePostParams() : super(kVersions.last.size); |
397 | 397 |
398 static _NotificationServicePostParams deserialize(bindings.Message message) { | 398 static _NotificationServicePostParams deserialize(bindings.Message message) { |
399 var decoder = new bindings.Decoder(message); | 399 var decoder = new bindings.Decoder(message); |
400 var result = decode(decoder); | 400 var result = decode(decoder); |
401 if (decoder.excessHandles != null) { | 401 if (decoder.excessHandles != null) { |
402 decoder.excessHandles.forEach((h) => h.close()); | 402 decoder.excessHandles.forEach((h) => h.close()); |
403 } | 403 } |
404 return result; | 404 return result; |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
491 | 491 |
492 dynamic getTypeDefinition(String typeKey, [Function responseFactory]) => | 492 dynamic getTypeDefinition(String typeKey, [Function responseFactory]) => |
493 responseFactory(null); | 493 responseFactory(null); |
494 | 494 |
495 dynamic getAllTypeDefinitions([Function responseFactory]) => | 495 dynamic getAllTypeDefinitions([Function responseFactory]) => |
496 responseFactory(null); | 496 responseFactory(null); |
497 } | 497 } |
498 | 498 |
499 abstract class NotificationClient { | 499 abstract class NotificationClient { |
500 static const String serviceName = null; | 500 static const String serviceName = null; |
| 501 |
| 502 static service_describer.ServiceDescription _cachedServiceDescription; |
| 503 static service_describer.ServiceDescription get serviceDescription { |
| 504 if (_cachedServiceDescription == null) { |
| 505 _cachedServiceDescription = new _NotificationClientServiceDescription(); |
| 506 } |
| 507 return _cachedServiceDescription; |
| 508 } |
| 509 |
| 510 static NotificationClientProxy connectToService( |
| 511 bindings.ServiceConnector s, String url, [String serviceName]) { |
| 512 NotificationClientProxy p = new NotificationClientProxy.unbound(); |
| 513 String name = serviceName ?? NotificationClient.serviceName; |
| 514 if ((name == null) || name.isEmpty) { |
| 515 throw new core.MojoApiError( |
| 516 "If an interface has no ServiceName, then one must be provided."); |
| 517 } |
| 518 s.connectToService(url, p, name); |
| 519 return p; |
| 520 } |
501 void onSelected(); | 521 void onSelected(); |
502 void onDismissed(); | 522 void onDismissed(); |
503 } | 523 } |
504 | 524 |
| 525 abstract class NotificationClientInterface |
| 526 implements bindings.MojoInterface<NotificationClient>, |
| 527 NotificationClient { |
| 528 factory NotificationClientInterface([NotificationClient impl]) => |
| 529 new NotificationClientStub.unbound(impl); |
| 530 factory NotificationClientInterface.fromEndpoint( |
| 531 core.MojoMessagePipeEndpoint endpoint, |
| 532 [NotificationClient impl]) => |
| 533 new NotificationClientStub.fromEndpoint(endpoint, impl); |
| 534 } |
| 535 |
| 536 abstract class NotificationClientInterfaceRequest |
| 537 implements bindings.MojoInterface<NotificationClient>, |
| 538 NotificationClient { |
| 539 factory NotificationClientInterfaceRequest() => |
| 540 new NotificationClientProxy.unbound(); |
| 541 } |
| 542 |
505 class _NotificationClientProxyControl | 543 class _NotificationClientProxyControl |
506 extends bindings.ProxyMessageHandler | 544 extends bindings.ProxyMessageHandler |
507 implements bindings.ProxyControl { | 545 implements bindings.ProxyControl<NotificationClient> { |
508 _NotificationClientProxyControl.fromEndpoint( | 546 _NotificationClientProxyControl.fromEndpoint( |
509 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); | 547 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); |
510 | 548 |
511 _NotificationClientProxyControl.fromHandle( | 549 _NotificationClientProxyControl.fromHandle( |
512 core.MojoHandle handle) : super.fromHandle(handle); | 550 core.MojoHandle handle) : super.fromHandle(handle); |
513 | 551 |
514 _NotificationClientProxyControl.unbound() : super.unbound(); | 552 _NotificationClientProxyControl.unbound() : super.unbound(); |
515 | 553 |
516 service_describer.ServiceDescription get serviceDescription => | |
517 new _NotificationClientServiceDescription(); | |
518 | |
519 String get serviceName => NotificationClient.serviceName; | 554 String get serviceName => NotificationClient.serviceName; |
520 | 555 |
521 void handleResponse(bindings.ServiceMessage message) { | 556 void handleResponse(bindings.ServiceMessage message) { |
522 switch (message.header.type) { | 557 switch (message.header.type) { |
523 default: | 558 default: |
524 proxyError("Unexpected message type: ${message.header.type}"); | 559 proxyError("Unexpected message type: ${message.header.type}"); |
525 close(immediate: true); | 560 close(immediate: true); |
526 break; | 561 break; |
527 } | 562 } |
528 } | 563 } |
529 | 564 |
| 565 NotificationClient get impl => null; |
| 566 set impl(NotificationClient _) { |
| 567 throw new core.MojoApiError("The impl of a Proxy cannot be set."); |
| 568 } |
| 569 |
530 @override | 570 @override |
531 String toString() { | 571 String toString() { |
532 var superString = super.toString(); | 572 var superString = super.toString(); |
533 return "_NotificationClientProxyControl($superString)"; | 573 return "_NotificationClientProxyControl($superString)"; |
534 } | 574 } |
535 } | 575 } |
536 | 576 |
537 class NotificationClientProxy | 577 class NotificationClientProxy |
538 extends bindings.Proxy | 578 extends bindings.Proxy<NotificationClient> |
539 implements NotificationClient { | 579 implements NotificationClient, |
| 580 NotificationClientInterface, |
| 581 NotificationClientInterfaceRequest { |
540 NotificationClientProxy.fromEndpoint( | 582 NotificationClientProxy.fromEndpoint( |
541 core.MojoMessagePipeEndpoint endpoint) | 583 core.MojoMessagePipeEndpoint endpoint) |
542 : super(new _NotificationClientProxyControl.fromEndpoint(endpoint)); | 584 : super(new _NotificationClientProxyControl.fromEndpoint(endpoint)); |
543 | 585 |
544 NotificationClientProxy.fromHandle(core.MojoHandle handle) | 586 NotificationClientProxy.fromHandle(core.MojoHandle handle) |
545 : super(new _NotificationClientProxyControl.fromHandle(handle)); | 587 : super(new _NotificationClientProxyControl.fromHandle(handle)); |
546 | 588 |
547 NotificationClientProxy.unbound() | 589 NotificationClientProxy.unbound() |
548 : super(new _NotificationClientProxyControl.unbound()); | 590 : super(new _NotificationClientProxyControl.unbound()); |
549 | 591 |
550 static NotificationClientProxy newFromEndpoint( | 592 static NotificationClientProxy newFromEndpoint( |
551 core.MojoMessagePipeEndpoint endpoint) { | 593 core.MojoMessagePipeEndpoint endpoint) { |
552 assert(endpoint.setDescription("For NotificationClientProxy")); | 594 assert(endpoint.setDescription("For NotificationClientProxy")); |
553 return new NotificationClientProxy.fromEndpoint(endpoint); | 595 return new NotificationClientProxy.fromEndpoint(endpoint); |
554 } | 596 } |
555 | 597 |
556 factory NotificationClientProxy.connectToService( | |
557 bindings.ServiceConnector s, String url, [String serviceName]) { | |
558 NotificationClientProxy p = new NotificationClientProxy.unbound(); | |
559 s.connectToService(url, p, serviceName); | |
560 return p; | |
561 } | |
562 | |
563 | 598 |
564 void onSelected() { | 599 void onSelected() { |
565 if (!ctrl.isBound) { | 600 if (!ctrl.isBound) { |
566 ctrl.proxyError("The Proxy is closed."); | 601 ctrl.proxyError("The Proxy is closed."); |
567 return; | 602 return; |
568 } | 603 } |
569 var params = new _NotificationClientOnSelectedParams(); | 604 var params = new _NotificationClientOnSelectedParams(); |
570 ctrl.sendMessage(params, | 605 ctrl.sendMessage(params, |
571 _notificationClientMethodOnSelectedName); | 606 _notificationClientMethodOnSelectedName); |
572 } | 607 } |
(...skipping 20 matching lines...) Expand all Loading... |
593 } | 628 } |
594 | 629 |
595 _NotificationClientStubControl.fromHandle( | 630 _NotificationClientStubControl.fromHandle( |
596 core.MojoHandle handle, [NotificationClient impl]) | 631 core.MojoHandle handle, [NotificationClient impl]) |
597 : super.fromHandle(handle, autoBegin: impl != null) { | 632 : super.fromHandle(handle, autoBegin: impl != null) { |
598 _impl = impl; | 633 _impl = impl; |
599 } | 634 } |
600 | 635 |
601 _NotificationClientStubControl.unbound([this._impl]) : super.unbound(); | 636 _NotificationClientStubControl.unbound([this._impl]) : super.unbound(); |
602 | 637 |
| 638 String get serviceName => NotificationClient.serviceName; |
| 639 |
603 | 640 |
604 | 641 |
605 dynamic handleMessage(bindings.ServiceMessage message) { | 642 dynamic handleMessage(bindings.ServiceMessage message) { |
606 if (bindings.ControlMessageHandler.isControlMessage(message)) { | 643 if (bindings.ControlMessageHandler.isControlMessage(message)) { |
607 return bindings.ControlMessageHandler.handleMessage(this, | 644 return bindings.ControlMessageHandler.handleMessage(this, |
608 0, | 645 0, |
609 message); | 646 message); |
610 } | 647 } |
611 if (_impl == null) { | 648 if (_impl == null) { |
612 throw new core.MojoApiError("$this has no implementation set"); | 649 throw new core.MojoApiError("$this has no implementation set"); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
644 } | 681 } |
645 } | 682 } |
646 | 683 |
647 @override | 684 @override |
648 String toString() { | 685 String toString() { |
649 var superString = super.toString(); | 686 var superString = super.toString(); |
650 return "_NotificationClientStubControl($superString)"; | 687 return "_NotificationClientStubControl($superString)"; |
651 } | 688 } |
652 | 689 |
653 int get version => 0; | 690 int get version => 0; |
654 | |
655 static service_describer.ServiceDescription _cachedServiceDescription; | |
656 static service_describer.ServiceDescription get serviceDescription { | |
657 if (_cachedServiceDescription == null) { | |
658 _cachedServiceDescription = new _NotificationClientServiceDescription(); | |
659 } | |
660 return _cachedServiceDescription; | |
661 } | |
662 } | 691 } |
663 | 692 |
664 class NotificationClientStub | 693 class NotificationClientStub |
665 extends bindings.Stub<NotificationClient> | 694 extends bindings.Stub<NotificationClient> |
666 implements NotificationClient { | 695 implements NotificationClient, |
| 696 NotificationClientInterface, |
| 697 NotificationClientInterfaceRequest { |
| 698 NotificationClientStub.unbound([NotificationClient impl]) |
| 699 : super(new _NotificationClientStubControl.unbound(impl)); |
| 700 |
667 NotificationClientStub.fromEndpoint( | 701 NotificationClientStub.fromEndpoint( |
668 core.MojoMessagePipeEndpoint endpoint, [NotificationClient impl]) | 702 core.MojoMessagePipeEndpoint endpoint, [NotificationClient impl]) |
669 : super(new _NotificationClientStubControl.fromEndpoint(endpoint, impl)); | 703 : super(new _NotificationClientStubControl.fromEndpoint(endpoint, impl)); |
670 | 704 |
671 NotificationClientStub.fromHandle( | 705 NotificationClientStub.fromHandle( |
672 core.MojoHandle handle, [NotificationClient impl]) | 706 core.MojoHandle handle, [NotificationClient impl]) |
673 : super(new _NotificationClientStubControl.fromHandle(handle, impl)); | 707 : super(new _NotificationClientStubControl.fromHandle(handle, impl)); |
674 | 708 |
675 NotificationClientStub.unbound([NotificationClient impl]) | |
676 : super(new _NotificationClientStubControl.unbound(impl)); | |
677 | |
678 static NotificationClientStub newFromEndpoint( | 709 static NotificationClientStub newFromEndpoint( |
679 core.MojoMessagePipeEndpoint endpoint) { | 710 core.MojoMessagePipeEndpoint endpoint) { |
680 assert(endpoint.setDescription("For NotificationClientStub")); | 711 assert(endpoint.setDescription("For NotificationClientStub")); |
681 return new NotificationClientStub.fromEndpoint(endpoint); | 712 return new NotificationClientStub.fromEndpoint(endpoint); |
682 } | 713 } |
683 | 714 |
684 static service_describer.ServiceDescription get serviceDescription => | |
685 _NotificationClientStubControl.serviceDescription; | |
686 | |
687 | 715 |
688 void onSelected() { | 716 void onSelected() { |
689 return impl.onSelected(); | 717 return impl.onSelected(); |
690 } | 718 } |
691 void onDismissed() { | 719 void onDismissed() { |
692 return impl.onDismissed(); | 720 return impl.onDismissed(); |
693 } | 721 } |
694 } | 722 } |
695 | 723 |
696 const int _notificationMethodUpdateName = 0; | 724 const int _notificationMethodUpdateName = 0; |
697 const int _notificationMethodCancelName = 1; | 725 const int _notificationMethodCancelName = 1; |
698 | 726 |
699 class _NotificationServiceDescription implements service_describer.ServiceDescri
ption { | 727 class _NotificationServiceDescription implements service_describer.ServiceDescri
ption { |
700 dynamic getTopLevelInterface([Function responseFactory]) => | 728 dynamic getTopLevelInterface([Function responseFactory]) => |
701 responseFactory(null); | 729 responseFactory(null); |
702 | 730 |
703 dynamic getTypeDefinition(String typeKey, [Function responseFactory]) => | 731 dynamic getTypeDefinition(String typeKey, [Function responseFactory]) => |
704 responseFactory(null); | 732 responseFactory(null); |
705 | 733 |
706 dynamic getAllTypeDefinitions([Function responseFactory]) => | 734 dynamic getAllTypeDefinitions([Function responseFactory]) => |
707 responseFactory(null); | 735 responseFactory(null); |
708 } | 736 } |
709 | 737 |
710 abstract class Notification { | 738 abstract class Notification { |
711 static const String serviceName = null; | 739 static const String serviceName = null; |
| 740 |
| 741 static service_describer.ServiceDescription _cachedServiceDescription; |
| 742 static service_describer.ServiceDescription get serviceDescription { |
| 743 if (_cachedServiceDescription == null) { |
| 744 _cachedServiceDescription = new _NotificationServiceDescription(); |
| 745 } |
| 746 return _cachedServiceDescription; |
| 747 } |
| 748 |
| 749 static NotificationProxy connectToService( |
| 750 bindings.ServiceConnector s, String url, [String serviceName]) { |
| 751 NotificationProxy p = new NotificationProxy.unbound(); |
| 752 String name = serviceName ?? Notification.serviceName; |
| 753 if ((name == null) || name.isEmpty) { |
| 754 throw new core.MojoApiError( |
| 755 "If an interface has no ServiceName, then one must be provided."); |
| 756 } |
| 757 s.connectToService(url, p, name); |
| 758 return p; |
| 759 } |
712 void update(NotificationData notificationData); | 760 void update(NotificationData notificationData); |
713 void cancel(); | 761 void cancel(); |
714 } | 762 } |
715 | 763 |
| 764 abstract class NotificationInterface |
| 765 implements bindings.MojoInterface<Notification>, |
| 766 Notification { |
| 767 factory NotificationInterface([Notification impl]) => |
| 768 new NotificationStub.unbound(impl); |
| 769 factory NotificationInterface.fromEndpoint( |
| 770 core.MojoMessagePipeEndpoint endpoint, |
| 771 [Notification impl]) => |
| 772 new NotificationStub.fromEndpoint(endpoint, impl); |
| 773 } |
| 774 |
| 775 abstract class NotificationInterfaceRequest |
| 776 implements bindings.MojoInterface<Notification>, |
| 777 Notification { |
| 778 factory NotificationInterfaceRequest() => |
| 779 new NotificationProxy.unbound(); |
| 780 } |
| 781 |
716 class _NotificationProxyControl | 782 class _NotificationProxyControl |
717 extends bindings.ProxyMessageHandler | 783 extends bindings.ProxyMessageHandler |
718 implements bindings.ProxyControl { | 784 implements bindings.ProxyControl<Notification> { |
719 _NotificationProxyControl.fromEndpoint( | 785 _NotificationProxyControl.fromEndpoint( |
720 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); | 786 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); |
721 | 787 |
722 _NotificationProxyControl.fromHandle( | 788 _NotificationProxyControl.fromHandle( |
723 core.MojoHandle handle) : super.fromHandle(handle); | 789 core.MojoHandle handle) : super.fromHandle(handle); |
724 | 790 |
725 _NotificationProxyControl.unbound() : super.unbound(); | 791 _NotificationProxyControl.unbound() : super.unbound(); |
726 | 792 |
727 service_describer.ServiceDescription get serviceDescription => | |
728 new _NotificationServiceDescription(); | |
729 | |
730 String get serviceName => Notification.serviceName; | 793 String get serviceName => Notification.serviceName; |
731 | 794 |
732 void handleResponse(bindings.ServiceMessage message) { | 795 void handleResponse(bindings.ServiceMessage message) { |
733 switch (message.header.type) { | 796 switch (message.header.type) { |
734 default: | 797 default: |
735 proxyError("Unexpected message type: ${message.header.type}"); | 798 proxyError("Unexpected message type: ${message.header.type}"); |
736 close(immediate: true); | 799 close(immediate: true); |
737 break; | 800 break; |
738 } | 801 } |
739 } | 802 } |
740 | 803 |
| 804 Notification get impl => null; |
| 805 set impl(Notification _) { |
| 806 throw new core.MojoApiError("The impl of a Proxy cannot be set."); |
| 807 } |
| 808 |
741 @override | 809 @override |
742 String toString() { | 810 String toString() { |
743 var superString = super.toString(); | 811 var superString = super.toString(); |
744 return "_NotificationProxyControl($superString)"; | 812 return "_NotificationProxyControl($superString)"; |
745 } | 813 } |
746 } | 814 } |
747 | 815 |
748 class NotificationProxy | 816 class NotificationProxy |
749 extends bindings.Proxy | 817 extends bindings.Proxy<Notification> |
750 implements Notification { | 818 implements Notification, |
| 819 NotificationInterface, |
| 820 NotificationInterfaceRequest { |
751 NotificationProxy.fromEndpoint( | 821 NotificationProxy.fromEndpoint( |
752 core.MojoMessagePipeEndpoint endpoint) | 822 core.MojoMessagePipeEndpoint endpoint) |
753 : super(new _NotificationProxyControl.fromEndpoint(endpoint)); | 823 : super(new _NotificationProxyControl.fromEndpoint(endpoint)); |
754 | 824 |
755 NotificationProxy.fromHandle(core.MojoHandle handle) | 825 NotificationProxy.fromHandle(core.MojoHandle handle) |
756 : super(new _NotificationProxyControl.fromHandle(handle)); | 826 : super(new _NotificationProxyControl.fromHandle(handle)); |
757 | 827 |
758 NotificationProxy.unbound() | 828 NotificationProxy.unbound() |
759 : super(new _NotificationProxyControl.unbound()); | 829 : super(new _NotificationProxyControl.unbound()); |
760 | 830 |
761 static NotificationProxy newFromEndpoint( | 831 static NotificationProxy newFromEndpoint( |
762 core.MojoMessagePipeEndpoint endpoint) { | 832 core.MojoMessagePipeEndpoint endpoint) { |
763 assert(endpoint.setDescription("For NotificationProxy")); | 833 assert(endpoint.setDescription("For NotificationProxy")); |
764 return new NotificationProxy.fromEndpoint(endpoint); | 834 return new NotificationProxy.fromEndpoint(endpoint); |
765 } | 835 } |
766 | 836 |
767 factory NotificationProxy.connectToService( | |
768 bindings.ServiceConnector s, String url, [String serviceName]) { | |
769 NotificationProxy p = new NotificationProxy.unbound(); | |
770 s.connectToService(url, p, serviceName); | |
771 return p; | |
772 } | |
773 | |
774 | 837 |
775 void update(NotificationData notificationData) { | 838 void update(NotificationData notificationData) { |
776 if (!ctrl.isBound) { | 839 if (!ctrl.isBound) { |
777 ctrl.proxyError("The Proxy is closed."); | 840 ctrl.proxyError("The Proxy is closed."); |
778 return; | 841 return; |
779 } | 842 } |
780 var params = new _NotificationUpdateParams(); | 843 var params = new _NotificationUpdateParams(); |
781 params.notificationData = notificationData; | 844 params.notificationData = notificationData; |
782 ctrl.sendMessage(params, | 845 ctrl.sendMessage(params, |
783 _notificationMethodUpdateName); | 846 _notificationMethodUpdateName); |
(...skipping 21 matching lines...) Expand all Loading... |
805 } | 868 } |
806 | 869 |
807 _NotificationStubControl.fromHandle( | 870 _NotificationStubControl.fromHandle( |
808 core.MojoHandle handle, [Notification impl]) | 871 core.MojoHandle handle, [Notification impl]) |
809 : super.fromHandle(handle, autoBegin: impl != null) { | 872 : super.fromHandle(handle, autoBegin: impl != null) { |
810 _impl = impl; | 873 _impl = impl; |
811 } | 874 } |
812 | 875 |
813 _NotificationStubControl.unbound([this._impl]) : super.unbound(); | 876 _NotificationStubControl.unbound([this._impl]) : super.unbound(); |
814 | 877 |
| 878 String get serviceName => Notification.serviceName; |
| 879 |
815 | 880 |
816 | 881 |
817 dynamic handleMessage(bindings.ServiceMessage message) { | 882 dynamic handleMessage(bindings.ServiceMessage message) { |
818 if (bindings.ControlMessageHandler.isControlMessage(message)) { | 883 if (bindings.ControlMessageHandler.isControlMessage(message)) { |
819 return bindings.ControlMessageHandler.handleMessage(this, | 884 return bindings.ControlMessageHandler.handleMessage(this, |
820 0, | 885 0, |
821 message); | 886 message); |
822 } | 887 } |
823 if (_impl == null) { | 888 if (_impl == null) { |
824 throw new core.MojoApiError("$this has no implementation set"); | 889 throw new core.MojoApiError("$this has no implementation set"); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
858 } | 923 } |
859 } | 924 } |
860 | 925 |
861 @override | 926 @override |
862 String toString() { | 927 String toString() { |
863 var superString = super.toString(); | 928 var superString = super.toString(); |
864 return "_NotificationStubControl($superString)"; | 929 return "_NotificationStubControl($superString)"; |
865 } | 930 } |
866 | 931 |
867 int get version => 0; | 932 int get version => 0; |
868 | |
869 static service_describer.ServiceDescription _cachedServiceDescription; | |
870 static service_describer.ServiceDescription get serviceDescription { | |
871 if (_cachedServiceDescription == null) { | |
872 _cachedServiceDescription = new _NotificationServiceDescription(); | |
873 } | |
874 return _cachedServiceDescription; | |
875 } | |
876 } | 933 } |
877 | 934 |
878 class NotificationStub | 935 class NotificationStub |
879 extends bindings.Stub<Notification> | 936 extends bindings.Stub<Notification> |
880 implements Notification { | 937 implements Notification, |
| 938 NotificationInterface, |
| 939 NotificationInterfaceRequest { |
| 940 NotificationStub.unbound([Notification impl]) |
| 941 : super(new _NotificationStubControl.unbound(impl)); |
| 942 |
881 NotificationStub.fromEndpoint( | 943 NotificationStub.fromEndpoint( |
882 core.MojoMessagePipeEndpoint endpoint, [Notification impl]) | 944 core.MojoMessagePipeEndpoint endpoint, [Notification impl]) |
883 : super(new _NotificationStubControl.fromEndpoint(endpoint, impl)); | 945 : super(new _NotificationStubControl.fromEndpoint(endpoint, impl)); |
884 | 946 |
885 NotificationStub.fromHandle( | 947 NotificationStub.fromHandle( |
886 core.MojoHandle handle, [Notification impl]) | 948 core.MojoHandle handle, [Notification impl]) |
887 : super(new _NotificationStubControl.fromHandle(handle, impl)); | 949 : super(new _NotificationStubControl.fromHandle(handle, impl)); |
888 | 950 |
889 NotificationStub.unbound([Notification impl]) | |
890 : super(new _NotificationStubControl.unbound(impl)); | |
891 | |
892 static NotificationStub newFromEndpoint( | 951 static NotificationStub newFromEndpoint( |
893 core.MojoMessagePipeEndpoint endpoint) { | 952 core.MojoMessagePipeEndpoint endpoint) { |
894 assert(endpoint.setDescription("For NotificationStub")); | 953 assert(endpoint.setDescription("For NotificationStub")); |
895 return new NotificationStub.fromEndpoint(endpoint); | 954 return new NotificationStub.fromEndpoint(endpoint); |
896 } | 955 } |
897 | 956 |
898 static service_describer.ServiceDescription get serviceDescription => | |
899 _NotificationStubControl.serviceDescription; | |
900 | |
901 | 957 |
902 void update(NotificationData notificationData) { | 958 void update(NotificationData notificationData) { |
903 return impl.update(notificationData); | 959 return impl.update(notificationData); |
904 } | 960 } |
905 void cancel() { | 961 void cancel() { |
906 return impl.cancel(); | 962 return impl.cancel(); |
907 } | 963 } |
908 } | 964 } |
909 | 965 |
910 const int _notificationServiceMethodPostName = 0; | 966 const int _notificationServiceMethodPostName = 0; |
911 | 967 |
912 class _NotificationServiceServiceDescription implements service_describer.Servic
eDescription { | 968 class _NotificationServiceServiceDescription implements service_describer.Servic
eDescription { |
913 dynamic getTopLevelInterface([Function responseFactory]) => | 969 dynamic getTopLevelInterface([Function responseFactory]) => |
914 responseFactory(null); | 970 responseFactory(null); |
915 | 971 |
916 dynamic getTypeDefinition(String typeKey, [Function responseFactory]) => | 972 dynamic getTypeDefinition(String typeKey, [Function responseFactory]) => |
917 responseFactory(null); | 973 responseFactory(null); |
918 | 974 |
919 dynamic getAllTypeDefinitions([Function responseFactory]) => | 975 dynamic getAllTypeDefinitions([Function responseFactory]) => |
920 responseFactory(null); | 976 responseFactory(null); |
921 } | 977 } |
922 | 978 |
923 abstract class NotificationService { | 979 abstract class NotificationService { |
924 static const String serviceName = "notifications::NotificationService"; | 980 static const String serviceName = "notifications::NotificationService"; |
925 void post(NotificationData notificationData, Object client, Object notificatio
n); | 981 |
| 982 static service_describer.ServiceDescription _cachedServiceDescription; |
| 983 static service_describer.ServiceDescription get serviceDescription { |
| 984 if (_cachedServiceDescription == null) { |
| 985 _cachedServiceDescription = new _NotificationServiceServiceDescription(); |
| 986 } |
| 987 return _cachedServiceDescription; |
| 988 } |
| 989 |
| 990 static NotificationServiceProxy connectToService( |
| 991 bindings.ServiceConnector s, String url, [String serviceName]) { |
| 992 NotificationServiceProxy p = new NotificationServiceProxy.unbound(); |
| 993 String name = serviceName ?? NotificationService.serviceName; |
| 994 if ((name == null) || name.isEmpty) { |
| 995 throw new core.MojoApiError( |
| 996 "If an interface has no ServiceName, then one must be provided."); |
| 997 } |
| 998 s.connectToService(url, p, name); |
| 999 return p; |
| 1000 } |
| 1001 void post(NotificationData notificationData, NotificationClientInterface clien
t, NotificationInterfaceRequest notification); |
| 1002 } |
| 1003 |
| 1004 abstract class NotificationServiceInterface |
| 1005 implements bindings.MojoInterface<NotificationService>, |
| 1006 NotificationService { |
| 1007 factory NotificationServiceInterface([NotificationService impl]) => |
| 1008 new NotificationServiceStub.unbound(impl); |
| 1009 factory NotificationServiceInterface.fromEndpoint( |
| 1010 core.MojoMessagePipeEndpoint endpoint, |
| 1011 [NotificationService impl]) => |
| 1012 new NotificationServiceStub.fromEndpoint(endpoint, impl); |
| 1013 } |
| 1014 |
| 1015 abstract class NotificationServiceInterfaceRequest |
| 1016 implements bindings.MojoInterface<NotificationService>, |
| 1017 NotificationService { |
| 1018 factory NotificationServiceInterfaceRequest() => |
| 1019 new NotificationServiceProxy.unbound(); |
926 } | 1020 } |
927 | 1021 |
928 class _NotificationServiceProxyControl | 1022 class _NotificationServiceProxyControl |
929 extends bindings.ProxyMessageHandler | 1023 extends bindings.ProxyMessageHandler |
930 implements bindings.ProxyControl { | 1024 implements bindings.ProxyControl<NotificationService> { |
931 _NotificationServiceProxyControl.fromEndpoint( | 1025 _NotificationServiceProxyControl.fromEndpoint( |
932 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); | 1026 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); |
933 | 1027 |
934 _NotificationServiceProxyControl.fromHandle( | 1028 _NotificationServiceProxyControl.fromHandle( |
935 core.MojoHandle handle) : super.fromHandle(handle); | 1029 core.MojoHandle handle) : super.fromHandle(handle); |
936 | 1030 |
937 _NotificationServiceProxyControl.unbound() : super.unbound(); | 1031 _NotificationServiceProxyControl.unbound() : super.unbound(); |
938 | 1032 |
939 service_describer.ServiceDescription get serviceDescription => | |
940 new _NotificationServiceServiceDescription(); | |
941 | |
942 String get serviceName => NotificationService.serviceName; | 1033 String get serviceName => NotificationService.serviceName; |
943 | 1034 |
944 void handleResponse(bindings.ServiceMessage message) { | 1035 void handleResponse(bindings.ServiceMessage message) { |
945 switch (message.header.type) { | 1036 switch (message.header.type) { |
946 default: | 1037 default: |
947 proxyError("Unexpected message type: ${message.header.type}"); | 1038 proxyError("Unexpected message type: ${message.header.type}"); |
948 close(immediate: true); | 1039 close(immediate: true); |
949 break; | 1040 break; |
950 } | 1041 } |
951 } | 1042 } |
952 | 1043 |
| 1044 NotificationService get impl => null; |
| 1045 set impl(NotificationService _) { |
| 1046 throw new core.MojoApiError("The impl of a Proxy cannot be set."); |
| 1047 } |
| 1048 |
953 @override | 1049 @override |
954 String toString() { | 1050 String toString() { |
955 var superString = super.toString(); | 1051 var superString = super.toString(); |
956 return "_NotificationServiceProxyControl($superString)"; | 1052 return "_NotificationServiceProxyControl($superString)"; |
957 } | 1053 } |
958 } | 1054 } |
959 | 1055 |
960 class NotificationServiceProxy | 1056 class NotificationServiceProxy |
961 extends bindings.Proxy | 1057 extends bindings.Proxy<NotificationService> |
962 implements NotificationService { | 1058 implements NotificationService, |
| 1059 NotificationServiceInterface, |
| 1060 NotificationServiceInterfaceRequest { |
963 NotificationServiceProxy.fromEndpoint( | 1061 NotificationServiceProxy.fromEndpoint( |
964 core.MojoMessagePipeEndpoint endpoint) | 1062 core.MojoMessagePipeEndpoint endpoint) |
965 : super(new _NotificationServiceProxyControl.fromEndpoint(endpoint)); | 1063 : super(new _NotificationServiceProxyControl.fromEndpoint(endpoint)); |
966 | 1064 |
967 NotificationServiceProxy.fromHandle(core.MojoHandle handle) | 1065 NotificationServiceProxy.fromHandle(core.MojoHandle handle) |
968 : super(new _NotificationServiceProxyControl.fromHandle(handle)); | 1066 : super(new _NotificationServiceProxyControl.fromHandle(handle)); |
969 | 1067 |
970 NotificationServiceProxy.unbound() | 1068 NotificationServiceProxy.unbound() |
971 : super(new _NotificationServiceProxyControl.unbound()); | 1069 : super(new _NotificationServiceProxyControl.unbound()); |
972 | 1070 |
973 static NotificationServiceProxy newFromEndpoint( | 1071 static NotificationServiceProxy newFromEndpoint( |
974 core.MojoMessagePipeEndpoint endpoint) { | 1072 core.MojoMessagePipeEndpoint endpoint) { |
975 assert(endpoint.setDescription("For NotificationServiceProxy")); | 1073 assert(endpoint.setDescription("For NotificationServiceProxy")); |
976 return new NotificationServiceProxy.fromEndpoint(endpoint); | 1074 return new NotificationServiceProxy.fromEndpoint(endpoint); |
977 } | 1075 } |
978 | 1076 |
979 factory NotificationServiceProxy.connectToService( | |
980 bindings.ServiceConnector s, String url, [String serviceName]) { | |
981 NotificationServiceProxy p = new NotificationServiceProxy.unbound(); | |
982 s.connectToService(url, p, serviceName); | |
983 return p; | |
984 } | |
985 | 1077 |
986 | 1078 void post(NotificationData notificationData, NotificationClientInterface clien
t, NotificationInterfaceRequest notification) { |
987 void post(NotificationData notificationData, Object client, Object notificatio
n) { | |
988 if (!ctrl.isBound) { | 1079 if (!ctrl.isBound) { |
989 ctrl.proxyError("The Proxy is closed."); | 1080 ctrl.proxyError("The Proxy is closed."); |
990 return; | 1081 return; |
991 } | 1082 } |
992 var params = new _NotificationServicePostParams(); | 1083 var params = new _NotificationServicePostParams(); |
993 params.notificationData = notificationData; | 1084 params.notificationData = notificationData; |
994 params.client = client; | 1085 params.client = client; |
995 params.notification = notification; | 1086 params.notification = notification; |
996 ctrl.sendMessage(params, | 1087 ctrl.sendMessage(params, |
997 _notificationServiceMethodPostName); | 1088 _notificationServiceMethodPostName); |
(...skipping 12 matching lines...) Expand all Loading... |
1010 } | 1101 } |
1011 | 1102 |
1012 _NotificationServiceStubControl.fromHandle( | 1103 _NotificationServiceStubControl.fromHandle( |
1013 core.MojoHandle handle, [NotificationService impl]) | 1104 core.MojoHandle handle, [NotificationService impl]) |
1014 : super.fromHandle(handle, autoBegin: impl != null) { | 1105 : super.fromHandle(handle, autoBegin: impl != null) { |
1015 _impl = impl; | 1106 _impl = impl; |
1016 } | 1107 } |
1017 | 1108 |
1018 _NotificationServiceStubControl.unbound([this._impl]) : super.unbound(); | 1109 _NotificationServiceStubControl.unbound([this._impl]) : super.unbound(); |
1019 | 1110 |
| 1111 String get serviceName => NotificationService.serviceName; |
| 1112 |
1020 | 1113 |
1021 | 1114 |
1022 dynamic handleMessage(bindings.ServiceMessage message) { | 1115 dynamic handleMessage(bindings.ServiceMessage message) { |
1023 if (bindings.ControlMessageHandler.isControlMessage(message)) { | 1116 if (bindings.ControlMessageHandler.isControlMessage(message)) { |
1024 return bindings.ControlMessageHandler.handleMessage(this, | 1117 return bindings.ControlMessageHandler.handleMessage(this, |
1025 0, | 1118 0, |
1026 message); | 1119 message); |
1027 } | 1120 } |
1028 if (_impl == null) { | 1121 if (_impl == null) { |
1029 throw new core.MojoApiError("$this has no implementation set"); | 1122 throw new core.MojoApiError("$this has no implementation set"); |
(...skipping 30 matching lines...) Expand all Loading... |
1060 } | 1153 } |
1061 } | 1154 } |
1062 | 1155 |
1063 @override | 1156 @override |
1064 String toString() { | 1157 String toString() { |
1065 var superString = super.toString(); | 1158 var superString = super.toString(); |
1066 return "_NotificationServiceStubControl($superString)"; | 1159 return "_NotificationServiceStubControl($superString)"; |
1067 } | 1160 } |
1068 | 1161 |
1069 int get version => 0; | 1162 int get version => 0; |
1070 | |
1071 static service_describer.ServiceDescription _cachedServiceDescription; | |
1072 static service_describer.ServiceDescription get serviceDescription { | |
1073 if (_cachedServiceDescription == null) { | |
1074 _cachedServiceDescription = new _NotificationServiceServiceDescription(); | |
1075 } | |
1076 return _cachedServiceDescription; | |
1077 } | |
1078 } | 1163 } |
1079 | 1164 |
1080 class NotificationServiceStub | 1165 class NotificationServiceStub |
1081 extends bindings.Stub<NotificationService> | 1166 extends bindings.Stub<NotificationService> |
1082 implements NotificationService { | 1167 implements NotificationService, |
| 1168 NotificationServiceInterface, |
| 1169 NotificationServiceInterfaceRequest { |
| 1170 NotificationServiceStub.unbound([NotificationService impl]) |
| 1171 : super(new _NotificationServiceStubControl.unbound(impl)); |
| 1172 |
1083 NotificationServiceStub.fromEndpoint( | 1173 NotificationServiceStub.fromEndpoint( |
1084 core.MojoMessagePipeEndpoint endpoint, [NotificationService impl]) | 1174 core.MojoMessagePipeEndpoint endpoint, [NotificationService impl]) |
1085 : super(new _NotificationServiceStubControl.fromEndpoint(endpoint, impl)); | 1175 : super(new _NotificationServiceStubControl.fromEndpoint(endpoint, impl)); |
1086 | 1176 |
1087 NotificationServiceStub.fromHandle( | 1177 NotificationServiceStub.fromHandle( |
1088 core.MojoHandle handle, [NotificationService impl]) | 1178 core.MojoHandle handle, [NotificationService impl]) |
1089 : super(new _NotificationServiceStubControl.fromHandle(handle, impl)); | 1179 : super(new _NotificationServiceStubControl.fromHandle(handle, impl)); |
1090 | 1180 |
1091 NotificationServiceStub.unbound([NotificationService impl]) | |
1092 : super(new _NotificationServiceStubControl.unbound(impl)); | |
1093 | |
1094 static NotificationServiceStub newFromEndpoint( | 1181 static NotificationServiceStub newFromEndpoint( |
1095 core.MojoMessagePipeEndpoint endpoint) { | 1182 core.MojoMessagePipeEndpoint endpoint) { |
1096 assert(endpoint.setDescription("For NotificationServiceStub")); | 1183 assert(endpoint.setDescription("For NotificationServiceStub")); |
1097 return new NotificationServiceStub.fromEndpoint(endpoint); | 1184 return new NotificationServiceStub.fromEndpoint(endpoint); |
1098 } | 1185 } |
1099 | 1186 |
1100 static service_describer.ServiceDescription get serviceDescription => | |
1101 _NotificationServiceStubControl.serviceDescription; | |
1102 | 1187 |
1103 | 1188 void post(NotificationData notificationData, NotificationClientInterface clien
t, NotificationInterfaceRequest notification) { |
1104 void post(NotificationData notificationData, Object client, Object notificatio
n) { | |
1105 return impl.post(notificationData, client, notification); | 1189 return impl.post(notificationData, client, notification); |
1106 } | 1190 } |
1107 } | 1191 } |
1108 | 1192 |
1109 | 1193 |
1110 | 1194 |
OLD | NEW |