Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(329)

Side by Side Diff: mojo/dart/packages/mojo_services/lib/mojo/ui/input_connection.mojom.dart

Issue 1983453002: Dart: Refactor Stubs (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Merge Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_connection_mojom; 5 library input_connection_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;
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 237
238 dynamic getAllTypeDefinitions([Function responseFactory]) => 238 dynamic getAllTypeDefinitions([Function responseFactory]) =>
239 responseFactory(null); 239 responseFactory(null);
240 } 240 }
241 241
242 abstract class InputConnection { 242 abstract class InputConnection {
243 static const String serviceName = "mojo::ui::InputConnection"; 243 static const String serviceName = "mojo::ui::InputConnection";
244 void setListener(Object listener); 244 void setListener(Object listener);
245 } 245 }
246 246
247 247 class _InputConnectionProxyControl
248 class _InputConnectionProxyControl extends bindings.ProxyMessageHandler 248 extends bindings.ProxyMessageHandler
249 implements bindings.ProxyControl { 249 implements bindings.ProxyControl {
250 _InputConnectionProxyControl.fromEndpoint( 250 _InputConnectionProxyControl.fromEndpoint(
251 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); 251 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint);
252 252
253 _InputConnectionProxyControl.fromHandle( 253 _InputConnectionProxyControl.fromHandle(
254 core.MojoHandle handle) : super.fromHandle(handle); 254 core.MojoHandle handle) : super.fromHandle(handle);
255 255
256 _InputConnectionProxyControl.unbound() : super.unbound(); 256 _InputConnectionProxyControl.unbound() : super.unbound();
257 257
258 service_describer.ServiceDescription get serviceDescription => 258 service_describer.ServiceDescription get serviceDescription =>
259 new _InputConnectionServiceDescription(); 259 new _InputConnectionServiceDescription();
260 260
261 String get serviceName => InputConnection.serviceName; 261 String get serviceName => InputConnection.serviceName;
262 262
263 @override
264 void handleResponse(bindings.ServiceMessage message) { 263 void handleResponse(bindings.ServiceMessage message) {
265 switch (message.header.type) { 264 switch (message.header.type) {
266 default: 265 default:
267 proxyError("Unexpected message type: ${message.header.type}"); 266 proxyError("Unexpected message type: ${message.header.type}");
268 close(immediate: true); 267 close(immediate: true);
269 break; 268 break;
270 } 269 }
271 } 270 }
272 271
273 @override 272 @override
274 String toString() { 273 String toString() {
275 var superString = super.toString(); 274 var superString = super.toString();
276 return "_InputConnectionProxyControl($superString)"; 275 return "_InputConnectionProxyControl($superString)";
277 } 276 }
278 } 277 }
279 278
280 279 class InputConnectionProxy
281 class InputConnectionProxy extends bindings.Proxy 280 extends bindings.Proxy
282 implements InputConnection { 281 implements InputConnection {
283 InputConnectionProxy.fromEndpoint( 282 InputConnectionProxy.fromEndpoint(
284 core.MojoMessagePipeEndpoint endpoint) 283 core.MojoMessagePipeEndpoint endpoint)
285 : super(new _InputConnectionProxyControl.fromEndpoint(endpoint)); 284 : super(new _InputConnectionProxyControl.fromEndpoint(endpoint));
286 285
287 InputConnectionProxy.fromHandle(core.MojoHandle handle) 286 InputConnectionProxy.fromHandle(core.MojoHandle handle)
288 : super(new _InputConnectionProxyControl.fromHandle(handle)); 287 : super(new _InputConnectionProxyControl.fromHandle(handle));
289 288
290 InputConnectionProxy.unbound() 289 InputConnectionProxy.unbound()
291 : super(new _InputConnectionProxyControl.unbound()); 290 : super(new _InputConnectionProxyControl.unbound());
292 291
(...skipping 16 matching lines...) Expand all
309 ctrl.proxyError("The Proxy is closed."); 308 ctrl.proxyError("The Proxy is closed.");
310 return; 309 return;
311 } 310 }
312 var params = new _InputConnectionSetListenerParams(); 311 var params = new _InputConnectionSetListenerParams();
313 params.listener = listener; 312 params.listener = listener;
314 ctrl.sendMessage(params, 313 ctrl.sendMessage(params,
315 _inputConnectionMethodSetListenerName); 314 _inputConnectionMethodSetListenerName);
316 } 315 }
317 } 316 }
318 317
319 318 class _InputConnectionStubControl
320 class InputConnectionStub extends bindings.Stub { 319 extends bindings.StubMessageHandler
320 implements bindings.StubControl<InputConnection> {
321 InputConnection _impl; 321 InputConnection _impl;
322 322
323 InputConnectionStub.fromEndpoint( 323 _InputConnectionStubControl.fromEndpoint(
324 core.MojoMessagePipeEndpoint endpoint, [InputConnection impl]) 324 core.MojoMessagePipeEndpoint endpoint, [InputConnection impl])
325 : super.fromEndpoint(endpoint, autoBegin: impl != null) { 325 : super.fromEndpoint(endpoint, autoBegin: impl != null) {
326 _impl = impl; 326 _impl = impl;
327 } 327 }
328 328
329 InputConnectionStub.fromHandle( 329 _InputConnectionStubControl.fromHandle(
330 core.MojoHandle handle, [InputConnection impl]) 330 core.MojoHandle handle, [InputConnection impl])
331 : super.fromHandle(handle, autoBegin: impl != null) { 331 : super.fromHandle(handle, autoBegin: impl != null) {
332 _impl = impl; 332 _impl = impl;
333 } 333 }
334 334
335 InputConnectionStub.unbound([this._impl]) : super.unbound(); 335 _InputConnectionStubControl.unbound([this._impl]) : super.unbound();
336
337 static InputConnectionStub newFromEndpoint(
338 core.MojoMessagePipeEndpoint endpoint) {
339 assert(endpoint.setDescription("For InputConnectionStub"));
340 return new InputConnectionStub.fromEndpoint(endpoint);
341 }
342 336
343 337
344 338
345 dynamic handleMessage(bindings.ServiceMessage message) { 339 dynamic handleMessage(bindings.ServiceMessage message) {
346 if (bindings.ControlMessageHandler.isControlMessage(message)) { 340 if (bindings.ControlMessageHandler.isControlMessage(message)) {
347 return bindings.ControlMessageHandler.handleMessage(this, 341 return bindings.ControlMessageHandler.handleMessage(this,
348 0, 342 0,
349 message); 343 message);
350 } 344 }
351 if (_impl == null) { 345 if (_impl == null) {
(...skipping 24 matching lines...) Expand all
376 } 370 }
377 371
378 @override 372 @override
379 void bind(core.MojoMessagePipeEndpoint endpoint) { 373 void bind(core.MojoMessagePipeEndpoint endpoint) {
380 super.bind(endpoint); 374 super.bind(endpoint);
381 if (!isOpen && (_impl != null)) { 375 if (!isOpen && (_impl != null)) {
382 beginHandlingEvents(); 376 beginHandlingEvents();
383 } 377 }
384 } 378 }
385 379
380 @override
386 String toString() { 381 String toString() {
387 var superString = super.toString(); 382 var superString = super.toString();
388 return "InputConnectionStub($superString)"; 383 return "_InputConnectionStubControl($superString)";
389 } 384 }
390 385
391 int get version => 0; 386 int get version => 0;
392 387
393 static service_describer.ServiceDescription _cachedServiceDescription; 388 static service_describer.ServiceDescription _cachedServiceDescription;
394 static service_describer.ServiceDescription get serviceDescription { 389 static service_describer.ServiceDescription get serviceDescription {
395 if (_cachedServiceDescription == null) { 390 if (_cachedServiceDescription == null) {
396 _cachedServiceDescription = new _InputConnectionServiceDescription(); 391 _cachedServiceDescription = new _InputConnectionServiceDescription();
397 } 392 }
398 return _cachedServiceDescription; 393 return _cachedServiceDescription;
399 } 394 }
400 } 395 }
401 396
397 class InputConnectionStub
398 extends bindings.Stub<InputConnection>
399 implements InputConnection {
400 InputConnectionStub.fromEndpoint(
401 core.MojoMessagePipeEndpoint endpoint, [InputConnection impl])
402 : super(new _InputConnectionStubControl.fromEndpoint(endpoint, impl));
403
404 InputConnectionStub.fromHandle(
405 core.MojoHandle handle, [InputConnection impl])
406 : super(new _InputConnectionStubControl.fromHandle(handle, impl));
407
408 InputConnectionStub.unbound([InputConnection impl])
409 : super(new _InputConnectionStubControl.unbound(impl));
410
411 static InputConnectionStub newFromEndpoint(
412 core.MojoMessagePipeEndpoint endpoint) {
413 assert(endpoint.setDescription("For InputConnectionStub"));
414 return new InputConnectionStub.fromEndpoint(endpoint);
415 }
416
417 static service_describer.ServiceDescription get serviceDescription =>
418 _InputConnectionStubControl.serviceDescription;
419
420
421 void setListener(Object listener) {
422 return impl.setListener(listener);
423 }
424 }
425
402 const int _inputListenerMethodOnEventName = 0; 426 const int _inputListenerMethodOnEventName = 0;
403 427
404 class _InputListenerServiceDescription implements service_describer.ServiceDescr iption { 428 class _InputListenerServiceDescription implements service_describer.ServiceDescr iption {
405 dynamic getTopLevelInterface([Function responseFactory]) => 429 dynamic getTopLevelInterface([Function responseFactory]) =>
406 responseFactory(null); 430 responseFactory(null);
407 431
408 dynamic getTypeDefinition(String typeKey, [Function responseFactory]) => 432 dynamic getTypeDefinition(String typeKey, [Function responseFactory]) =>
409 responseFactory(null); 433 responseFactory(null);
410 434
411 dynamic getAllTypeDefinitions([Function responseFactory]) => 435 dynamic getAllTypeDefinitions([Function responseFactory]) =>
412 responseFactory(null); 436 responseFactory(null);
413 } 437 }
414 438
415 abstract class InputListener { 439 abstract class InputListener {
416 static const String serviceName = null; 440 static const String serviceName = null;
417 dynamic onEvent(input_events_mojom.Event event,[Function responseFactory = nul l]); 441 dynamic onEvent(input_events_mojom.Event event,[Function responseFactory = nul l]);
418 } 442 }
419 443
420 444 class _InputListenerProxyControl
421 class _InputListenerProxyControl extends bindings.ProxyMessageHandler 445 extends bindings.ProxyMessageHandler
422 implements bindings.ProxyControl { 446 implements bindings.ProxyControl {
423 _InputListenerProxyControl.fromEndpoint( 447 _InputListenerProxyControl.fromEndpoint(
424 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); 448 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint);
425 449
426 _InputListenerProxyControl.fromHandle( 450 _InputListenerProxyControl.fromHandle(
427 core.MojoHandle handle) : super.fromHandle(handle); 451 core.MojoHandle handle) : super.fromHandle(handle);
428 452
429 _InputListenerProxyControl.unbound() : super.unbound(); 453 _InputListenerProxyControl.unbound() : super.unbound();
430 454
431 service_describer.ServiceDescription get serviceDescription => 455 service_describer.ServiceDescription get serviceDescription =>
432 new _InputListenerServiceDescription(); 456 new _InputListenerServiceDescription();
433 457
434 String get serviceName => InputListener.serviceName; 458 String get serviceName => InputListener.serviceName;
435 459
436 @override
437 void handleResponse(bindings.ServiceMessage message) { 460 void handleResponse(bindings.ServiceMessage message) {
438 switch (message.header.type) { 461 switch (message.header.type) {
439 case _inputListenerMethodOnEventName: 462 case _inputListenerMethodOnEventName:
440 var r = InputListenerOnEventResponseParams.deserialize( 463 var r = InputListenerOnEventResponseParams.deserialize(
441 message.payload); 464 message.payload);
442 if (!message.header.hasRequestId) { 465 if (!message.header.hasRequestId) {
443 proxyError("Expected a message with a valid request Id."); 466 proxyError("Expected a message with a valid request Id.");
444 return; 467 return;
445 } 468 }
446 Completer c = completerMap[message.header.requestId]; 469 Completer c = completerMap[message.header.requestId];
(...skipping 16 matching lines...) Expand all
463 } 486 }
464 } 487 }
465 488
466 @override 489 @override
467 String toString() { 490 String toString() {
468 var superString = super.toString(); 491 var superString = super.toString();
469 return "_InputListenerProxyControl($superString)"; 492 return "_InputListenerProxyControl($superString)";
470 } 493 }
471 } 494 }
472 495
473 496 class InputListenerProxy
474 class InputListenerProxy extends bindings.Proxy 497 extends bindings.Proxy
475 implements InputListener { 498 implements InputListener {
476 InputListenerProxy.fromEndpoint( 499 InputListenerProxy.fromEndpoint(
477 core.MojoMessagePipeEndpoint endpoint) 500 core.MojoMessagePipeEndpoint endpoint)
478 : super(new _InputListenerProxyControl.fromEndpoint(endpoint)); 501 : super(new _InputListenerProxyControl.fromEndpoint(endpoint));
479 502
480 InputListenerProxy.fromHandle(core.MojoHandle handle) 503 InputListenerProxy.fromHandle(core.MojoHandle handle)
481 : super(new _InputListenerProxyControl.fromHandle(handle)); 504 : super(new _InputListenerProxyControl.fromHandle(handle));
482 505
483 InputListenerProxy.unbound() 506 InputListenerProxy.unbound()
484 : super(new _InputListenerProxyControl.unbound()); 507 : super(new _InputListenerProxyControl.unbound());
485 508
(...skipping 15 matching lines...) Expand all
501 var params = new _InputListenerOnEventParams(); 524 var params = new _InputListenerOnEventParams();
502 params.event = event; 525 params.event = event;
503 return ctrl.sendMessageWithRequestId( 526 return ctrl.sendMessageWithRequestId(
504 params, 527 params,
505 _inputListenerMethodOnEventName, 528 _inputListenerMethodOnEventName,
506 -1, 529 -1,
507 bindings.MessageHeader.kMessageExpectsResponse); 530 bindings.MessageHeader.kMessageExpectsResponse);
508 } 531 }
509 } 532 }
510 533
511 534 class _InputListenerStubControl
512 class InputListenerStub extends bindings.Stub { 535 extends bindings.StubMessageHandler
536 implements bindings.StubControl<InputListener> {
513 InputListener _impl; 537 InputListener _impl;
514 538
515 InputListenerStub.fromEndpoint( 539 _InputListenerStubControl.fromEndpoint(
516 core.MojoMessagePipeEndpoint endpoint, [InputListener impl]) 540 core.MojoMessagePipeEndpoint endpoint, [InputListener impl])
517 : super.fromEndpoint(endpoint, autoBegin: impl != null) { 541 : super.fromEndpoint(endpoint, autoBegin: impl != null) {
518 _impl = impl; 542 _impl = impl;
519 } 543 }
520 544
521 InputListenerStub.fromHandle( 545 _InputListenerStubControl.fromHandle(
522 core.MojoHandle handle, [InputListener impl]) 546 core.MojoHandle handle, [InputListener impl])
523 : super.fromHandle(handle, autoBegin: impl != null) { 547 : super.fromHandle(handle, autoBegin: impl != null) {
524 _impl = impl; 548 _impl = impl;
525 } 549 }
526 550
527 InputListenerStub.unbound([this._impl]) : super.unbound(); 551 _InputListenerStubControl.unbound([this._impl]) : super.unbound();
528
529 static InputListenerStub newFromEndpoint(
530 core.MojoMessagePipeEndpoint endpoint) {
531 assert(endpoint.setDescription("For InputListenerStub"));
532 return new InputListenerStub.fromEndpoint(endpoint);
533 }
534 552
535 553
536 InputListenerOnEventResponseParams _inputListenerOnEventResponseParamsFactory( bool consumed) { 554 InputListenerOnEventResponseParams _inputListenerOnEventResponseParamsFactory( bool consumed) {
537 var result = new InputListenerOnEventResponseParams(); 555 var result = new InputListenerOnEventResponseParams();
538 result.consumed = consumed; 556 result.consumed = consumed;
539 return result; 557 return result;
540 } 558 }
541 559
542 dynamic handleMessage(bindings.ServiceMessage message) { 560 dynamic handleMessage(bindings.ServiceMessage message) {
543 if (bindings.ControlMessageHandler.isControlMessage(message)) { 561 if (bindings.ControlMessageHandler.isControlMessage(message)) {
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
590 } 608 }
591 609
592 @override 610 @override
593 void bind(core.MojoMessagePipeEndpoint endpoint) { 611 void bind(core.MojoMessagePipeEndpoint endpoint) {
594 super.bind(endpoint); 612 super.bind(endpoint);
595 if (!isOpen && (_impl != null)) { 613 if (!isOpen && (_impl != null)) {
596 beginHandlingEvents(); 614 beginHandlingEvents();
597 } 615 }
598 } 616 }
599 617
618 @override
600 String toString() { 619 String toString() {
601 var superString = super.toString(); 620 var superString = super.toString();
602 return "InputListenerStub($superString)"; 621 return "_InputListenerStubControl($superString)";
603 } 622 }
604 623
605 int get version => 0; 624 int get version => 0;
606 625
607 static service_describer.ServiceDescription _cachedServiceDescription; 626 static service_describer.ServiceDescription _cachedServiceDescription;
608 static service_describer.ServiceDescription get serviceDescription { 627 static service_describer.ServiceDescription get serviceDescription {
609 if (_cachedServiceDescription == null) { 628 if (_cachedServiceDescription == null) {
610 _cachedServiceDescription = new _InputListenerServiceDescription(); 629 _cachedServiceDescription = new _InputListenerServiceDescription();
611 } 630 }
612 return _cachedServiceDescription; 631 return _cachedServiceDescription;
613 } 632 }
614 } 633 }
615 634
635 class InputListenerStub
636 extends bindings.Stub<InputListener>
637 implements InputListener {
638 InputListenerStub.fromEndpoint(
639 core.MojoMessagePipeEndpoint endpoint, [InputListener impl])
640 : super(new _InputListenerStubControl.fromEndpoint(endpoint, impl));
641
642 InputListenerStub.fromHandle(
643 core.MojoHandle handle, [InputListener impl])
644 : super(new _InputListenerStubControl.fromHandle(handle, impl));
645
646 InputListenerStub.unbound([InputListener impl])
647 : super(new _InputListenerStubControl.unbound(impl));
648
649 static InputListenerStub newFromEndpoint(
650 core.MojoMessagePipeEndpoint endpoint) {
651 assert(endpoint.setDescription("For InputListenerStub"));
652 return new InputListenerStub.fromEndpoint(endpoint);
653 }
654
655 static service_describer.ServiceDescription get serviceDescription =>
656 _InputListenerStubControl.serviceDescription;
657
658
659 dynamic onEvent(input_events_mojom.Event event,[Function responseFactory = nul l]) {
660 return impl.onEvent(event,responseFactory);
661 }
662 }
663
616 664
617 665
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698