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_factory_mojom; | 5 library http_server_factory_mojom; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 | 8 |
9 import 'package:mojo/bindings.dart' as bindings; | 9 import 'package:mojo/bindings.dart' as bindings; |
10 import 'package:mojo/core.dart' as core; | 10 import 'package:mojo/core.dart' as core; |
| 11 import 'package:mojo/mojo/bindings/types/mojom_types.mojom.dart' as mojom_types; |
| 12 import 'package:mojo/mojo/bindings/types/service_describer.mojom.dart' as servic
e_describer; |
11 import 'package:mojo_services/http_server/http_server.mojom.dart' as http_server
_mojom; | 13 import 'package:mojo_services/http_server/http_server.mojom.dart' as http_server
_mojom; |
12 import 'package:mojo_services/mojo/net_address.mojom.dart' as net_address_mojom; | 14 import 'package:mojo_services/mojo/net_address.mojom.dart' as net_address_mojom; |
13 | 15 |
14 | 16 |
15 | 17 |
16 class _HttpServerFactoryCreateHttpServerParams extends bindings.Struct { | 18 class _HttpServerFactoryCreateHttpServerParams extends bindings.Struct { |
17 static const List<bindings.StructDataHeader> kVersions = const [ | 19 static const List<bindings.StructDataHeader> kVersions = const [ |
18 const bindings.StructDataHeader(24, 0) | 20 const bindings.StructDataHeader(24, 0) |
19 ]; | 21 ]; |
20 Object serverRequest = null; | 22 Object serverRequest = null; |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 "serverRequest: $serverRequest" ", " | 82 "serverRequest: $serverRequest" ", " |
81 "localAddress: $localAddress" ")"; | 83 "localAddress: $localAddress" ")"; |
82 } | 84 } |
83 | 85 |
84 Map toJson() { | 86 Map toJson() { |
85 throw new bindings.MojoCodecError( | 87 throw new bindings.MojoCodecError( |
86 'Object containing handles cannot be encoded to JSON.'); | 88 'Object containing handles cannot be encoded to JSON.'); |
87 } | 89 } |
88 } | 90 } |
89 | 91 |
| 92 |
| 93 |
| 94 |
90 const int _HttpServerFactory_createHttpServerName = 0; | 95 const int _HttpServerFactory_createHttpServerName = 0; |
91 | 96 |
| 97 |
| 98 |
| 99 class _HttpServerFactoryServiceDescription implements service_describer.ServiceD
escription { |
| 100 dynamic getTopLevelInterface([Function responseFactory]) => null; |
| 101 |
| 102 dynamic getTypeDefinition(String typeKey, [Function responseFactory]) => null; |
| 103 |
| 104 dynamic getAllTypeDefinitions([Function responseFactory]) => null; |
| 105 } |
| 106 |
92 abstract class HttpServerFactory { | 107 abstract class HttpServerFactory { |
93 static const String serviceName = "http_server::HttpServerFactory"; | 108 static const String serviceName = "http_server::HttpServerFactory"; |
94 void createHttpServer(Object serverRequest, net_address_mojom.NetAddress local
Address); | 109 void createHttpServer(Object serverRequest, net_address_mojom.NetAddress local
Address); |
95 } | 110 } |
96 | 111 |
97 | 112 |
98 class _HttpServerFactoryProxyImpl extends bindings.Proxy { | 113 class _HttpServerFactoryProxyImpl extends bindings.Proxy { |
99 _HttpServerFactoryProxyImpl.fromEndpoint( | 114 _HttpServerFactoryProxyImpl.fromEndpoint( |
100 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); | 115 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); |
101 | 116 |
102 _HttpServerFactoryProxyImpl.fromHandle(core.MojoHandle handle) : | 117 _HttpServerFactoryProxyImpl.fromHandle(core.MojoHandle handle) : |
103 super.fromHandle(handle); | 118 super.fromHandle(handle); |
104 | 119 |
105 _HttpServerFactoryProxyImpl.unbound() : super.unbound(); | 120 _HttpServerFactoryProxyImpl.unbound() : super.unbound(); |
106 | 121 |
107 static _HttpServerFactoryProxyImpl newFromEndpoint( | 122 static _HttpServerFactoryProxyImpl newFromEndpoint( |
108 core.MojoMessagePipeEndpoint endpoint) { | 123 core.MojoMessagePipeEndpoint endpoint) { |
109 assert(endpoint.setDescription("For _HttpServerFactoryProxyImpl")); | 124 assert(endpoint.setDescription("For _HttpServerFactoryProxyImpl")); |
110 return new _HttpServerFactoryProxyImpl.fromEndpoint(endpoint); | 125 return new _HttpServerFactoryProxyImpl.fromEndpoint(endpoint); |
111 } | 126 } |
112 | 127 |
| 128 service_describer.ServiceDescription get serviceDescription => |
| 129 new _HttpServerFactoryServiceDescription(); |
| 130 |
113 void handleResponse(bindings.ServiceMessage message) { | 131 void handleResponse(bindings.ServiceMessage message) { |
114 switch (message.header.type) { | 132 switch (message.header.type) { |
115 default: | 133 default: |
116 proxyError("Unexpected message type: ${message.header.type}"); | 134 proxyError("Unexpected message type: ${message.header.type}"); |
117 close(immediate: true); | 135 close(immediate: true); |
118 break; | 136 break; |
119 } | 137 } |
120 } | 138 } |
121 | 139 |
122 String toString() { | 140 String toString() { |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 assert(_impl == null); | 265 assert(_impl == null); |
248 _impl = d; | 266 _impl = d; |
249 } | 267 } |
250 | 268 |
251 String toString() { | 269 String toString() { |
252 var superString = super.toString(); | 270 var superString = super.toString(); |
253 return "HttpServerFactoryStub($superString)"; | 271 return "HttpServerFactoryStub($superString)"; |
254 } | 272 } |
255 | 273 |
256 int get version => 0; | 274 int get version => 0; |
| 275 |
| 276 service_describer.ServiceDescription get serviceDescription => |
| 277 new _HttpServerFactoryServiceDescription(); |
257 } | 278 } |
258 | 279 |
259 | 280 |
| 281 |
OLD | NEW |