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 | 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/mojo/http_connection.mojom.dart' as http_connectio
n_mojom; | 13 import 'package:mojo_services/mojo/http_connection.mojom.dart' as http_connectio
n_mojom; |
12 | 14 |
13 | 15 |
14 | 16 |
15 class _HttpServerDelegateOnConnectedParams extends bindings.Struct { | 17 class _HttpServerDelegateOnConnectedParams extends bindings.Struct { |
16 static const List<bindings.StructDataHeader> kVersions = const [ | 18 static const List<bindings.StructDataHeader> kVersions = const [ |
17 const bindings.StructDataHeader(24, 0) | 19 const bindings.StructDataHeader(24, 0) |
18 ]; | 20 ]; |
19 Object connection = null; | 21 Object connection = null; |
20 Object delegate = null; | 22 Object delegate = null; |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 "connection: $connection" ", " | 80 "connection: $connection" ", " |
79 "delegate: $delegate" ")"; | 81 "delegate: $delegate" ")"; |
80 } | 82 } |
81 | 83 |
82 Map toJson() { | 84 Map toJson() { |
83 throw new bindings.MojoCodecError( | 85 throw new bindings.MojoCodecError( |
84 'Object containing handles cannot be encoded to JSON.'); | 86 'Object containing handles cannot be encoded to JSON.'); |
85 } | 87 } |
86 } | 88 } |
87 | 89 |
| 90 |
| 91 |
| 92 |
88 const int _HttpServerDelegate_onConnectedName = 0; | 93 const int _HttpServerDelegate_onConnectedName = 0; |
89 | 94 |
| 95 |
| 96 |
| 97 class _HttpServerDelegateServiceDescription implements service_describer.Service
Description { |
| 98 dynamic getTopLevelInterface([Function responseFactory]) => null; |
| 99 |
| 100 dynamic getTypeDefinition(String typeKey, [Function responseFactory]) => null; |
| 101 |
| 102 dynamic getAllTypeDefinitions([Function responseFactory]) => null; |
| 103 } |
| 104 |
90 abstract class HttpServerDelegate { | 105 abstract class HttpServerDelegate { |
91 static const String serviceName = null; | 106 static const String serviceName = null; |
92 void onConnected(Object connection, Object delegate); | 107 void onConnected(Object connection, Object delegate); |
93 } | 108 } |
94 | 109 |
95 | 110 |
96 class _HttpServerDelegateProxyImpl extends bindings.Proxy { | 111 class _HttpServerDelegateProxyImpl extends bindings.Proxy { |
97 _HttpServerDelegateProxyImpl.fromEndpoint( | 112 _HttpServerDelegateProxyImpl.fromEndpoint( |
98 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); | 113 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); |
99 | 114 |
100 _HttpServerDelegateProxyImpl.fromHandle(core.MojoHandle handle) : | 115 _HttpServerDelegateProxyImpl.fromHandle(core.MojoHandle handle) : |
101 super.fromHandle(handle); | 116 super.fromHandle(handle); |
102 | 117 |
103 _HttpServerDelegateProxyImpl.unbound() : super.unbound(); | 118 _HttpServerDelegateProxyImpl.unbound() : super.unbound(); |
104 | 119 |
105 static _HttpServerDelegateProxyImpl newFromEndpoint( | 120 static _HttpServerDelegateProxyImpl newFromEndpoint( |
106 core.MojoMessagePipeEndpoint endpoint) { | 121 core.MojoMessagePipeEndpoint endpoint) { |
107 assert(endpoint.setDescription("For _HttpServerDelegateProxyImpl")); | 122 assert(endpoint.setDescription("For _HttpServerDelegateProxyImpl")); |
108 return new _HttpServerDelegateProxyImpl.fromEndpoint(endpoint); | 123 return new _HttpServerDelegateProxyImpl.fromEndpoint(endpoint); |
109 } | 124 } |
110 | 125 |
| 126 service_describer.ServiceDescription get serviceDescription => |
| 127 new _HttpServerDelegateServiceDescription(); |
| 128 |
111 void handleResponse(bindings.ServiceMessage message) { | 129 void handleResponse(bindings.ServiceMessage message) { |
112 switch (message.header.type) { | 130 switch (message.header.type) { |
113 default: | 131 default: |
114 proxyError("Unexpected message type: ${message.header.type}"); | 132 proxyError("Unexpected message type: ${message.header.type}"); |
115 close(immediate: true); | 133 close(immediate: true); |
116 break; | 134 break; |
117 } | 135 } |
118 } | 136 } |
119 | 137 |
120 String toString() { | 138 String toString() { |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 assert(_impl == null); | 263 assert(_impl == null); |
246 _impl = d; | 264 _impl = d; |
247 } | 265 } |
248 | 266 |
249 String toString() { | 267 String toString() { |
250 var superString = super.toString(); | 268 var superString = super.toString(); |
251 return "HttpServerDelegateStub($superString)"; | 269 return "HttpServerDelegateStub($superString)"; |
252 } | 270 } |
253 | 271 |
254 int get version => 0; | 272 int get version => 0; |
| 273 |
| 274 service_describer.ServiceDescription get serviceDescription => |
| 275 new _HttpServerDelegateServiceDescription(); |
255 } | 276 } |
256 | 277 |
257 | 278 |
| 279 |
OLD | NEW |