| 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 input_dispatcher_mojom; | 5 library input_dispatcher_mojom; |
| 6 import 'dart:async'; | 6 import 'dart:async'; |
| 7 import 'package:mojo/bindings.dart' as bindings; | 7 import 'package:mojo/bindings.dart' as bindings; |
| 8 import 'package:mojo/core.dart' as core; | 8 import 'package:mojo/core.dart' as core; |
| 9 import 'package:mojo/mojo/bindings/types/service_describer.mojom.dart' as servic
e_describer; | 9 import 'package:mojo/mojo/bindings/types/service_describer.mojom.dart' as servic
e_describer; |
| 10 import 'package:mojo_services/mojo/input_events.mojom.dart' as input_events_mojo
m; | 10 import 'package:mojo_services/mojo/input_events.mojom.dart' as input_events_mojo
m; |
| 11 | 11 |
| 12 | 12 |
| 13 | 13 |
| 14 class _InputDispatcherDispatchEventParams extends bindings.Struct { | 14 class _InputDispatcherDispatchEventParams extends bindings.Struct { |
| 15 static const List<bindings.StructDataHeader> kVersions = const [ | 15 static const List<bindings.StructDataHeader> kVersions = const [ |
| 16 const bindings.StructDataHeader(16, 0) | 16 const bindings.StructDataHeader(16, 0) |
| 17 ]; | 17 ]; |
| 18 input_events_mojom.Event event = null; | 18 input_events_mojom.Event event = null; |
| 19 | 19 |
| 20 _InputDispatcherDispatchEventParams() : super(kVersions.last.size); | 20 _InputDispatcherDispatchEventParams() : super(kVersions.last.size); |
| 21 | 21 |
| 22 _InputDispatcherDispatchEventParams.init( |
| 23 input_events_mojom.Event this.event |
| 24 ) : super(kVersions.last.size); |
| 25 |
| 22 static _InputDispatcherDispatchEventParams deserialize(bindings.Message messag
e) { | 26 static _InputDispatcherDispatchEventParams deserialize(bindings.Message messag
e) { |
| 23 var decoder = new bindings.Decoder(message); | 27 var decoder = new bindings.Decoder(message); |
| 24 var result = decode(decoder); | 28 var result = decode(decoder); |
| 25 if (decoder.excessHandles != null) { | 29 if (decoder.excessHandles != null) { |
| 26 decoder.excessHandles.forEach((h) => h.close()); | 30 decoder.excessHandles.forEach((h) => h.close()); |
| 27 } | 31 } |
| 28 return result; | 32 return result; |
| 29 } | 33 } |
| 30 | 34 |
| 31 static _InputDispatcherDispatchEventParams decode(bindings.Decoder decoder0) { | 35 static _InputDispatcherDispatchEventParams decode(bindings.Decoder decoder0) { |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 Map toJson() { | 83 Map toJson() { |
| 80 Map map = new Map(); | 84 Map map = new Map(); |
| 81 map["event"] = event; | 85 map["event"] = event; |
| 82 return map; | 86 return map; |
| 83 } | 87 } |
| 84 } | 88 } |
| 85 | 89 |
| 86 const int _inputDispatcherMethodDispatchEventName = 0; | 90 const int _inputDispatcherMethodDispatchEventName = 0; |
| 87 | 91 |
| 88 class _InputDispatcherServiceDescription implements service_describer.ServiceDes
cription { | 92 class _InputDispatcherServiceDescription implements service_describer.ServiceDes
cription { |
| 89 dynamic getTopLevelInterface([Function responseFactory]) => | 93 void getTopLevelInterface(Function responder) { |
| 90 responseFactory(null); | 94 responder(null); |
| 95 } |
| 91 | 96 |
| 92 dynamic getTypeDefinition(String typeKey, [Function responseFactory]) => | 97 void getTypeDefinition(String typeKey, Function responder) { |
| 93 responseFactory(null); | 98 responder(null); |
| 99 } |
| 94 | 100 |
| 95 dynamic getAllTypeDefinitions([Function responseFactory]) => | 101 void getAllTypeDefinitions(Function responder) { |
| 96 responseFactory(null); | 102 responder(null); |
| 103 } |
| 97 } | 104 } |
| 98 | 105 |
| 99 abstract class InputDispatcher { | 106 abstract class InputDispatcher { |
| 100 static const String serviceName = "mojo::ui::InputDispatcher"; | 107 static const String serviceName = "mojo::ui::InputDispatcher"; |
| 101 | 108 |
| 102 static service_describer.ServiceDescription _cachedServiceDescription; | 109 static service_describer.ServiceDescription _cachedServiceDescription; |
| 103 static service_describer.ServiceDescription get serviceDescription { | 110 static service_describer.ServiceDescription get serviceDescription { |
| 104 if (_cachedServiceDescription == null) { | 111 if (_cachedServiceDescription == null) { |
| 105 _cachedServiceDescription = new _InputDispatcherServiceDescription(); | 112 _cachedServiceDescription = new _InputDispatcherServiceDescription(); |
| 106 } | 113 } |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 : super.fromHandle(handle, autoBegin: impl != null) { | 243 : super.fromHandle(handle, autoBegin: impl != null) { |
| 237 _impl = impl; | 244 _impl = impl; |
| 238 } | 245 } |
| 239 | 246 |
| 240 _InputDispatcherStubControl.unbound([this._impl]) : super.unbound(); | 247 _InputDispatcherStubControl.unbound([this._impl]) : super.unbound(); |
| 241 | 248 |
| 242 String get serviceName => InputDispatcher.serviceName; | 249 String get serviceName => InputDispatcher.serviceName; |
| 243 | 250 |
| 244 | 251 |
| 245 | 252 |
| 246 dynamic handleMessage(bindings.ServiceMessage message) { | 253 void handleMessage(bindings.ServiceMessage message) { |
| 247 if (bindings.ControlMessageHandler.isControlMessage(message)) { | 254 if (bindings.ControlMessageHandler.isControlMessage(message)) { |
| 248 return bindings.ControlMessageHandler.handleMessage(this, | 255 bindings.ControlMessageHandler.handleMessage( |
| 249 0, | 256 this, 0, message); |
| 250 message); | 257 return; |
| 251 } | 258 } |
| 252 if (_impl == null) { | 259 if (_impl == null) { |
| 253 throw new core.MojoApiError("$this has no implementation set"); | 260 throw new core.MojoApiError("$this has no implementation set"); |
| 254 } | 261 } |
| 255 switch (message.header.type) { | 262 switch (message.header.type) { |
| 256 case _inputDispatcherMethodDispatchEventName: | 263 case _inputDispatcherMethodDispatchEventName: |
| 257 var params = _InputDispatcherDispatchEventParams.deserialize( | 264 var params = _InputDispatcherDispatchEventParams.deserialize( |
| 258 message.payload); | 265 message.payload); |
| 259 _impl.dispatchEvent(params.event); | 266 _impl.dispatchEvent(params.event); |
| 260 break; | 267 break; |
| 261 default: | 268 default: |
| 262 throw new bindings.MojoCodecError("Unexpected message name"); | 269 throw new bindings.MojoCodecError("Unexpected message name"); |
| 263 break; | 270 break; |
| 264 } | 271 } |
| 265 return null; | |
| 266 } | 272 } |
| 267 | 273 |
| 268 InputDispatcher get impl => _impl; | 274 InputDispatcher get impl => _impl; |
| 269 set impl(InputDispatcher d) { | 275 set impl(InputDispatcher d) { |
| 270 if (d == null) { | 276 if (d == null) { |
| 271 throw new core.MojoApiError("$this: Cannot set a null implementation"); | 277 throw new core.MojoApiError("$this: Cannot set a null implementation"); |
| 272 } | 278 } |
| 273 if (isBound && (_impl == null)) { | 279 if (isBound && (_impl == null)) { |
| 274 beginHandlingEvents(); | 280 beginHandlingEvents(); |
| 275 } | 281 } |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 316 } | 322 } |
| 317 | 323 |
| 318 | 324 |
| 319 void dispatchEvent(input_events_mojom.Event event) { | 325 void dispatchEvent(input_events_mojom.Event event) { |
| 320 return impl.dispatchEvent(event); | 326 return impl.dispatchEvent(event); |
| 321 } | 327 } |
| 322 } | 328 } |
| 323 | 329 |
| 324 | 330 |
| 325 | 331 |
| OLD | NEW |