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 device_info_mojom; | 5 library device_info_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 _DeviceInfoGetDeviceTypeParams extends bindings.Struct { | 16 class _DeviceInfoGetDeviceTypeParams extends bindings.Struct { |
15 static const List<bindings.StructDataHeader> kVersions = const [ | 17 static const List<bindings.StructDataHeader> kVersions = const [ |
16 const bindings.StructDataHeader(8, 0) | 18 const bindings.StructDataHeader(8, 0) |
17 ]; | 19 ]; |
18 | 20 |
19 _DeviceInfoGetDeviceTypeParams() : super(kVersions.last.size); | 21 _DeviceInfoGetDeviceTypeParams() : super(kVersions.last.size); |
20 | 22 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 return "_DeviceInfoGetDeviceTypeParams("")"; | 64 return "_DeviceInfoGetDeviceTypeParams("")"; |
63 } | 65 } |
64 | 66 |
65 Map toJson() { | 67 Map toJson() { |
66 Map map = new Map(); | 68 Map map = new Map(); |
67 return map; | 69 return map; |
68 } | 70 } |
69 } | 71 } |
70 | 72 |
71 | 73 |
| 74 |
| 75 |
72 class DeviceInfoGetDeviceTypeResponseParams extends bindings.Struct { | 76 class DeviceInfoGetDeviceTypeResponseParams extends bindings.Struct { |
73 static const List<bindings.StructDataHeader> kVersions = const [ | 77 static const List<bindings.StructDataHeader> kVersions = const [ |
74 const bindings.StructDataHeader(16, 0) | 78 const bindings.StructDataHeader(16, 0) |
75 ]; | 79 ]; |
76 DeviceInfoDeviceType deviceType = null; | 80 DeviceInfoDeviceType deviceType = null; |
77 | 81 |
78 DeviceInfoGetDeviceTypeResponseParams() : super(kVersions.last.size); | 82 DeviceInfoGetDeviceTypeResponseParams() : super(kVersions.last.size); |
79 | 83 |
80 static DeviceInfoGetDeviceTypeResponseParams deserialize(bindings.Message mess
age) { | 84 static DeviceInfoGetDeviceTypeResponseParams deserialize(bindings.Message mess
age) { |
81 var decoder = new bindings.Decoder(message); | 85 var decoder = new bindings.Decoder(message); |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 "deviceType: $deviceType" ")"; | 136 "deviceType: $deviceType" ")"; |
133 } | 137 } |
134 | 138 |
135 Map toJson() { | 139 Map toJson() { |
136 Map map = new Map(); | 140 Map map = new Map(); |
137 map["deviceType"] = deviceType; | 141 map["deviceType"] = deviceType; |
138 return map; | 142 return map; |
139 } | 143 } |
140 } | 144 } |
141 | 145 |
| 146 |
| 147 |
| 148 |
142 const int _DeviceInfo_getDeviceTypeName = 0; | 149 const int _DeviceInfo_getDeviceTypeName = 0; |
143 | 150 |
144 class DeviceInfoDeviceType extends bindings.MojoEnum { | 151 class DeviceInfoDeviceType extends bindings.MojoEnum { |
145 static const DeviceInfoDeviceType unknown = const DeviceInfoDeviceType._(0); | 152 static const DeviceInfoDeviceType unknown = const DeviceInfoDeviceType._(0); |
146 static const DeviceInfoDeviceType headless = const DeviceInfoDeviceType._(1); | 153 static const DeviceInfoDeviceType headless = const DeviceInfoDeviceType._(1); |
147 static const DeviceInfoDeviceType watch = const DeviceInfoDeviceType._(2); | 154 static const DeviceInfoDeviceType watch = const DeviceInfoDeviceType._(2); |
148 static const DeviceInfoDeviceType phone = const DeviceInfoDeviceType._(3); | 155 static const DeviceInfoDeviceType phone = const DeviceInfoDeviceType._(3); |
149 static const DeviceInfoDeviceType tablet = const DeviceInfoDeviceType._(4); | 156 static const DeviceInfoDeviceType tablet = const DeviceInfoDeviceType._(4); |
150 static const DeviceInfoDeviceType desktop = const DeviceInfoDeviceType._(5); | 157 static const DeviceInfoDeviceType desktop = const DeviceInfoDeviceType._(5); |
151 static const DeviceInfoDeviceType tv = const DeviceInfoDeviceType._(6); | 158 static const DeviceInfoDeviceType tv = const DeviceInfoDeviceType._(6); |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 case watch: | 220 case watch: |
214 return 'DeviceInfoDeviceType.watch'; | 221 return 'DeviceInfoDeviceType.watch'; |
215 case phone: | 222 case phone: |
216 return 'DeviceInfoDeviceType.phone'; | 223 return 'DeviceInfoDeviceType.phone'; |
217 case tablet: | 224 case tablet: |
218 return 'DeviceInfoDeviceType.tablet'; | 225 return 'DeviceInfoDeviceType.tablet'; |
219 case desktop: | 226 case desktop: |
220 return 'DeviceInfoDeviceType.desktop'; | 227 return 'DeviceInfoDeviceType.desktop'; |
221 case tv: | 228 case tv: |
222 return 'DeviceInfoDeviceType.tv'; | 229 return 'DeviceInfoDeviceType.tv'; |
| 230 default: |
| 231 return null; |
223 } | 232 } |
224 } | 233 } |
225 | 234 |
226 int toJson() => mojoEnumValue; | 235 int toJson() => mojoEnumValue; |
227 } | 236 } |
228 | 237 |
| 238 |
| 239 |
| 240 |
| 241 |
| 242 class _DeviceInfoServiceDescription implements service_describer.ServiceDescript
ion { |
| 243 dynamic getTopLevelInterface([Function responseFactory]) => null; |
| 244 |
| 245 dynamic getTypeDefinition(String typeKey, [Function responseFactory]) => null; |
| 246 |
| 247 dynamic getAllTypeDefinitions([Function responseFactory]) => null; |
| 248 } |
| 249 |
229 abstract class DeviceInfo { | 250 abstract class DeviceInfo { |
230 static const String serviceName = "mojo::DeviceInfo"; | 251 static const String serviceName = "mojo::DeviceInfo"; |
231 dynamic getDeviceType([Function responseFactory = null]); | 252 dynamic getDeviceType([Function responseFactory = null]); |
232 } | 253 } |
233 | 254 |
234 | 255 |
235 class _DeviceInfoProxyImpl extends bindings.Proxy { | 256 class _DeviceInfoProxyImpl extends bindings.Proxy { |
236 _DeviceInfoProxyImpl.fromEndpoint( | 257 _DeviceInfoProxyImpl.fromEndpoint( |
237 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); | 258 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); |
238 | 259 |
239 _DeviceInfoProxyImpl.fromHandle(core.MojoHandle handle) : | 260 _DeviceInfoProxyImpl.fromHandle(core.MojoHandle handle) : |
240 super.fromHandle(handle); | 261 super.fromHandle(handle); |
241 | 262 |
242 _DeviceInfoProxyImpl.unbound() : super.unbound(); | 263 _DeviceInfoProxyImpl.unbound() : super.unbound(); |
243 | 264 |
244 static _DeviceInfoProxyImpl newFromEndpoint( | 265 static _DeviceInfoProxyImpl newFromEndpoint( |
245 core.MojoMessagePipeEndpoint endpoint) { | 266 core.MojoMessagePipeEndpoint endpoint) { |
246 assert(endpoint.setDescription("For _DeviceInfoProxyImpl")); | 267 assert(endpoint.setDescription("For _DeviceInfoProxyImpl")); |
247 return new _DeviceInfoProxyImpl.fromEndpoint(endpoint); | 268 return new _DeviceInfoProxyImpl.fromEndpoint(endpoint); |
248 } | 269 } |
249 | 270 |
| 271 service_describer.ServiceDescription get serviceDescription => |
| 272 new _DeviceInfoServiceDescription(); |
| 273 |
250 void handleResponse(bindings.ServiceMessage message) { | 274 void handleResponse(bindings.ServiceMessage message) { |
251 switch (message.header.type) { | 275 switch (message.header.type) { |
252 case _DeviceInfo_getDeviceTypeName: | 276 case _DeviceInfo_getDeviceTypeName: |
253 var r = DeviceInfoGetDeviceTypeResponseParams.deserialize( | 277 var r = DeviceInfoGetDeviceTypeResponseParams.deserialize( |
254 message.payload); | 278 message.payload); |
255 if (!message.header.hasRequestId) { | 279 if (!message.header.hasRequestId) { |
256 proxyError("Expected a message with a valid request Id."); | 280 proxyError("Expected a message with a valid request Id."); |
257 return; | 281 return; |
258 } | 282 } |
259 Completer c = completerMap[message.header.requestId]; | 283 Completer c = completerMap[message.header.requestId]; |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
424 assert(_impl == null); | 448 assert(_impl == null); |
425 _impl = d; | 449 _impl = d; |
426 } | 450 } |
427 | 451 |
428 String toString() { | 452 String toString() { |
429 var superString = super.toString(); | 453 var superString = super.toString(); |
430 return "DeviceInfoStub($superString)"; | 454 return "DeviceInfoStub($superString)"; |
431 } | 455 } |
432 | 456 |
433 int get version => 0; | 457 int get version => 0; |
| 458 |
| 459 service_describer.ServiceDescription get serviceDescription => |
| 460 new _DeviceInfoServiceDescription(); |
434 } | 461 } |
435 | 462 |
436 | 463 |
| 464 |
OLD | NEW |