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