| 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 application_mojom; | 5 library application_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/mojo/service_provider.mojom.dart' as service_provider_mojom
; | 10 import 'package:mojo/mojo/service_provider.mojom.dart' as service_provider_mojom
; |
| (...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 responseFactory(null); | 308 responseFactory(null); |
| 309 } | 309 } |
| 310 | 310 |
| 311 abstract class Application { | 311 abstract class Application { |
| 312 static const String serviceName = null; | 312 static const String serviceName = null; |
| 313 void initialize(Object shell, List<String> args, String url); | 313 void initialize(Object shell, List<String> args, String url); |
| 314 void acceptConnection(String requestorUrl, Object services, Object exposedServ
ices, String resolvedUrl); | 314 void acceptConnection(String requestorUrl, Object services, Object exposedServ
ices, String resolvedUrl); |
| 315 void requestQuit(); | 315 void requestQuit(); |
| 316 } | 316 } |
| 317 | 317 |
| 318 | 318 class _ApplicationProxyControl |
| 319 class _ApplicationProxyControl extends bindings.ProxyMessageHandler | 319 extends bindings.ProxyMessageHandler |
| 320 implements bindings.ProxyControl { | 320 implements bindings.ProxyControl { |
| 321 _ApplicationProxyControl.fromEndpoint( | 321 _ApplicationProxyControl.fromEndpoint( |
| 322 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); | 322 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); |
| 323 | 323 |
| 324 _ApplicationProxyControl.fromHandle( | 324 _ApplicationProxyControl.fromHandle( |
| 325 core.MojoHandle handle) : super.fromHandle(handle); | 325 core.MojoHandle handle) : super.fromHandle(handle); |
| 326 | 326 |
| 327 _ApplicationProxyControl.unbound() : super.unbound(); | 327 _ApplicationProxyControl.unbound() : super.unbound(); |
| 328 | 328 |
| 329 service_describer.ServiceDescription get serviceDescription => | 329 service_describer.ServiceDescription get serviceDescription => |
| 330 new _ApplicationServiceDescription(); | 330 new _ApplicationServiceDescription(); |
| 331 | 331 |
| 332 String get serviceName => Application.serviceName; | 332 String get serviceName => Application.serviceName; |
| 333 | 333 |
| 334 @override | |
| 335 void handleResponse(bindings.ServiceMessage message) { | 334 void handleResponse(bindings.ServiceMessage message) { |
| 336 switch (message.header.type) { | 335 switch (message.header.type) { |
| 337 default: | 336 default: |
| 338 proxyError("Unexpected message type: ${message.header.type}"); | 337 proxyError("Unexpected message type: ${message.header.type}"); |
| 339 close(immediate: true); | 338 close(immediate: true); |
| 340 break; | 339 break; |
| 341 } | 340 } |
| 342 } | 341 } |
| 343 | 342 |
| 344 @override | 343 @override |
| 345 String toString() { | 344 String toString() { |
| 346 var superString = super.toString(); | 345 var superString = super.toString(); |
| 347 return "_ApplicationProxyControl($superString)"; | 346 return "_ApplicationProxyControl($superString)"; |
| 348 } | 347 } |
| 349 } | 348 } |
| 350 | 349 |
| 351 | 350 class ApplicationProxy |
| 352 class ApplicationProxy extends bindings.Proxy | 351 extends bindings.Proxy |
| 353 implements Application { | 352 implements Application { |
| 354 ApplicationProxy.fromEndpoint( | 353 ApplicationProxy.fromEndpoint( |
| 355 core.MojoMessagePipeEndpoint endpoint) | 354 core.MojoMessagePipeEndpoint endpoint) |
| 356 : super(new _ApplicationProxyControl.fromEndpoint(endpoint)); | 355 : super(new _ApplicationProxyControl.fromEndpoint(endpoint)); |
| 357 | 356 |
| 358 ApplicationProxy.fromHandle(core.MojoHandle handle) | 357 ApplicationProxy.fromHandle(core.MojoHandle handle) |
| 359 : super(new _ApplicationProxyControl.fromHandle(handle)); | 358 : super(new _ApplicationProxyControl.fromHandle(handle)); |
| 360 | 359 |
| 361 ApplicationProxy.unbound() | 360 ApplicationProxy.unbound() |
| 362 : super(new _ApplicationProxyControl.unbound()); | 361 : super(new _ApplicationProxyControl.unbound()); |
| 363 | 362 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 404 if (!ctrl.isBound) { | 403 if (!ctrl.isBound) { |
| 405 ctrl.proxyError("The Proxy is closed."); | 404 ctrl.proxyError("The Proxy is closed."); |
| 406 return; | 405 return; |
| 407 } | 406 } |
| 408 var params = new _ApplicationRequestQuitParams(); | 407 var params = new _ApplicationRequestQuitParams(); |
| 409 ctrl.sendMessage(params, | 408 ctrl.sendMessage(params, |
| 410 _applicationMethodRequestQuitName); | 409 _applicationMethodRequestQuitName); |
| 411 } | 410 } |
| 412 } | 411 } |
| 413 | 412 |
| 414 | 413 class _ApplicationStubControl |
| 415 class ApplicationStub extends bindings.Stub { | 414 extends bindings.StubMessageHandler |
| 415 implements bindings.StubControl<Application> { |
| 416 Application _impl; | 416 Application _impl; |
| 417 | 417 |
| 418 ApplicationStub.fromEndpoint( | 418 _ApplicationStubControl.fromEndpoint( |
| 419 core.MojoMessagePipeEndpoint endpoint, [Application impl]) | 419 core.MojoMessagePipeEndpoint endpoint, [Application impl]) |
| 420 : super.fromEndpoint(endpoint, autoBegin: impl != null) { | 420 : super.fromEndpoint(endpoint, autoBegin: impl != null) { |
| 421 _impl = impl; | 421 _impl = impl; |
| 422 } | 422 } |
| 423 | 423 |
| 424 ApplicationStub.fromHandle( | 424 _ApplicationStubControl.fromHandle( |
| 425 core.MojoHandle handle, [Application impl]) | 425 core.MojoHandle handle, [Application impl]) |
| 426 : super.fromHandle(handle, autoBegin: impl != null) { | 426 : super.fromHandle(handle, autoBegin: impl != null) { |
| 427 _impl = impl; | 427 _impl = impl; |
| 428 } | 428 } |
| 429 | 429 |
| 430 ApplicationStub.unbound([this._impl]) : super.unbound(); | 430 _ApplicationStubControl.unbound([this._impl]) : super.unbound(); |
| 431 | |
| 432 static ApplicationStub newFromEndpoint( | |
| 433 core.MojoMessagePipeEndpoint endpoint) { | |
| 434 assert(endpoint.setDescription("For ApplicationStub")); | |
| 435 return new ApplicationStub.fromEndpoint(endpoint); | |
| 436 } | |
| 437 | 431 |
| 438 | 432 |
| 439 | 433 |
| 440 dynamic handleMessage(bindings.ServiceMessage message) { | 434 dynamic handleMessage(bindings.ServiceMessage message) { |
| 441 if (bindings.ControlMessageHandler.isControlMessage(message)) { | 435 if (bindings.ControlMessageHandler.isControlMessage(message)) { |
| 442 return bindings.ControlMessageHandler.handleMessage(this, | 436 return bindings.ControlMessageHandler.handleMessage(this, |
| 443 0, | 437 0, |
| 444 message); | 438 message); |
| 445 } | 439 } |
| 446 if (_impl == null) { | 440 if (_impl == null) { |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 479 } | 473 } |
| 480 | 474 |
| 481 @override | 475 @override |
| 482 void bind(core.MojoMessagePipeEndpoint endpoint) { | 476 void bind(core.MojoMessagePipeEndpoint endpoint) { |
| 483 super.bind(endpoint); | 477 super.bind(endpoint); |
| 484 if (!isOpen && (_impl != null)) { | 478 if (!isOpen && (_impl != null)) { |
| 485 beginHandlingEvents(); | 479 beginHandlingEvents(); |
| 486 } | 480 } |
| 487 } | 481 } |
| 488 | 482 |
| 483 @override |
| 489 String toString() { | 484 String toString() { |
| 490 var superString = super.toString(); | 485 var superString = super.toString(); |
| 491 return "ApplicationStub($superString)"; | 486 return "_ApplicationStubControl($superString)"; |
| 492 } | 487 } |
| 493 | 488 |
| 494 int get version => 0; | 489 int get version => 0; |
| 495 | 490 |
| 496 static service_describer.ServiceDescription _cachedServiceDescription; | 491 static service_describer.ServiceDescription _cachedServiceDescription; |
| 497 static service_describer.ServiceDescription get serviceDescription { | 492 static service_describer.ServiceDescription get serviceDescription { |
| 498 if (_cachedServiceDescription == null) { | 493 if (_cachedServiceDescription == null) { |
| 499 _cachedServiceDescription = new _ApplicationServiceDescription(); | 494 _cachedServiceDescription = new _ApplicationServiceDescription(); |
| 500 } | 495 } |
| 501 return _cachedServiceDescription; | 496 return _cachedServiceDescription; |
| 502 } | 497 } |
| 503 } | 498 } |
| 504 | 499 |
| 500 class ApplicationStub |
| 501 extends bindings.Stub<Application> |
| 502 implements Application { |
| 503 ApplicationStub.fromEndpoint( |
| 504 core.MojoMessagePipeEndpoint endpoint, [Application impl]) |
| 505 : super(new _ApplicationStubControl.fromEndpoint(endpoint, impl)); |
| 506 |
| 507 ApplicationStub.fromHandle( |
| 508 core.MojoHandle handle, [Application impl]) |
| 509 : super(new _ApplicationStubControl.fromHandle(handle, impl)); |
| 510 |
| 511 ApplicationStub.unbound([Application impl]) |
| 512 : super(new _ApplicationStubControl.unbound(impl)); |
| 513 |
| 514 static ApplicationStub newFromEndpoint( |
| 515 core.MojoMessagePipeEndpoint endpoint) { |
| 516 assert(endpoint.setDescription("For ApplicationStub")); |
| 517 return new ApplicationStub.fromEndpoint(endpoint); |
| 518 } |
| 519 |
| 520 static service_describer.ServiceDescription get serviceDescription => |
| 521 _ApplicationStubControl.serviceDescription; |
| 522 |
| 523 |
| 524 void initialize(Object shell, List<String> args, String url) { |
| 525 return impl.initialize(shell, args, url); |
| 526 } |
| 527 void acceptConnection(String requestorUrl, Object services, Object exposedServ
ices, String resolvedUrl) { |
| 528 return impl.acceptConnection(requestorUrl, services, exposedServices, resolv
edUrl); |
| 529 } |
| 530 void requestQuit() { |
| 531 return impl.requestQuit(); |
| 532 } |
| 533 } |
| 534 |
| 505 | 535 |
| 506 | 536 |
| OLD | NEW |