| 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_mojom; | 5 library input_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 | 10 |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 | 207 |
| 208 dynamic getAllTypeDefinitions([Function responseFactory]) => | 208 dynamic getAllTypeDefinitions([Function responseFactory]) => |
| 209 responseFactory(null); | 209 responseFactory(null); |
| 210 } | 210 } |
| 211 | 211 |
| 212 abstract class InputClient { | 212 abstract class InputClient { |
| 213 static const String serviceName = null; | 213 static const String serviceName = null; |
| 214 dynamic onBackButton([Function responseFactory = null]); | 214 dynamic onBackButton([Function responseFactory = null]); |
| 215 } | 215 } |
| 216 | 216 |
| 217 | 217 class _InputClientProxyControl |
| 218 class _InputClientProxyControl extends bindings.ProxyMessageHandler | 218 extends bindings.ProxyMessageHandler |
| 219 implements bindings.ProxyControl { | 219 implements bindings.ProxyControl { |
| 220 _InputClientProxyControl.fromEndpoint( | 220 _InputClientProxyControl.fromEndpoint( |
| 221 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); | 221 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); |
| 222 | 222 |
| 223 _InputClientProxyControl.fromHandle( | 223 _InputClientProxyControl.fromHandle( |
| 224 core.MojoHandle handle) : super.fromHandle(handle); | 224 core.MojoHandle handle) : super.fromHandle(handle); |
| 225 | 225 |
| 226 _InputClientProxyControl.unbound() : super.unbound(); | 226 _InputClientProxyControl.unbound() : super.unbound(); |
| 227 | 227 |
| 228 service_describer.ServiceDescription get serviceDescription => | 228 service_describer.ServiceDescription get serviceDescription => |
| 229 new _InputClientServiceDescription(); | 229 new _InputClientServiceDescription(); |
| 230 | 230 |
| 231 String get serviceName => InputClient.serviceName; | 231 String get serviceName => InputClient.serviceName; |
| 232 | 232 |
| 233 @override | |
| 234 void handleResponse(bindings.ServiceMessage message) { | 233 void handleResponse(bindings.ServiceMessage message) { |
| 235 switch (message.header.type) { | 234 switch (message.header.type) { |
| 236 case _inputClientMethodOnBackButtonName: | 235 case _inputClientMethodOnBackButtonName: |
| 237 var r = InputClientOnBackButtonResponseParams.deserialize( | 236 var r = InputClientOnBackButtonResponseParams.deserialize( |
| 238 message.payload); | 237 message.payload); |
| 239 if (!message.header.hasRequestId) { | 238 if (!message.header.hasRequestId) { |
| 240 proxyError("Expected a message with a valid request Id."); | 239 proxyError("Expected a message with a valid request Id."); |
| 241 return; | 240 return; |
| 242 } | 241 } |
| 243 Completer c = completerMap[message.header.requestId]; | 242 Completer c = completerMap[message.header.requestId]; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 260 } | 259 } |
| 261 } | 260 } |
| 262 | 261 |
| 263 @override | 262 @override |
| 264 String toString() { | 263 String toString() { |
| 265 var superString = super.toString(); | 264 var superString = super.toString(); |
| 266 return "_InputClientProxyControl($superString)"; | 265 return "_InputClientProxyControl($superString)"; |
| 267 } | 266 } |
| 268 } | 267 } |
| 269 | 268 |
| 270 | 269 class InputClientProxy |
| 271 class InputClientProxy extends bindings.Proxy | 270 extends bindings.Proxy |
| 272 implements InputClient { | 271 implements InputClient { |
| 273 InputClientProxy.fromEndpoint( | 272 InputClientProxy.fromEndpoint( |
| 274 core.MojoMessagePipeEndpoint endpoint) | 273 core.MojoMessagePipeEndpoint endpoint) |
| 275 : super(new _InputClientProxyControl.fromEndpoint(endpoint)); | 274 : super(new _InputClientProxyControl.fromEndpoint(endpoint)); |
| 276 | 275 |
| 277 InputClientProxy.fromHandle(core.MojoHandle handle) | 276 InputClientProxy.fromHandle(core.MojoHandle handle) |
| 278 : super(new _InputClientProxyControl.fromHandle(handle)); | 277 : super(new _InputClientProxyControl.fromHandle(handle)); |
| 279 | 278 |
| 280 InputClientProxy.unbound() | 279 InputClientProxy.unbound() |
| 281 : super(new _InputClientProxyControl.unbound()); | 280 : super(new _InputClientProxyControl.unbound()); |
| 282 | 281 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 297 dynamic onBackButton([Function responseFactory = null]) { | 296 dynamic onBackButton([Function responseFactory = null]) { |
| 298 var params = new _InputClientOnBackButtonParams(); | 297 var params = new _InputClientOnBackButtonParams(); |
| 299 return ctrl.sendMessageWithRequestId( | 298 return ctrl.sendMessageWithRequestId( |
| 300 params, | 299 params, |
| 301 _inputClientMethodOnBackButtonName, | 300 _inputClientMethodOnBackButtonName, |
| 302 -1, | 301 -1, |
| 303 bindings.MessageHeader.kMessageExpectsResponse); | 302 bindings.MessageHeader.kMessageExpectsResponse); |
| 304 } | 303 } |
| 305 } | 304 } |
| 306 | 305 |
| 307 | 306 class _InputClientStubControl |
| 308 class InputClientStub extends bindings.Stub { | 307 extends bindings.StubMessageHandler |
| 308 implements bindings.StubControl<InputClient> { |
| 309 InputClient _impl; | 309 InputClient _impl; |
| 310 | 310 |
| 311 InputClientStub.fromEndpoint( | 311 _InputClientStubControl.fromEndpoint( |
| 312 core.MojoMessagePipeEndpoint endpoint, [InputClient impl]) | 312 core.MojoMessagePipeEndpoint endpoint, [InputClient impl]) |
| 313 : super.fromEndpoint(endpoint, autoBegin: impl != null) { | 313 : super.fromEndpoint(endpoint, autoBegin: impl != null) { |
| 314 _impl = impl; | 314 _impl = impl; |
| 315 } | 315 } |
| 316 | 316 |
| 317 InputClientStub.fromHandle( | 317 _InputClientStubControl.fromHandle( |
| 318 core.MojoHandle handle, [InputClient impl]) | 318 core.MojoHandle handle, [InputClient impl]) |
| 319 : super.fromHandle(handle, autoBegin: impl != null) { | 319 : super.fromHandle(handle, autoBegin: impl != null) { |
| 320 _impl = impl; | 320 _impl = impl; |
| 321 } | 321 } |
| 322 | 322 |
| 323 InputClientStub.unbound([this._impl]) : super.unbound(); | 323 _InputClientStubControl.unbound([this._impl]) : super.unbound(); |
| 324 | |
| 325 static InputClientStub newFromEndpoint( | |
| 326 core.MojoMessagePipeEndpoint endpoint) { | |
| 327 assert(endpoint.setDescription("For InputClientStub")); | |
| 328 return new InputClientStub.fromEndpoint(endpoint); | |
| 329 } | |
| 330 | 324 |
| 331 | 325 |
| 332 InputClientOnBackButtonResponseParams _inputClientOnBackButtonResponseParamsFa
ctory() { | 326 InputClientOnBackButtonResponseParams _inputClientOnBackButtonResponseParamsFa
ctory() { |
| 333 var result = new InputClientOnBackButtonResponseParams(); | 327 var result = new InputClientOnBackButtonResponseParams(); |
| 334 return result; | 328 return result; |
| 335 } | 329 } |
| 336 | 330 |
| 337 dynamic handleMessage(bindings.ServiceMessage message) { | 331 dynamic handleMessage(bindings.ServiceMessage message) { |
| 338 if (bindings.ControlMessageHandler.isControlMessage(message)) { | 332 if (bindings.ControlMessageHandler.isControlMessage(message)) { |
| 339 return bindings.ControlMessageHandler.handleMessage(this, | 333 return bindings.ControlMessageHandler.handleMessage(this, |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 383 } | 377 } |
| 384 | 378 |
| 385 @override | 379 @override |
| 386 void bind(core.MojoMessagePipeEndpoint endpoint) { | 380 void bind(core.MojoMessagePipeEndpoint endpoint) { |
| 387 super.bind(endpoint); | 381 super.bind(endpoint); |
| 388 if (!isOpen && (_impl != null)) { | 382 if (!isOpen && (_impl != null)) { |
| 389 beginHandlingEvents(); | 383 beginHandlingEvents(); |
| 390 } | 384 } |
| 391 } | 385 } |
| 392 | 386 |
| 387 @override |
| 393 String toString() { | 388 String toString() { |
| 394 var superString = super.toString(); | 389 var superString = super.toString(); |
| 395 return "InputClientStub($superString)"; | 390 return "_InputClientStubControl($superString)"; |
| 396 } | 391 } |
| 397 | 392 |
| 398 int get version => 0; | 393 int get version => 0; |
| 399 | 394 |
| 400 static service_describer.ServiceDescription _cachedServiceDescription; | 395 static service_describer.ServiceDescription _cachedServiceDescription; |
| 401 static service_describer.ServiceDescription get serviceDescription { | 396 static service_describer.ServiceDescription get serviceDescription { |
| 402 if (_cachedServiceDescription == null) { | 397 if (_cachedServiceDescription == null) { |
| 403 _cachedServiceDescription = new _InputClientServiceDescription(); | 398 _cachedServiceDescription = new _InputClientServiceDescription(); |
| 404 } | 399 } |
| 405 return _cachedServiceDescription; | 400 return _cachedServiceDescription; |
| 406 } | 401 } |
| 407 } | 402 } |
| 408 | 403 |
| 404 class InputClientStub |
| 405 extends bindings.Stub<InputClient> |
| 406 implements InputClient { |
| 407 InputClientStub.fromEndpoint( |
| 408 core.MojoMessagePipeEndpoint endpoint, [InputClient impl]) |
| 409 : super(new _InputClientStubControl.fromEndpoint(endpoint, impl)); |
| 410 |
| 411 InputClientStub.fromHandle( |
| 412 core.MojoHandle handle, [InputClient impl]) |
| 413 : super(new _InputClientStubControl.fromHandle(handle, impl)); |
| 414 |
| 415 InputClientStub.unbound([InputClient impl]) |
| 416 : super(new _InputClientStubControl.unbound(impl)); |
| 417 |
| 418 static InputClientStub newFromEndpoint( |
| 419 core.MojoMessagePipeEndpoint endpoint) { |
| 420 assert(endpoint.setDescription("For InputClientStub")); |
| 421 return new InputClientStub.fromEndpoint(endpoint); |
| 422 } |
| 423 |
| 424 static service_describer.ServiceDescription get serviceDescription => |
| 425 _InputClientStubControl.serviceDescription; |
| 426 |
| 427 |
| 428 dynamic onBackButton([Function responseFactory = null]) { |
| 429 return impl.onBackButton(responseFactory); |
| 430 } |
| 431 } |
| 432 |
| 409 const int _inputServiceMethodSetClientName = 0; | 433 const int _inputServiceMethodSetClientName = 0; |
| 410 | 434 |
| 411 class _InputServiceServiceDescription implements service_describer.ServiceDescri
ption { | 435 class _InputServiceServiceDescription implements service_describer.ServiceDescri
ption { |
| 412 dynamic getTopLevelInterface([Function responseFactory]) => | 436 dynamic getTopLevelInterface([Function responseFactory]) => |
| 413 responseFactory(null); | 437 responseFactory(null); |
| 414 | 438 |
| 415 dynamic getTypeDefinition(String typeKey, [Function responseFactory]) => | 439 dynamic getTypeDefinition(String typeKey, [Function responseFactory]) => |
| 416 responseFactory(null); | 440 responseFactory(null); |
| 417 | 441 |
| 418 dynamic getAllTypeDefinitions([Function responseFactory]) => | 442 dynamic getAllTypeDefinitions([Function responseFactory]) => |
| 419 responseFactory(null); | 443 responseFactory(null); |
| 420 } | 444 } |
| 421 | 445 |
| 422 abstract class InputService { | 446 abstract class InputService { |
| 423 static const String serviceName = "input::InputService"; | 447 static const String serviceName = "input::InputService"; |
| 424 void setClient(Object client); | 448 void setClient(Object client); |
| 425 } | 449 } |
| 426 | 450 |
| 427 | 451 class _InputServiceProxyControl |
| 428 class _InputServiceProxyControl extends bindings.ProxyMessageHandler | 452 extends bindings.ProxyMessageHandler |
| 429 implements bindings.ProxyControl { | 453 implements bindings.ProxyControl { |
| 430 _InputServiceProxyControl.fromEndpoint( | 454 _InputServiceProxyControl.fromEndpoint( |
| 431 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); | 455 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); |
| 432 | 456 |
| 433 _InputServiceProxyControl.fromHandle( | 457 _InputServiceProxyControl.fromHandle( |
| 434 core.MojoHandle handle) : super.fromHandle(handle); | 458 core.MojoHandle handle) : super.fromHandle(handle); |
| 435 | 459 |
| 436 _InputServiceProxyControl.unbound() : super.unbound(); | 460 _InputServiceProxyControl.unbound() : super.unbound(); |
| 437 | 461 |
| 438 service_describer.ServiceDescription get serviceDescription => | 462 service_describer.ServiceDescription get serviceDescription => |
| 439 new _InputServiceServiceDescription(); | 463 new _InputServiceServiceDescription(); |
| 440 | 464 |
| 441 String get serviceName => InputService.serviceName; | 465 String get serviceName => InputService.serviceName; |
| 442 | 466 |
| 443 @override | |
| 444 void handleResponse(bindings.ServiceMessage message) { | 467 void handleResponse(bindings.ServiceMessage message) { |
| 445 switch (message.header.type) { | 468 switch (message.header.type) { |
| 446 default: | 469 default: |
| 447 proxyError("Unexpected message type: ${message.header.type}"); | 470 proxyError("Unexpected message type: ${message.header.type}"); |
| 448 close(immediate: true); | 471 close(immediate: true); |
| 449 break; | 472 break; |
| 450 } | 473 } |
| 451 } | 474 } |
| 452 | 475 |
| 453 @override | 476 @override |
| 454 String toString() { | 477 String toString() { |
| 455 var superString = super.toString(); | 478 var superString = super.toString(); |
| 456 return "_InputServiceProxyControl($superString)"; | 479 return "_InputServiceProxyControl($superString)"; |
| 457 } | 480 } |
| 458 } | 481 } |
| 459 | 482 |
| 460 | 483 class InputServiceProxy |
| 461 class InputServiceProxy extends bindings.Proxy | 484 extends bindings.Proxy |
| 462 implements InputService { | 485 implements InputService { |
| 463 InputServiceProxy.fromEndpoint( | 486 InputServiceProxy.fromEndpoint( |
| 464 core.MojoMessagePipeEndpoint endpoint) | 487 core.MojoMessagePipeEndpoint endpoint) |
| 465 : super(new _InputServiceProxyControl.fromEndpoint(endpoint)); | 488 : super(new _InputServiceProxyControl.fromEndpoint(endpoint)); |
| 466 | 489 |
| 467 InputServiceProxy.fromHandle(core.MojoHandle handle) | 490 InputServiceProxy.fromHandle(core.MojoHandle handle) |
| 468 : super(new _InputServiceProxyControl.fromHandle(handle)); | 491 : super(new _InputServiceProxyControl.fromHandle(handle)); |
| 469 | 492 |
| 470 InputServiceProxy.unbound() | 493 InputServiceProxy.unbound() |
| 471 : super(new _InputServiceProxyControl.unbound()); | 494 : super(new _InputServiceProxyControl.unbound()); |
| 472 | 495 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 489 ctrl.proxyError("The Proxy is closed."); | 512 ctrl.proxyError("The Proxy is closed."); |
| 490 return; | 513 return; |
| 491 } | 514 } |
| 492 var params = new _InputServiceSetClientParams(); | 515 var params = new _InputServiceSetClientParams(); |
| 493 params.client = client; | 516 params.client = client; |
| 494 ctrl.sendMessage(params, | 517 ctrl.sendMessage(params, |
| 495 _inputServiceMethodSetClientName); | 518 _inputServiceMethodSetClientName); |
| 496 } | 519 } |
| 497 } | 520 } |
| 498 | 521 |
| 499 | 522 class _InputServiceStubControl |
| 500 class InputServiceStub extends bindings.Stub { | 523 extends bindings.StubMessageHandler |
| 524 implements bindings.StubControl<InputService> { |
| 501 InputService _impl; | 525 InputService _impl; |
| 502 | 526 |
| 503 InputServiceStub.fromEndpoint( | 527 _InputServiceStubControl.fromEndpoint( |
| 504 core.MojoMessagePipeEndpoint endpoint, [InputService impl]) | 528 core.MojoMessagePipeEndpoint endpoint, [InputService impl]) |
| 505 : super.fromEndpoint(endpoint, autoBegin: impl != null) { | 529 : super.fromEndpoint(endpoint, autoBegin: impl != null) { |
| 506 _impl = impl; | 530 _impl = impl; |
| 507 } | 531 } |
| 508 | 532 |
| 509 InputServiceStub.fromHandle( | 533 _InputServiceStubControl.fromHandle( |
| 510 core.MojoHandle handle, [InputService impl]) | 534 core.MojoHandle handle, [InputService impl]) |
| 511 : super.fromHandle(handle, autoBegin: impl != null) { | 535 : super.fromHandle(handle, autoBegin: impl != null) { |
| 512 _impl = impl; | 536 _impl = impl; |
| 513 } | 537 } |
| 514 | 538 |
| 515 InputServiceStub.unbound([this._impl]) : super.unbound(); | 539 _InputServiceStubControl.unbound([this._impl]) : super.unbound(); |
| 516 | |
| 517 static InputServiceStub newFromEndpoint( | |
| 518 core.MojoMessagePipeEndpoint endpoint) { | |
| 519 assert(endpoint.setDescription("For InputServiceStub")); | |
| 520 return new InputServiceStub.fromEndpoint(endpoint); | |
| 521 } | |
| 522 | 540 |
| 523 | 541 |
| 524 | 542 |
| 525 dynamic handleMessage(bindings.ServiceMessage message) { | 543 dynamic handleMessage(bindings.ServiceMessage message) { |
| 526 if (bindings.ControlMessageHandler.isControlMessage(message)) { | 544 if (bindings.ControlMessageHandler.isControlMessage(message)) { |
| 527 return bindings.ControlMessageHandler.handleMessage(this, | 545 return bindings.ControlMessageHandler.handleMessage(this, |
| 528 0, | 546 0, |
| 529 message); | 547 message); |
| 530 } | 548 } |
| 531 if (_impl == null) { | 549 if (_impl == null) { |
| (...skipping 24 matching lines...) Expand all Loading... |
| 556 } | 574 } |
| 557 | 575 |
| 558 @override | 576 @override |
| 559 void bind(core.MojoMessagePipeEndpoint endpoint) { | 577 void bind(core.MojoMessagePipeEndpoint endpoint) { |
| 560 super.bind(endpoint); | 578 super.bind(endpoint); |
| 561 if (!isOpen && (_impl != null)) { | 579 if (!isOpen && (_impl != null)) { |
| 562 beginHandlingEvents(); | 580 beginHandlingEvents(); |
| 563 } | 581 } |
| 564 } | 582 } |
| 565 | 583 |
| 584 @override |
| 566 String toString() { | 585 String toString() { |
| 567 var superString = super.toString(); | 586 var superString = super.toString(); |
| 568 return "InputServiceStub($superString)"; | 587 return "_InputServiceStubControl($superString)"; |
| 569 } | 588 } |
| 570 | 589 |
| 571 int get version => 0; | 590 int get version => 0; |
| 572 | 591 |
| 573 static service_describer.ServiceDescription _cachedServiceDescription; | 592 static service_describer.ServiceDescription _cachedServiceDescription; |
| 574 static service_describer.ServiceDescription get serviceDescription { | 593 static service_describer.ServiceDescription get serviceDescription { |
| 575 if (_cachedServiceDescription == null) { | 594 if (_cachedServiceDescription == null) { |
| 576 _cachedServiceDescription = new _InputServiceServiceDescription(); | 595 _cachedServiceDescription = new _InputServiceServiceDescription(); |
| 577 } | 596 } |
| 578 return _cachedServiceDescription; | 597 return _cachedServiceDescription; |
| 579 } | 598 } |
| 580 } | 599 } |
| 581 | 600 |
| 601 class InputServiceStub |
| 602 extends bindings.Stub<InputService> |
| 603 implements InputService { |
| 604 InputServiceStub.fromEndpoint( |
| 605 core.MojoMessagePipeEndpoint endpoint, [InputService impl]) |
| 606 : super(new _InputServiceStubControl.fromEndpoint(endpoint, impl)); |
| 607 |
| 608 InputServiceStub.fromHandle( |
| 609 core.MojoHandle handle, [InputService impl]) |
| 610 : super(new _InputServiceStubControl.fromHandle(handle, impl)); |
| 611 |
| 612 InputServiceStub.unbound([InputService impl]) |
| 613 : super(new _InputServiceStubControl.unbound(impl)); |
| 614 |
| 615 static InputServiceStub newFromEndpoint( |
| 616 core.MojoMessagePipeEndpoint endpoint) { |
| 617 assert(endpoint.setDescription("For InputServiceStub")); |
| 618 return new InputServiceStub.fromEndpoint(endpoint); |
| 619 } |
| 620 |
| 621 static service_describer.ServiceDescription get serviceDescription => |
| 622 _InputServiceStubControl.serviceDescription; |
| 623 |
| 624 |
| 625 void setClient(Object client) { |
| 626 return impl.setClient(client); |
| 627 } |
| 628 } |
| 629 |
| 582 | 630 |
| 583 | 631 |
| OLD | NEW |