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 service_registry_mojom; | 5 library service_registry_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/mojo/service_provider.mojom.dart' as service_provider_mojom
; | 13 import 'package:mojo/mojo/service_provider.mojom.dart' as service_provider_mojom
; |
12 | 14 |
13 | 15 |
14 | 16 |
15 class _ServiceRegistryAddServicesParams extends bindings.Struct { | 17 class _ServiceRegistryAddServicesParams 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 List<String> interfaceNames = null; | 21 List<String> interfaceNames = null; |
20 Object serviceProvider = null; | 22 Object serviceProvider = null; |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 "interfaceNames: $interfaceNames" ", " | 96 "interfaceNames: $interfaceNames" ", " |
95 "serviceProvider: $serviceProvider" ")"; | 97 "serviceProvider: $serviceProvider" ")"; |
96 } | 98 } |
97 | 99 |
98 Map toJson() { | 100 Map toJson() { |
99 throw new bindings.MojoCodecError( | 101 throw new bindings.MojoCodecError( |
100 'Object containing handles cannot be encoded to JSON.'); | 102 'Object containing handles cannot be encoded to JSON.'); |
101 } | 103 } |
102 } | 104 } |
103 | 105 |
| 106 |
| 107 |
| 108 |
104 const int _ServiceRegistry_addServicesName = 0; | 109 const int _ServiceRegistry_addServicesName = 0; |
105 | 110 |
| 111 |
| 112 |
| 113 class _ServiceRegistryServiceDescription implements service_describer.ServiceDes
cription { |
| 114 dynamic getTopLevelInterface([Function responseFactory]) => null; |
| 115 |
| 116 dynamic getTypeDefinition(String typeKey, [Function responseFactory]) => null; |
| 117 |
| 118 dynamic getAllTypeDefinitions([Function responseFactory]) => null; |
| 119 } |
| 120 |
106 abstract class ServiceRegistry { | 121 abstract class ServiceRegistry { |
107 static const String serviceName = "mojo::ServiceRegistry"; | 122 static const String serviceName = "mojo::ServiceRegistry"; |
108 void addServices(List<String> interfaceNames, Object serviceProvider); | 123 void addServices(List<String> interfaceNames, Object serviceProvider); |
109 } | 124 } |
110 | 125 |
111 | 126 |
112 class _ServiceRegistryProxyImpl extends bindings.Proxy { | 127 class _ServiceRegistryProxyImpl extends bindings.Proxy { |
113 _ServiceRegistryProxyImpl.fromEndpoint( | 128 _ServiceRegistryProxyImpl.fromEndpoint( |
114 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); | 129 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); |
115 | 130 |
116 _ServiceRegistryProxyImpl.fromHandle(core.MojoHandle handle) : | 131 _ServiceRegistryProxyImpl.fromHandle(core.MojoHandle handle) : |
117 super.fromHandle(handle); | 132 super.fromHandle(handle); |
118 | 133 |
119 _ServiceRegistryProxyImpl.unbound() : super.unbound(); | 134 _ServiceRegistryProxyImpl.unbound() : super.unbound(); |
120 | 135 |
121 static _ServiceRegistryProxyImpl newFromEndpoint( | 136 static _ServiceRegistryProxyImpl newFromEndpoint( |
122 core.MojoMessagePipeEndpoint endpoint) { | 137 core.MojoMessagePipeEndpoint endpoint) { |
123 assert(endpoint.setDescription("For _ServiceRegistryProxyImpl")); | 138 assert(endpoint.setDescription("For _ServiceRegistryProxyImpl")); |
124 return new _ServiceRegistryProxyImpl.fromEndpoint(endpoint); | 139 return new _ServiceRegistryProxyImpl.fromEndpoint(endpoint); |
125 } | 140 } |
126 | 141 |
| 142 service_describer.ServiceDescription get serviceDescription => |
| 143 new _ServiceRegistryServiceDescription(); |
| 144 |
127 void handleResponse(bindings.ServiceMessage message) { | 145 void handleResponse(bindings.ServiceMessage message) { |
128 switch (message.header.type) { | 146 switch (message.header.type) { |
129 default: | 147 default: |
130 proxyError("Unexpected message type: ${message.header.type}"); | 148 proxyError("Unexpected message type: ${message.header.type}"); |
131 close(immediate: true); | 149 close(immediate: true); |
132 break; | 150 break; |
133 } | 151 } |
134 } | 152 } |
135 | 153 |
136 String toString() { | 154 String toString() { |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 assert(_impl == null); | 279 assert(_impl == null); |
262 _impl = d; | 280 _impl = d; |
263 } | 281 } |
264 | 282 |
265 String toString() { | 283 String toString() { |
266 var superString = super.toString(); | 284 var superString = super.toString(); |
267 return "ServiceRegistryStub($superString)"; | 285 return "ServiceRegistryStub($superString)"; |
268 } | 286 } |
269 | 287 |
270 int get version => 0; | 288 int get version => 0; |
| 289 |
| 290 service_describer.ServiceDescription get serviceDescription => |
| 291 new _ServiceRegistryServiceDescription(); |
271 } | 292 } |
272 | 293 |
273 | 294 |
| 295 |
OLD | NEW |