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 url_loader_mojom; | 5 library url_loader_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 import 'package:mojo/mojo/network_error.mojom.dart' as network_error_mojom; | 10 import 'package:mojo/mojo/network_error.mojom.dart' as network_error_mojom; |
(...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
519 responseFactory(null); | 519 responseFactory(null); |
520 } | 520 } |
521 | 521 |
522 abstract class UrlLoader { | 522 abstract class UrlLoader { |
523 static const String serviceName = null; | 523 static const String serviceName = null; |
524 dynamic start(url_request_mojom.UrlRequest request,[Function responseFactory =
null]); | 524 dynamic start(url_request_mojom.UrlRequest request,[Function responseFactory =
null]); |
525 dynamic followRedirect([Function responseFactory = null]); | 525 dynamic followRedirect([Function responseFactory = null]); |
526 dynamic queryStatus([Function responseFactory = null]); | 526 dynamic queryStatus([Function responseFactory = null]); |
527 } | 527 } |
528 | 528 |
529 | 529 class _UrlLoaderProxyControl |
530 class _UrlLoaderProxyControl extends bindings.ProxyMessageHandler | 530 extends bindings.ProxyMessageHandler |
531 implements bindings.ProxyControl { | 531 implements bindings.ProxyControl { |
532 _UrlLoaderProxyControl.fromEndpoint( | 532 _UrlLoaderProxyControl.fromEndpoint( |
533 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); | 533 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); |
534 | 534 |
535 _UrlLoaderProxyControl.fromHandle( | 535 _UrlLoaderProxyControl.fromHandle( |
536 core.MojoHandle handle) : super.fromHandle(handle); | 536 core.MojoHandle handle) : super.fromHandle(handle); |
537 | 537 |
538 _UrlLoaderProxyControl.unbound() : super.unbound(); | 538 _UrlLoaderProxyControl.unbound() : super.unbound(); |
539 | 539 |
540 service_describer.ServiceDescription get serviceDescription => | 540 service_describer.ServiceDescription get serviceDescription => |
541 new _UrlLoaderServiceDescription(); | 541 new _UrlLoaderServiceDescription(); |
542 | 542 |
543 String get serviceName => UrlLoader.serviceName; | 543 String get serviceName => UrlLoader.serviceName; |
544 | 544 |
545 @override | |
546 void handleResponse(bindings.ServiceMessage message) { | 545 void handleResponse(bindings.ServiceMessage message) { |
547 switch (message.header.type) { | 546 switch (message.header.type) { |
548 case _urlLoaderMethodStartName: | 547 case _urlLoaderMethodStartName: |
549 var r = UrlLoaderStartResponseParams.deserialize( | 548 var r = UrlLoaderStartResponseParams.deserialize( |
550 message.payload); | 549 message.payload); |
551 if (!message.header.hasRequestId) { | 550 if (!message.header.hasRequestId) { |
552 proxyError("Expected a message with a valid request Id."); | 551 proxyError("Expected a message with a valid request Id."); |
553 return; | 552 return; |
554 } | 553 } |
555 Completer c = completerMap[message.header.requestId]; | 554 Completer c = completerMap[message.header.requestId]; |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
612 } | 611 } |
613 } | 612 } |
614 | 613 |
615 @override | 614 @override |
616 String toString() { | 615 String toString() { |
617 var superString = super.toString(); | 616 var superString = super.toString(); |
618 return "_UrlLoaderProxyControl($superString)"; | 617 return "_UrlLoaderProxyControl($superString)"; |
619 } | 618 } |
620 } | 619 } |
621 | 620 |
622 | 621 class UrlLoaderProxy |
623 class UrlLoaderProxy extends bindings.Proxy | 622 extends bindings.Proxy |
624 implements UrlLoader { | 623 implements UrlLoader { |
625 UrlLoaderProxy.fromEndpoint( | 624 UrlLoaderProxy.fromEndpoint( |
626 core.MojoMessagePipeEndpoint endpoint) | 625 core.MojoMessagePipeEndpoint endpoint) |
627 : super(new _UrlLoaderProxyControl.fromEndpoint(endpoint)); | 626 : super(new _UrlLoaderProxyControl.fromEndpoint(endpoint)); |
628 | 627 |
629 UrlLoaderProxy.fromHandle(core.MojoHandle handle) | 628 UrlLoaderProxy.fromHandle(core.MojoHandle handle) |
630 : super(new _UrlLoaderProxyControl.fromHandle(handle)); | 629 : super(new _UrlLoaderProxyControl.fromHandle(handle)); |
631 | 630 |
632 UrlLoaderProxy.unbound() | 631 UrlLoaderProxy.unbound() |
633 : super(new _UrlLoaderProxyControl.unbound()); | 632 : super(new _UrlLoaderProxyControl.unbound()); |
634 | 633 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
666 dynamic queryStatus([Function responseFactory = null]) { | 665 dynamic queryStatus([Function responseFactory = null]) { |
667 var params = new _UrlLoaderQueryStatusParams(); | 666 var params = new _UrlLoaderQueryStatusParams(); |
668 return ctrl.sendMessageWithRequestId( | 667 return ctrl.sendMessageWithRequestId( |
669 params, | 668 params, |
670 _urlLoaderMethodQueryStatusName, | 669 _urlLoaderMethodQueryStatusName, |
671 -1, | 670 -1, |
672 bindings.MessageHeader.kMessageExpectsResponse); | 671 bindings.MessageHeader.kMessageExpectsResponse); |
673 } | 672 } |
674 } | 673 } |
675 | 674 |
676 | 675 class _UrlLoaderStubControl |
677 class UrlLoaderStub extends bindings.Stub { | 676 extends bindings.StubMessageHandler |
| 677 implements bindings.StubControl<UrlLoader> { |
678 UrlLoader _impl; | 678 UrlLoader _impl; |
679 | 679 |
680 UrlLoaderStub.fromEndpoint( | 680 _UrlLoaderStubControl.fromEndpoint( |
681 core.MojoMessagePipeEndpoint endpoint, [UrlLoader impl]) | 681 core.MojoMessagePipeEndpoint endpoint, [UrlLoader impl]) |
682 : super.fromEndpoint(endpoint, autoBegin: impl != null) { | 682 : super.fromEndpoint(endpoint, autoBegin: impl != null) { |
683 _impl = impl; | 683 _impl = impl; |
684 } | 684 } |
685 | 685 |
686 UrlLoaderStub.fromHandle( | 686 _UrlLoaderStubControl.fromHandle( |
687 core.MojoHandle handle, [UrlLoader impl]) | 687 core.MojoHandle handle, [UrlLoader impl]) |
688 : super.fromHandle(handle, autoBegin: impl != null) { | 688 : super.fromHandle(handle, autoBegin: impl != null) { |
689 _impl = impl; | 689 _impl = impl; |
690 } | 690 } |
691 | 691 |
692 UrlLoaderStub.unbound([this._impl]) : super.unbound(); | 692 _UrlLoaderStubControl.unbound([this._impl]) : super.unbound(); |
693 | |
694 static UrlLoaderStub newFromEndpoint( | |
695 core.MojoMessagePipeEndpoint endpoint) { | |
696 assert(endpoint.setDescription("For UrlLoaderStub")); | |
697 return new UrlLoaderStub.fromEndpoint(endpoint); | |
698 } | |
699 | 693 |
700 | 694 |
701 UrlLoaderStartResponseParams _urlLoaderStartResponseParamsFactory(url_response
_mojom.UrlResponse response) { | 695 UrlLoaderStartResponseParams _urlLoaderStartResponseParamsFactory(url_response
_mojom.UrlResponse response) { |
702 var result = new UrlLoaderStartResponseParams(); | 696 var result = new UrlLoaderStartResponseParams(); |
703 result.response = response; | 697 result.response = response; |
704 return result; | 698 return result; |
705 } | 699 } |
706 UrlLoaderFollowRedirectResponseParams _urlLoaderFollowRedirectResponseParamsFa
ctory(url_response_mojom.UrlResponse response) { | 700 UrlLoaderFollowRedirectResponseParams _urlLoaderFollowRedirectResponseParamsFa
ctory(url_response_mojom.UrlResponse response) { |
707 var result = new UrlLoaderFollowRedirectResponseParams(); | 701 var result = new UrlLoaderFollowRedirectResponseParams(); |
708 result.response = response; | 702 result.response = response; |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
805 } | 799 } |
806 | 800 |
807 @override | 801 @override |
808 void bind(core.MojoMessagePipeEndpoint endpoint) { | 802 void bind(core.MojoMessagePipeEndpoint endpoint) { |
809 super.bind(endpoint); | 803 super.bind(endpoint); |
810 if (!isOpen && (_impl != null)) { | 804 if (!isOpen && (_impl != null)) { |
811 beginHandlingEvents(); | 805 beginHandlingEvents(); |
812 } | 806 } |
813 } | 807 } |
814 | 808 |
| 809 @override |
815 String toString() { | 810 String toString() { |
816 var superString = super.toString(); | 811 var superString = super.toString(); |
817 return "UrlLoaderStub($superString)"; | 812 return "_UrlLoaderStubControl($superString)"; |
818 } | 813 } |
819 | 814 |
820 int get version => 0; | 815 int get version => 0; |
821 | 816 |
822 static service_describer.ServiceDescription _cachedServiceDescription; | 817 static service_describer.ServiceDescription _cachedServiceDescription; |
823 static service_describer.ServiceDescription get serviceDescription { | 818 static service_describer.ServiceDescription get serviceDescription { |
824 if (_cachedServiceDescription == null) { | 819 if (_cachedServiceDescription == null) { |
825 _cachedServiceDescription = new _UrlLoaderServiceDescription(); | 820 _cachedServiceDescription = new _UrlLoaderServiceDescription(); |
826 } | 821 } |
827 return _cachedServiceDescription; | 822 return _cachedServiceDescription; |
828 } | 823 } |
829 } | 824 } |
830 | 825 |
| 826 class UrlLoaderStub |
| 827 extends bindings.Stub<UrlLoader> |
| 828 implements UrlLoader { |
| 829 UrlLoaderStub.fromEndpoint( |
| 830 core.MojoMessagePipeEndpoint endpoint, [UrlLoader impl]) |
| 831 : super(new _UrlLoaderStubControl.fromEndpoint(endpoint, impl)); |
| 832 |
| 833 UrlLoaderStub.fromHandle( |
| 834 core.MojoHandle handle, [UrlLoader impl]) |
| 835 : super(new _UrlLoaderStubControl.fromHandle(handle, impl)); |
| 836 |
| 837 UrlLoaderStub.unbound([UrlLoader impl]) |
| 838 : super(new _UrlLoaderStubControl.unbound(impl)); |
| 839 |
| 840 static UrlLoaderStub newFromEndpoint( |
| 841 core.MojoMessagePipeEndpoint endpoint) { |
| 842 assert(endpoint.setDescription("For UrlLoaderStub")); |
| 843 return new UrlLoaderStub.fromEndpoint(endpoint); |
| 844 } |
| 845 |
| 846 static service_describer.ServiceDescription get serviceDescription => |
| 847 _UrlLoaderStubControl.serviceDescription; |
| 848 |
| 849 |
| 850 dynamic start(url_request_mojom.UrlRequest request,[Function responseFactory =
null]) { |
| 851 return impl.start(request,responseFactory); |
| 852 } |
| 853 dynamic followRedirect([Function responseFactory = null]) { |
| 854 return impl.followRedirect(responseFactory); |
| 855 } |
| 856 dynamic queryStatus([Function responseFactory = null]) { |
| 857 return impl.queryStatus(responseFactory); |
| 858 } |
| 859 } |
| 860 |
831 | 861 |
832 | 862 |
OLD | NEW |