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 hit_tests_mojom; | 5 library hit_tests_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/geometry.mojom.dart' as geometry_mojom; | 13 import 'package:mojo_services/mojo/geometry.mojom.dart' as geometry_mojom; |
12 import 'package:mojo_services/mojo/gfx/composition/scene_token.mojom.dart' as sc
ene_token_mojom; | 14 import 'package:mojo_services/mojo/gfx/composition/scene_token.mojom.dart' as sc
ene_token_mojom; |
13 const int kHitIdNone = 0; | 15 const int kHitIdNone = 0; |
14 | 16 |
15 | 17 |
16 | 18 |
17 class Hit extends bindings.Struct { | 19 class Hit extends bindings.Struct { |
18 static const List<bindings.StructDataHeader> kVersions = const [ | 20 static const List<bindings.StructDataHeader> kVersions = const [ |
19 const bindings.StructDataHeader(40, 0) | 21 const bindings.StructDataHeader(40, 0) |
20 ]; | 22 ]; |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 map["sceneToken"] = sceneToken; | 114 map["sceneToken"] = sceneToken; |
113 map["sceneVersion"] = sceneVersion; | 115 map["sceneVersion"] = sceneVersion; |
114 map["nodeId"] = nodeId; | 116 map["nodeId"] = nodeId; |
115 map["hitId"] = hitId; | 117 map["hitId"] = hitId; |
116 map["intersection"] = intersection; | 118 map["intersection"] = intersection; |
117 return map; | 119 return map; |
118 } | 120 } |
119 } | 121 } |
120 | 122 |
121 | 123 |
| 124 |
| 125 |
122 class HitTestResult extends bindings.Struct { | 126 class HitTestResult extends bindings.Struct { |
123 static const List<bindings.StructDataHeader> kVersions = const [ | 127 static const List<bindings.StructDataHeader> kVersions = const [ |
124 const bindings.StructDataHeader(16, 0) | 128 const bindings.StructDataHeader(16, 0) |
125 ]; | 129 ]; |
126 List<Hit> hits = null; | 130 List<Hit> hits = null; |
127 | 131 |
128 HitTestResult() : super(kVersions.last.size); | 132 HitTestResult() : super(kVersions.last.size); |
129 | 133 |
130 static HitTestResult deserialize(bindings.Message message) { | 134 static HitTestResult deserialize(bindings.Message message) { |
131 var decoder = new bindings.Decoder(message); | 135 var decoder = new bindings.Decoder(message); |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 } | 200 } |
197 | 201 |
198 Map toJson() { | 202 Map toJson() { |
199 Map map = new Map(); | 203 Map map = new Map(); |
200 map["hits"] = hits; | 204 map["hits"] = hits; |
201 return map; | 205 return map; |
202 } | 206 } |
203 } | 207 } |
204 | 208 |
205 | 209 |
| 210 |
| 211 |
206 class _HitTesterHitTestParams extends bindings.Struct { | 212 class _HitTesterHitTestParams extends bindings.Struct { |
207 static const List<bindings.StructDataHeader> kVersions = const [ | 213 static const List<bindings.StructDataHeader> kVersions = const [ |
208 const bindings.StructDataHeader(16, 0) | 214 const bindings.StructDataHeader(16, 0) |
209 ]; | 215 ]; |
210 geometry_mojom.Point point = null; | 216 geometry_mojom.Point point = null; |
211 | 217 |
212 _HitTesterHitTestParams() : super(kVersions.last.size); | 218 _HitTesterHitTestParams() : super(kVersions.last.size); |
213 | 219 |
214 static _HitTesterHitTestParams deserialize(bindings.Message message) { | 220 static _HitTesterHitTestParams deserialize(bindings.Message message) { |
215 var decoder = new bindings.Decoder(message); | 221 var decoder = new bindings.Decoder(message); |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 } | 270 } |
265 | 271 |
266 Map toJson() { | 272 Map toJson() { |
267 Map map = new Map(); | 273 Map map = new Map(); |
268 map["point"] = point; | 274 map["point"] = point; |
269 return map; | 275 return map; |
270 } | 276 } |
271 } | 277 } |
272 | 278 |
273 | 279 |
| 280 |
| 281 |
274 class HitTesterHitTestResponseParams extends bindings.Struct { | 282 class HitTesterHitTestResponseParams extends bindings.Struct { |
275 static const List<bindings.StructDataHeader> kVersions = const [ | 283 static const List<bindings.StructDataHeader> kVersions = const [ |
276 const bindings.StructDataHeader(16, 0) | 284 const bindings.StructDataHeader(16, 0) |
277 ]; | 285 ]; |
278 HitTestResult result = null; | 286 HitTestResult result = null; |
279 | 287 |
280 HitTesterHitTestResponseParams() : super(kVersions.last.size); | 288 HitTesterHitTestResponseParams() : super(kVersions.last.size); |
281 | 289 |
282 static HitTesterHitTestResponseParams deserialize(bindings.Message message) { | 290 static HitTesterHitTestResponseParams deserialize(bindings.Message message) { |
283 var decoder = new bindings.Decoder(message); | 291 var decoder = new bindings.Decoder(message); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
331 "result: $result" ")"; | 339 "result: $result" ")"; |
332 } | 340 } |
333 | 341 |
334 Map toJson() { | 342 Map toJson() { |
335 Map map = new Map(); | 343 Map map = new Map(); |
336 map["result"] = result; | 344 map["result"] = result; |
337 return map; | 345 return map; |
338 } | 346 } |
339 } | 347 } |
340 | 348 |
| 349 |
| 350 |
| 351 |
341 const int _HitTester_hitTestName = 0; | 352 const int _HitTester_hitTestName = 0; |
342 | 353 |
| 354 |
| 355 |
| 356 class _HitTesterServiceDescription implements service_describer.ServiceDescripti
on { |
| 357 dynamic getTopLevelInterface([Function responseFactory]) => null; |
| 358 |
| 359 dynamic getTypeDefinition(String typeKey, [Function responseFactory]) => null; |
| 360 |
| 361 dynamic getAllTypeDefinitions([Function responseFactory]) => null; |
| 362 } |
| 363 |
343 abstract class HitTester { | 364 abstract class HitTester { |
344 static const String serviceName = null; | 365 static const String serviceName = null; |
345 dynamic hitTest(geometry_mojom.Point point,[Function responseFactory = null]); | 366 dynamic hitTest(geometry_mojom.Point point,[Function responseFactory = null]); |
346 } | 367 } |
347 | 368 |
348 | 369 |
349 class _HitTesterProxyImpl extends bindings.Proxy { | 370 class _HitTesterProxyImpl extends bindings.Proxy { |
350 _HitTesterProxyImpl.fromEndpoint( | 371 _HitTesterProxyImpl.fromEndpoint( |
351 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); | 372 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); |
352 | 373 |
353 _HitTesterProxyImpl.fromHandle(core.MojoHandle handle) : | 374 _HitTesterProxyImpl.fromHandle(core.MojoHandle handle) : |
354 super.fromHandle(handle); | 375 super.fromHandle(handle); |
355 | 376 |
356 _HitTesterProxyImpl.unbound() : super.unbound(); | 377 _HitTesterProxyImpl.unbound() : super.unbound(); |
357 | 378 |
358 static _HitTesterProxyImpl newFromEndpoint( | 379 static _HitTesterProxyImpl newFromEndpoint( |
359 core.MojoMessagePipeEndpoint endpoint) { | 380 core.MojoMessagePipeEndpoint endpoint) { |
360 assert(endpoint.setDescription("For _HitTesterProxyImpl")); | 381 assert(endpoint.setDescription("For _HitTesterProxyImpl")); |
361 return new _HitTesterProxyImpl.fromEndpoint(endpoint); | 382 return new _HitTesterProxyImpl.fromEndpoint(endpoint); |
362 } | 383 } |
363 | 384 |
| 385 service_describer.ServiceDescription get serviceDescription => |
| 386 new _HitTesterServiceDescription(); |
| 387 |
364 void handleResponse(bindings.ServiceMessage message) { | 388 void handleResponse(bindings.ServiceMessage message) { |
365 switch (message.header.type) { | 389 switch (message.header.type) { |
366 case _HitTester_hitTestName: | 390 case _HitTester_hitTestName: |
367 var r = HitTesterHitTestResponseParams.deserialize( | 391 var r = HitTesterHitTestResponseParams.deserialize( |
368 message.payload); | 392 message.payload); |
369 if (!message.header.hasRequestId) { | 393 if (!message.header.hasRequestId) { |
370 proxyError("Expected a message with a valid request Id."); | 394 proxyError("Expected a message with a valid request Id."); |
371 return; | 395 return; |
372 } | 396 } |
373 Completer c = completerMap[message.header.requestId]; | 397 Completer c = completerMap[message.header.requestId]; |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
539 assert(_impl == null); | 563 assert(_impl == null); |
540 _impl = d; | 564 _impl = d; |
541 } | 565 } |
542 | 566 |
543 String toString() { | 567 String toString() { |
544 var superString = super.toString(); | 568 var superString = super.toString(); |
545 return "HitTesterStub($superString)"; | 569 return "HitTesterStub($superString)"; |
546 } | 570 } |
547 | 571 |
548 int get version => 0; | 572 int get version => 0; |
| 573 |
| 574 service_describer.ServiceDescription get serviceDescription => |
| 575 new _HitTesterServiceDescription(); |
549 } | 576 } |
550 | 577 |
551 | 578 |
| 579 |
OLD | NEW |