| 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 http_server_mojom; | 5 library http_server_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_services/http_server/http_request.mojom.dart' as http_reque
st_mojom; | 10 import 'package:mojo_services/http_server/http_request.mojom.dart' as http_reque
st_mojom; |
| 11 import 'package:mojo_services/http_server/http_response.mojom.dart' as http_resp
onse_mojom; | 11 import 'package:mojo_services/http_server/http_response.mojom.dart' as http_resp
onse_mojom; |
| 12 | 12 |
| 13 | 13 |
| 14 | 14 |
| 15 class _HttpServerSetHandlerParams extends bindings.Struct { | 15 class _HttpServerSetHandlerParams extends bindings.Struct { |
| 16 static const List<bindings.StructDataHeader> kVersions = const [ | 16 static const List<bindings.StructDataHeader> kVersions = const [ |
| 17 const bindings.StructDataHeader(24, 0) | 17 const bindings.StructDataHeader(24, 0) |
| 18 ]; | 18 ]; |
| 19 String pattern = null; | 19 String pattern = null; |
| 20 Object handler = null; | 20 HttpHandlerInterface handler = null; |
| 21 | 21 |
| 22 _HttpServerSetHandlerParams() : super(kVersions.last.size); | 22 _HttpServerSetHandlerParams() : super(kVersions.last.size); |
| 23 | 23 |
| 24 static _HttpServerSetHandlerParams deserialize(bindings.Message message) { | 24 static _HttpServerSetHandlerParams deserialize(bindings.Message message) { |
| 25 var decoder = new bindings.Decoder(message); | 25 var decoder = new bindings.Decoder(message); |
| 26 var result = decode(decoder); | 26 var result = decode(decoder); |
| 27 if (decoder.excessHandles != null) { | 27 if (decoder.excessHandles != null) { |
| 28 decoder.excessHandles.forEach((h) => h.close()); | 28 decoder.excessHandles.forEach((h) => h.close()); |
| 29 } | 29 } |
| 30 return result; | 30 return result; |
| (...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 450 | 450 |
| 451 dynamic getTypeDefinition(String typeKey, [Function responseFactory]) => | 451 dynamic getTypeDefinition(String typeKey, [Function responseFactory]) => |
| 452 responseFactory(null); | 452 responseFactory(null); |
| 453 | 453 |
| 454 dynamic getAllTypeDefinitions([Function responseFactory]) => | 454 dynamic getAllTypeDefinitions([Function responseFactory]) => |
| 455 responseFactory(null); | 455 responseFactory(null); |
| 456 } | 456 } |
| 457 | 457 |
| 458 abstract class HttpServer { | 458 abstract class HttpServer { |
| 459 static const String serviceName = null; | 459 static const String serviceName = null; |
| 460 dynamic setHandler(String pattern,Object handler,[Function responseFactory = n
ull]); | 460 |
| 461 static service_describer.ServiceDescription _cachedServiceDescription; |
| 462 static service_describer.ServiceDescription get serviceDescription { |
| 463 if (_cachedServiceDescription == null) { |
| 464 _cachedServiceDescription = new _HttpServerServiceDescription(); |
| 465 } |
| 466 return _cachedServiceDescription; |
| 467 } |
| 468 |
| 469 static HttpServerProxy connectToService( |
| 470 bindings.ServiceConnector s, String url, [String serviceName]) { |
| 471 HttpServerProxy p = new HttpServerProxy.unbound(); |
| 472 String name = serviceName ?? HttpServer.serviceName; |
| 473 if ((name == null) || name.isEmpty) { |
| 474 throw new core.MojoApiError( |
| 475 "If an interface has no ServiceName, then one must be provided."); |
| 476 } |
| 477 s.connectToService(url, p, name); |
| 478 return p; |
| 479 } |
| 480 dynamic setHandler(String pattern,HttpHandlerInterface handler,[Function respo
nseFactory = null]); |
| 461 dynamic getPort([Function responseFactory = null]); | 481 dynamic getPort([Function responseFactory = null]); |
| 462 } | 482 } |
| 463 | 483 |
| 484 abstract class HttpServerInterface |
| 485 implements bindings.MojoInterface<HttpServer>, |
| 486 HttpServer { |
| 487 factory HttpServerInterface([HttpServer impl]) => |
| 488 new HttpServerStub.unbound(impl); |
| 489 factory HttpServerInterface.fromEndpoint( |
| 490 core.MojoMessagePipeEndpoint endpoint, |
| 491 [HttpServer impl]) => |
| 492 new HttpServerStub.fromEndpoint(endpoint, impl); |
| 493 } |
| 494 |
| 495 abstract class HttpServerInterfaceRequest |
| 496 implements bindings.MojoInterface<HttpServer>, |
| 497 HttpServer { |
| 498 factory HttpServerInterfaceRequest() => |
| 499 new HttpServerProxy.unbound(); |
| 500 } |
| 501 |
| 464 class _HttpServerProxyControl | 502 class _HttpServerProxyControl |
| 465 extends bindings.ProxyMessageHandler | 503 extends bindings.ProxyMessageHandler |
| 466 implements bindings.ProxyControl { | 504 implements bindings.ProxyControl<HttpServer> { |
| 467 _HttpServerProxyControl.fromEndpoint( | 505 _HttpServerProxyControl.fromEndpoint( |
| 468 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); | 506 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); |
| 469 | 507 |
| 470 _HttpServerProxyControl.fromHandle( | 508 _HttpServerProxyControl.fromHandle( |
| 471 core.MojoHandle handle) : super.fromHandle(handle); | 509 core.MojoHandle handle) : super.fromHandle(handle); |
| 472 | 510 |
| 473 _HttpServerProxyControl.unbound() : super.unbound(); | 511 _HttpServerProxyControl.unbound() : super.unbound(); |
| 474 | 512 |
| 475 service_describer.ServiceDescription get serviceDescription => | |
| 476 new _HttpServerServiceDescription(); | |
| 477 | |
| 478 String get serviceName => HttpServer.serviceName; | 513 String get serviceName => HttpServer.serviceName; |
| 479 | 514 |
| 480 void handleResponse(bindings.ServiceMessage message) { | 515 void handleResponse(bindings.ServiceMessage message) { |
| 481 switch (message.header.type) { | 516 switch (message.header.type) { |
| 482 case _httpServerMethodSetHandlerName: | 517 case _httpServerMethodSetHandlerName: |
| 483 var r = HttpServerSetHandlerResponseParams.deserialize( | 518 var r = HttpServerSetHandlerResponseParams.deserialize( |
| 484 message.payload); | 519 message.payload); |
| 485 if (!message.header.hasRequestId) { | 520 if (!message.header.hasRequestId) { |
| 486 proxyError("Expected a message with a valid request Id."); | 521 proxyError("Expected a message with a valid request Id."); |
| 487 return; | 522 return; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 519 } | 554 } |
| 520 c.complete(r); | 555 c.complete(r); |
| 521 break; | 556 break; |
| 522 default: | 557 default: |
| 523 proxyError("Unexpected message type: ${message.header.type}"); | 558 proxyError("Unexpected message type: ${message.header.type}"); |
| 524 close(immediate: true); | 559 close(immediate: true); |
| 525 break; | 560 break; |
| 526 } | 561 } |
| 527 } | 562 } |
| 528 | 563 |
| 564 HttpServer get impl => null; |
| 565 set impl(HttpServer _) { |
| 566 throw new core.MojoApiError("The impl of a Proxy cannot be set."); |
| 567 } |
| 568 |
| 529 @override | 569 @override |
| 530 String toString() { | 570 String toString() { |
| 531 var superString = super.toString(); | 571 var superString = super.toString(); |
| 532 return "_HttpServerProxyControl($superString)"; | 572 return "_HttpServerProxyControl($superString)"; |
| 533 } | 573 } |
| 534 } | 574 } |
| 535 | 575 |
| 536 class HttpServerProxy | 576 class HttpServerProxy |
| 537 extends bindings.Proxy | 577 extends bindings.Proxy<HttpServer> |
| 538 implements HttpServer { | 578 implements HttpServer, |
| 579 HttpServerInterface, |
| 580 HttpServerInterfaceRequest { |
| 539 HttpServerProxy.fromEndpoint( | 581 HttpServerProxy.fromEndpoint( |
| 540 core.MojoMessagePipeEndpoint endpoint) | 582 core.MojoMessagePipeEndpoint endpoint) |
| 541 : super(new _HttpServerProxyControl.fromEndpoint(endpoint)); | 583 : super(new _HttpServerProxyControl.fromEndpoint(endpoint)); |
| 542 | 584 |
| 543 HttpServerProxy.fromHandle(core.MojoHandle handle) | 585 HttpServerProxy.fromHandle(core.MojoHandle handle) |
| 544 : super(new _HttpServerProxyControl.fromHandle(handle)); | 586 : super(new _HttpServerProxyControl.fromHandle(handle)); |
| 545 | 587 |
| 546 HttpServerProxy.unbound() | 588 HttpServerProxy.unbound() |
| 547 : super(new _HttpServerProxyControl.unbound()); | 589 : super(new _HttpServerProxyControl.unbound()); |
| 548 | 590 |
| 549 static HttpServerProxy newFromEndpoint( | 591 static HttpServerProxy newFromEndpoint( |
| 550 core.MojoMessagePipeEndpoint endpoint) { | 592 core.MojoMessagePipeEndpoint endpoint) { |
| 551 assert(endpoint.setDescription("For HttpServerProxy")); | 593 assert(endpoint.setDescription("For HttpServerProxy")); |
| 552 return new HttpServerProxy.fromEndpoint(endpoint); | 594 return new HttpServerProxy.fromEndpoint(endpoint); |
| 553 } | 595 } |
| 554 | 596 |
| 555 factory HttpServerProxy.connectToService( | |
| 556 bindings.ServiceConnector s, String url, [String serviceName]) { | |
| 557 HttpServerProxy p = new HttpServerProxy.unbound(); | |
| 558 s.connectToService(url, p, serviceName); | |
| 559 return p; | |
| 560 } | |
| 561 | 597 |
| 562 | 598 dynamic setHandler(String pattern,HttpHandlerInterface handler,[Function respo
nseFactory = null]) { |
| 563 dynamic setHandler(String pattern,Object handler,[Function responseFactory = n
ull]) { | |
| 564 var params = new _HttpServerSetHandlerParams(); | 599 var params = new _HttpServerSetHandlerParams(); |
| 565 params.pattern = pattern; | 600 params.pattern = pattern; |
| 566 params.handler = handler; | 601 params.handler = handler; |
| 567 return ctrl.sendMessageWithRequestId( | 602 return ctrl.sendMessageWithRequestId( |
| 568 params, | 603 params, |
| 569 _httpServerMethodSetHandlerName, | 604 _httpServerMethodSetHandlerName, |
| 570 -1, | 605 -1, |
| 571 bindings.MessageHeader.kMessageExpectsResponse); | 606 bindings.MessageHeader.kMessageExpectsResponse); |
| 572 } | 607 } |
| 573 dynamic getPort([Function responseFactory = null]) { | 608 dynamic getPort([Function responseFactory = null]) { |
| (...skipping 18 matching lines...) Expand all Loading... |
| 592 } | 627 } |
| 593 | 628 |
| 594 _HttpServerStubControl.fromHandle( | 629 _HttpServerStubControl.fromHandle( |
| 595 core.MojoHandle handle, [HttpServer impl]) | 630 core.MojoHandle handle, [HttpServer impl]) |
| 596 : super.fromHandle(handle, autoBegin: impl != null) { | 631 : super.fromHandle(handle, autoBegin: impl != null) { |
| 597 _impl = impl; | 632 _impl = impl; |
| 598 } | 633 } |
| 599 | 634 |
| 600 _HttpServerStubControl.unbound([this._impl]) : super.unbound(); | 635 _HttpServerStubControl.unbound([this._impl]) : super.unbound(); |
| 601 | 636 |
| 637 String get serviceName => HttpServer.serviceName; |
| 638 |
| 602 | 639 |
| 603 HttpServerSetHandlerResponseParams _httpServerSetHandlerResponseParamsFactory(
bool success) { | 640 HttpServerSetHandlerResponseParams _httpServerSetHandlerResponseParamsFactory(
bool success) { |
| 604 var result = new HttpServerSetHandlerResponseParams(); | 641 var result = new HttpServerSetHandlerResponseParams(); |
| 605 result.success = success; | 642 result.success = success; |
| 606 return result; | 643 return result; |
| 607 } | 644 } |
| 608 HttpServerGetPortResponseParams _httpServerGetPortResponseParamsFactory(int po
rt) { | 645 HttpServerGetPortResponseParams _httpServerGetPortResponseParamsFactory(int po
rt) { |
| 609 var result = new HttpServerGetPortResponseParams(); | 646 var result = new HttpServerGetPortResponseParams(); |
| 610 result.port = port; | 647 result.port = port; |
| 611 return result; | 648 return result; |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 689 } | 726 } |
| 690 } | 727 } |
| 691 | 728 |
| 692 @override | 729 @override |
| 693 String toString() { | 730 String toString() { |
| 694 var superString = super.toString(); | 731 var superString = super.toString(); |
| 695 return "_HttpServerStubControl($superString)"; | 732 return "_HttpServerStubControl($superString)"; |
| 696 } | 733 } |
| 697 | 734 |
| 698 int get version => 0; | 735 int get version => 0; |
| 699 | |
| 700 static service_describer.ServiceDescription _cachedServiceDescription; | |
| 701 static service_describer.ServiceDescription get serviceDescription { | |
| 702 if (_cachedServiceDescription == null) { | |
| 703 _cachedServiceDescription = new _HttpServerServiceDescription(); | |
| 704 } | |
| 705 return _cachedServiceDescription; | |
| 706 } | |
| 707 } | 736 } |
| 708 | 737 |
| 709 class HttpServerStub | 738 class HttpServerStub |
| 710 extends bindings.Stub<HttpServer> | 739 extends bindings.Stub<HttpServer> |
| 711 implements HttpServer { | 740 implements HttpServer, |
| 741 HttpServerInterface, |
| 742 HttpServerInterfaceRequest { |
| 743 HttpServerStub.unbound([HttpServer impl]) |
| 744 : super(new _HttpServerStubControl.unbound(impl)); |
| 745 |
| 712 HttpServerStub.fromEndpoint( | 746 HttpServerStub.fromEndpoint( |
| 713 core.MojoMessagePipeEndpoint endpoint, [HttpServer impl]) | 747 core.MojoMessagePipeEndpoint endpoint, [HttpServer impl]) |
| 714 : super(new _HttpServerStubControl.fromEndpoint(endpoint, impl)); | 748 : super(new _HttpServerStubControl.fromEndpoint(endpoint, impl)); |
| 715 | 749 |
| 716 HttpServerStub.fromHandle( | 750 HttpServerStub.fromHandle( |
| 717 core.MojoHandle handle, [HttpServer impl]) | 751 core.MojoHandle handle, [HttpServer impl]) |
| 718 : super(new _HttpServerStubControl.fromHandle(handle, impl)); | 752 : super(new _HttpServerStubControl.fromHandle(handle, impl)); |
| 719 | 753 |
| 720 HttpServerStub.unbound([HttpServer impl]) | |
| 721 : super(new _HttpServerStubControl.unbound(impl)); | |
| 722 | |
| 723 static HttpServerStub newFromEndpoint( | 754 static HttpServerStub newFromEndpoint( |
| 724 core.MojoMessagePipeEndpoint endpoint) { | 755 core.MojoMessagePipeEndpoint endpoint) { |
| 725 assert(endpoint.setDescription("For HttpServerStub")); | 756 assert(endpoint.setDescription("For HttpServerStub")); |
| 726 return new HttpServerStub.fromEndpoint(endpoint); | 757 return new HttpServerStub.fromEndpoint(endpoint); |
| 727 } | 758 } |
| 728 | 759 |
| 729 static service_describer.ServiceDescription get serviceDescription => | |
| 730 _HttpServerStubControl.serviceDescription; | |
| 731 | 760 |
| 732 | 761 dynamic setHandler(String pattern,HttpHandlerInterface handler,[Function respo
nseFactory = null]) { |
| 733 dynamic setHandler(String pattern,Object handler,[Function responseFactory = n
ull]) { | |
| 734 return impl.setHandler(pattern,handler,responseFactory); | 762 return impl.setHandler(pattern,handler,responseFactory); |
| 735 } | 763 } |
| 736 dynamic getPort([Function responseFactory = null]) { | 764 dynamic getPort([Function responseFactory = null]) { |
| 737 return impl.getPort(responseFactory); | 765 return impl.getPort(responseFactory); |
| 738 } | 766 } |
| 739 } | 767 } |
| 740 | 768 |
| 741 const int _httpHandlerMethodHandleRequestName = 0; | 769 const int _httpHandlerMethodHandleRequestName = 0; |
| 742 | 770 |
| 743 class _HttpHandlerServiceDescription implements service_describer.ServiceDescrip
tion { | 771 class _HttpHandlerServiceDescription implements service_describer.ServiceDescrip
tion { |
| 744 dynamic getTopLevelInterface([Function responseFactory]) => | 772 dynamic getTopLevelInterface([Function responseFactory]) => |
| 745 responseFactory(null); | 773 responseFactory(null); |
| 746 | 774 |
| 747 dynamic getTypeDefinition(String typeKey, [Function responseFactory]) => | 775 dynamic getTypeDefinition(String typeKey, [Function responseFactory]) => |
| 748 responseFactory(null); | 776 responseFactory(null); |
| 749 | 777 |
| 750 dynamic getAllTypeDefinitions([Function responseFactory]) => | 778 dynamic getAllTypeDefinitions([Function responseFactory]) => |
| 751 responseFactory(null); | 779 responseFactory(null); |
| 752 } | 780 } |
| 753 | 781 |
| 754 abstract class HttpHandler { | 782 abstract class HttpHandler { |
| 755 static const String serviceName = null; | 783 static const String serviceName = null; |
| 784 |
| 785 static service_describer.ServiceDescription _cachedServiceDescription; |
| 786 static service_describer.ServiceDescription get serviceDescription { |
| 787 if (_cachedServiceDescription == null) { |
| 788 _cachedServiceDescription = new _HttpHandlerServiceDescription(); |
| 789 } |
| 790 return _cachedServiceDescription; |
| 791 } |
| 792 |
| 793 static HttpHandlerProxy connectToService( |
| 794 bindings.ServiceConnector s, String url, [String serviceName]) { |
| 795 HttpHandlerProxy p = new HttpHandlerProxy.unbound(); |
| 796 String name = serviceName ?? HttpHandler.serviceName; |
| 797 if ((name == null) || name.isEmpty) { |
| 798 throw new core.MojoApiError( |
| 799 "If an interface has no ServiceName, then one must be provided."); |
| 800 } |
| 801 s.connectToService(url, p, name); |
| 802 return p; |
| 803 } |
| 756 dynamic handleRequest(http_request_mojom.HttpRequest request,[Function respons
eFactory = null]); | 804 dynamic handleRequest(http_request_mojom.HttpRequest request,[Function respons
eFactory = null]); |
| 757 } | 805 } |
| 758 | 806 |
| 807 abstract class HttpHandlerInterface |
| 808 implements bindings.MojoInterface<HttpHandler>, |
| 809 HttpHandler { |
| 810 factory HttpHandlerInterface([HttpHandler impl]) => |
| 811 new HttpHandlerStub.unbound(impl); |
| 812 factory HttpHandlerInterface.fromEndpoint( |
| 813 core.MojoMessagePipeEndpoint endpoint, |
| 814 [HttpHandler impl]) => |
| 815 new HttpHandlerStub.fromEndpoint(endpoint, impl); |
| 816 } |
| 817 |
| 818 abstract class HttpHandlerInterfaceRequest |
| 819 implements bindings.MojoInterface<HttpHandler>, |
| 820 HttpHandler { |
| 821 factory HttpHandlerInterfaceRequest() => |
| 822 new HttpHandlerProxy.unbound(); |
| 823 } |
| 824 |
| 759 class _HttpHandlerProxyControl | 825 class _HttpHandlerProxyControl |
| 760 extends bindings.ProxyMessageHandler | 826 extends bindings.ProxyMessageHandler |
| 761 implements bindings.ProxyControl { | 827 implements bindings.ProxyControl<HttpHandler> { |
| 762 _HttpHandlerProxyControl.fromEndpoint( | 828 _HttpHandlerProxyControl.fromEndpoint( |
| 763 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); | 829 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); |
| 764 | 830 |
| 765 _HttpHandlerProxyControl.fromHandle( | 831 _HttpHandlerProxyControl.fromHandle( |
| 766 core.MojoHandle handle) : super.fromHandle(handle); | 832 core.MojoHandle handle) : super.fromHandle(handle); |
| 767 | 833 |
| 768 _HttpHandlerProxyControl.unbound() : super.unbound(); | 834 _HttpHandlerProxyControl.unbound() : super.unbound(); |
| 769 | 835 |
| 770 service_describer.ServiceDescription get serviceDescription => | |
| 771 new _HttpHandlerServiceDescription(); | |
| 772 | |
| 773 String get serviceName => HttpHandler.serviceName; | 836 String get serviceName => HttpHandler.serviceName; |
| 774 | 837 |
| 775 void handleResponse(bindings.ServiceMessage message) { | 838 void handleResponse(bindings.ServiceMessage message) { |
| 776 switch (message.header.type) { | 839 switch (message.header.type) { |
| 777 case _httpHandlerMethodHandleRequestName: | 840 case _httpHandlerMethodHandleRequestName: |
| 778 var r = HttpHandlerHandleRequestResponseParams.deserialize( | 841 var r = HttpHandlerHandleRequestResponseParams.deserialize( |
| 779 message.payload); | 842 message.payload); |
| 780 if (!message.header.hasRequestId) { | 843 if (!message.header.hasRequestId) { |
| 781 proxyError("Expected a message with a valid request Id."); | 844 proxyError("Expected a message with a valid request Id."); |
| 782 return; | 845 return; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 794 } | 857 } |
| 795 c.complete(r); | 858 c.complete(r); |
| 796 break; | 859 break; |
| 797 default: | 860 default: |
| 798 proxyError("Unexpected message type: ${message.header.type}"); | 861 proxyError("Unexpected message type: ${message.header.type}"); |
| 799 close(immediate: true); | 862 close(immediate: true); |
| 800 break; | 863 break; |
| 801 } | 864 } |
| 802 } | 865 } |
| 803 | 866 |
| 867 HttpHandler get impl => null; |
| 868 set impl(HttpHandler _) { |
| 869 throw new core.MojoApiError("The impl of a Proxy cannot be set."); |
| 870 } |
| 871 |
| 804 @override | 872 @override |
| 805 String toString() { | 873 String toString() { |
| 806 var superString = super.toString(); | 874 var superString = super.toString(); |
| 807 return "_HttpHandlerProxyControl($superString)"; | 875 return "_HttpHandlerProxyControl($superString)"; |
| 808 } | 876 } |
| 809 } | 877 } |
| 810 | 878 |
| 811 class HttpHandlerProxy | 879 class HttpHandlerProxy |
| 812 extends bindings.Proxy | 880 extends bindings.Proxy<HttpHandler> |
| 813 implements HttpHandler { | 881 implements HttpHandler, |
| 882 HttpHandlerInterface, |
| 883 HttpHandlerInterfaceRequest { |
| 814 HttpHandlerProxy.fromEndpoint( | 884 HttpHandlerProxy.fromEndpoint( |
| 815 core.MojoMessagePipeEndpoint endpoint) | 885 core.MojoMessagePipeEndpoint endpoint) |
| 816 : super(new _HttpHandlerProxyControl.fromEndpoint(endpoint)); | 886 : super(new _HttpHandlerProxyControl.fromEndpoint(endpoint)); |
| 817 | 887 |
| 818 HttpHandlerProxy.fromHandle(core.MojoHandle handle) | 888 HttpHandlerProxy.fromHandle(core.MojoHandle handle) |
| 819 : super(new _HttpHandlerProxyControl.fromHandle(handle)); | 889 : super(new _HttpHandlerProxyControl.fromHandle(handle)); |
| 820 | 890 |
| 821 HttpHandlerProxy.unbound() | 891 HttpHandlerProxy.unbound() |
| 822 : super(new _HttpHandlerProxyControl.unbound()); | 892 : super(new _HttpHandlerProxyControl.unbound()); |
| 823 | 893 |
| 824 static HttpHandlerProxy newFromEndpoint( | 894 static HttpHandlerProxy newFromEndpoint( |
| 825 core.MojoMessagePipeEndpoint endpoint) { | 895 core.MojoMessagePipeEndpoint endpoint) { |
| 826 assert(endpoint.setDescription("For HttpHandlerProxy")); | 896 assert(endpoint.setDescription("For HttpHandlerProxy")); |
| 827 return new HttpHandlerProxy.fromEndpoint(endpoint); | 897 return new HttpHandlerProxy.fromEndpoint(endpoint); |
| 828 } | 898 } |
| 829 | 899 |
| 830 factory HttpHandlerProxy.connectToService( | |
| 831 bindings.ServiceConnector s, String url, [String serviceName]) { | |
| 832 HttpHandlerProxy p = new HttpHandlerProxy.unbound(); | |
| 833 s.connectToService(url, p, serviceName); | |
| 834 return p; | |
| 835 } | |
| 836 | |
| 837 | 900 |
| 838 dynamic handleRequest(http_request_mojom.HttpRequest request,[Function respons
eFactory = null]) { | 901 dynamic handleRequest(http_request_mojom.HttpRequest request,[Function respons
eFactory = null]) { |
| 839 var params = new _HttpHandlerHandleRequestParams(); | 902 var params = new _HttpHandlerHandleRequestParams(); |
| 840 params.request = request; | 903 params.request = request; |
| 841 return ctrl.sendMessageWithRequestId( | 904 return ctrl.sendMessageWithRequestId( |
| 842 params, | 905 params, |
| 843 _httpHandlerMethodHandleRequestName, | 906 _httpHandlerMethodHandleRequestName, |
| 844 -1, | 907 -1, |
| 845 bindings.MessageHeader.kMessageExpectsResponse); | 908 bindings.MessageHeader.kMessageExpectsResponse); |
| 846 } | 909 } |
| (...skipping 11 matching lines...) Expand all Loading... |
| 858 } | 921 } |
| 859 | 922 |
| 860 _HttpHandlerStubControl.fromHandle( | 923 _HttpHandlerStubControl.fromHandle( |
| 861 core.MojoHandle handle, [HttpHandler impl]) | 924 core.MojoHandle handle, [HttpHandler impl]) |
| 862 : super.fromHandle(handle, autoBegin: impl != null) { | 925 : super.fromHandle(handle, autoBegin: impl != null) { |
| 863 _impl = impl; | 926 _impl = impl; |
| 864 } | 927 } |
| 865 | 928 |
| 866 _HttpHandlerStubControl.unbound([this._impl]) : super.unbound(); | 929 _HttpHandlerStubControl.unbound([this._impl]) : super.unbound(); |
| 867 | 930 |
| 931 String get serviceName => HttpHandler.serviceName; |
| 932 |
| 868 | 933 |
| 869 HttpHandlerHandleRequestResponseParams _httpHandlerHandleRequestResponseParams
Factory(http_response_mojom.HttpResponse response) { | 934 HttpHandlerHandleRequestResponseParams _httpHandlerHandleRequestResponseParams
Factory(http_response_mojom.HttpResponse response) { |
| 870 var result = new HttpHandlerHandleRequestResponseParams(); | 935 var result = new HttpHandlerHandleRequestResponseParams(); |
| 871 result.response = response; | 936 result.response = response; |
| 872 return result; | 937 return result; |
| 873 } | 938 } |
| 874 | 939 |
| 875 dynamic handleMessage(bindings.ServiceMessage message) { | 940 dynamic handleMessage(bindings.ServiceMessage message) { |
| 876 if (bindings.ControlMessageHandler.isControlMessage(message)) { | 941 if (bindings.ControlMessageHandler.isControlMessage(message)) { |
| 877 return bindings.ControlMessageHandler.handleMessage(this, | 942 return bindings.ControlMessageHandler.handleMessage(this, |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 930 } | 995 } |
| 931 } | 996 } |
| 932 | 997 |
| 933 @override | 998 @override |
| 934 String toString() { | 999 String toString() { |
| 935 var superString = super.toString(); | 1000 var superString = super.toString(); |
| 936 return "_HttpHandlerStubControl($superString)"; | 1001 return "_HttpHandlerStubControl($superString)"; |
| 937 } | 1002 } |
| 938 | 1003 |
| 939 int get version => 0; | 1004 int get version => 0; |
| 940 | |
| 941 static service_describer.ServiceDescription _cachedServiceDescription; | |
| 942 static service_describer.ServiceDescription get serviceDescription { | |
| 943 if (_cachedServiceDescription == null) { | |
| 944 _cachedServiceDescription = new _HttpHandlerServiceDescription(); | |
| 945 } | |
| 946 return _cachedServiceDescription; | |
| 947 } | |
| 948 } | 1005 } |
| 949 | 1006 |
| 950 class HttpHandlerStub | 1007 class HttpHandlerStub |
| 951 extends bindings.Stub<HttpHandler> | 1008 extends bindings.Stub<HttpHandler> |
| 952 implements HttpHandler { | 1009 implements HttpHandler, |
| 1010 HttpHandlerInterface, |
| 1011 HttpHandlerInterfaceRequest { |
| 1012 HttpHandlerStub.unbound([HttpHandler impl]) |
| 1013 : super(new _HttpHandlerStubControl.unbound(impl)); |
| 1014 |
| 953 HttpHandlerStub.fromEndpoint( | 1015 HttpHandlerStub.fromEndpoint( |
| 954 core.MojoMessagePipeEndpoint endpoint, [HttpHandler impl]) | 1016 core.MojoMessagePipeEndpoint endpoint, [HttpHandler impl]) |
| 955 : super(new _HttpHandlerStubControl.fromEndpoint(endpoint, impl)); | 1017 : super(new _HttpHandlerStubControl.fromEndpoint(endpoint, impl)); |
| 956 | 1018 |
| 957 HttpHandlerStub.fromHandle( | 1019 HttpHandlerStub.fromHandle( |
| 958 core.MojoHandle handle, [HttpHandler impl]) | 1020 core.MojoHandle handle, [HttpHandler impl]) |
| 959 : super(new _HttpHandlerStubControl.fromHandle(handle, impl)); | 1021 : super(new _HttpHandlerStubControl.fromHandle(handle, impl)); |
| 960 | 1022 |
| 961 HttpHandlerStub.unbound([HttpHandler impl]) | |
| 962 : super(new _HttpHandlerStubControl.unbound(impl)); | |
| 963 | |
| 964 static HttpHandlerStub newFromEndpoint( | 1023 static HttpHandlerStub newFromEndpoint( |
| 965 core.MojoMessagePipeEndpoint endpoint) { | 1024 core.MojoMessagePipeEndpoint endpoint) { |
| 966 assert(endpoint.setDescription("For HttpHandlerStub")); | 1025 assert(endpoint.setDescription("For HttpHandlerStub")); |
| 967 return new HttpHandlerStub.fromEndpoint(endpoint); | 1026 return new HttpHandlerStub.fromEndpoint(endpoint); |
| 968 } | 1027 } |
| 969 | 1028 |
| 970 static service_describer.ServiceDescription get serviceDescription => | |
| 971 _HttpHandlerStubControl.serviceDescription; | |
| 972 | |
| 973 | 1029 |
| 974 dynamic handleRequest(http_request_mojom.HttpRequest request,[Function respons
eFactory = null]) { | 1030 dynamic handleRequest(http_request_mojom.HttpRequest request,[Function respons
eFactory = null]) { |
| 975 return impl.handleRequest(request,responseFactory); | 1031 return impl.handleRequest(request,responseFactory); |
| 976 } | 1032 } |
| 977 } | 1033 } |
| 978 | 1034 |
| 979 | 1035 |
| 980 | 1036 |
| OLD | NEW |