| 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 view_manager_mojom; | 5 library view_manager_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/ui/view_token.mojom.dart' as view_token_mojom
; | 10 import 'package:mojo_services/mojo/ui/view_token.mojom.dart' as view_token_mojom
; |
| (...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 358 impl.requireVersion(requiredVersion); | 358 impl.requireVersion(requiredVersion); |
| 359 } | 359 } |
| 360 | 360 |
| 361 String toString() { | 361 String toString() { |
| 362 return "ViewManagerProxy($impl)"; | 362 return "ViewManagerProxy($impl)"; |
| 363 } | 363 } |
| 364 } | 364 } |
| 365 | 365 |
| 366 | 366 |
| 367 class ViewManagerStub extends bindings.Stub { | 367 class ViewManagerStub extends bindings.Stub { |
| 368 ViewManager _impl = null; | 368 ViewManager _impl; |
| 369 | 369 |
| 370 ViewManagerStub.fromEndpoint( | 370 ViewManagerStub.fromEndpoint( |
| 371 core.MojoMessagePipeEndpoint endpoint, [this._impl]) | 371 core.MojoMessagePipeEndpoint endpoint, [ViewManager impl]) |
| 372 : super.fromEndpoint(endpoint); | 372 : super.fromEndpoint(endpoint, autoBegin: impl != null) { |
| 373 _impl = impl; |
| 374 } |
| 373 | 375 |
| 374 ViewManagerStub.fromHandle(core.MojoHandle handle, [this._impl]) | 376 ViewManagerStub.fromHandle( |
| 375 : super.fromHandle(handle); | 377 core.MojoHandle handle, [ViewManager impl]) |
| 378 : super.fromHandle(handle, autoBegin: impl != null) { |
| 379 _impl = impl; |
| 380 } |
| 376 | 381 |
| 377 ViewManagerStub.unbound() : super.unbound(); | 382 ViewManagerStub.unbound() : super.unbound(); |
| 378 | 383 |
| 379 static ViewManagerStub newFromEndpoint( | 384 static ViewManagerStub newFromEndpoint( |
| 380 core.MojoMessagePipeEndpoint endpoint) { | 385 core.MojoMessagePipeEndpoint endpoint) { |
| 381 assert(endpoint.setDescription("For ViewManagerStub")); | 386 assert(endpoint.setDescription("For ViewManagerStub")); |
| 382 return new ViewManagerStub.fromEndpoint(endpoint); | 387 return new ViewManagerStub.fromEndpoint(endpoint); |
| 383 } | 388 } |
| 384 | 389 |
| 385 | 390 |
| 386 | 391 |
| 387 dynamic handleMessage(bindings.ServiceMessage message) { | 392 dynamic handleMessage(bindings.ServiceMessage message) { |
| 388 if (bindings.ControlMessageHandler.isControlMessage(message)) { | 393 if (bindings.ControlMessageHandler.isControlMessage(message)) { |
| 389 return bindings.ControlMessageHandler.handleMessage(this, | 394 return bindings.ControlMessageHandler.handleMessage(this, |
| 390 0, | 395 0, |
| 391 message); | 396 message); |
| 392 } | 397 } |
| 393 assert(_impl != null); | 398 if (_impl == null) { |
| 399 throw new core.MojoApiError("$this has no implementation set"); |
| 400 } |
| 394 switch (message.header.type) { | 401 switch (message.header.type) { |
| 395 case _viewManagerMethodCreateViewName: | 402 case _viewManagerMethodCreateViewName: |
| 396 var params = _ViewManagerCreateViewParams.deserialize( | 403 var params = _ViewManagerCreateViewParams.deserialize( |
| 397 message.payload); | 404 message.payload); |
| 398 _impl.createView(params.view, params.viewOwner, params.viewListener, par
ams.label); | 405 _impl.createView(params.view, params.viewOwner, params.viewListener, par
ams.label); |
| 399 break; | 406 break; |
| 400 case _viewManagerMethodCreateViewTreeName: | 407 case _viewManagerMethodCreateViewTreeName: |
| 401 var params = _ViewManagerCreateViewTreeParams.deserialize( | 408 var params = _ViewManagerCreateViewTreeParams.deserialize( |
| 402 message.payload); | 409 message.payload); |
| 403 _impl.createViewTree(params.viewTree, params.viewTreeListener, params.la
bel); | 410 _impl.createViewTree(params.viewTree, params.viewTreeListener, params.la
bel); |
| 404 break; | 411 break; |
| 405 default: | 412 default: |
| 406 throw new bindings.MojoCodecError("Unexpected message name"); | 413 throw new bindings.MojoCodecError("Unexpected message name"); |
| 407 break; | 414 break; |
| 408 } | 415 } |
| 409 return null; | 416 return null; |
| 410 } | 417 } |
| 411 | 418 |
| 412 ViewManager get impl => _impl; | 419 ViewManager get impl => _impl; |
| 413 set impl(ViewManager d) { | 420 set impl(ViewManager d) { |
| 414 assert(_impl == null); | 421 if (d == null) { |
| 422 throw new core.MojoApiError("$this: Cannot set a null implementation"); |
| 423 } |
| 424 if (isBound && (_impl == null)) { |
| 425 beginHandlingEvents(); |
| 426 } |
| 415 _impl = d; | 427 _impl = d; |
| 416 } | 428 } |
| 417 | 429 |
| 430 @override |
| 431 void bind(core.MojoMessagePipeEndpoint endpoint) { |
| 432 super.bind(endpoint); |
| 433 if (!isOpen && (_impl != null)) { |
| 434 beginHandlingEvents(); |
| 435 } |
| 436 } |
| 437 |
| 418 String toString() { | 438 String toString() { |
| 419 var superString = super.toString(); | 439 var superString = super.toString(); |
| 420 return "ViewManagerStub($superString)"; | 440 return "ViewManagerStub($superString)"; |
| 421 } | 441 } |
| 422 | 442 |
| 423 int get version => 0; | 443 int get version => 0; |
| 424 | 444 |
| 425 static service_describer.ServiceDescription _cachedServiceDescription; | 445 static service_describer.ServiceDescription _cachedServiceDescription; |
| 426 static service_describer.ServiceDescription get serviceDescription { | 446 static service_describer.ServiceDescription get serviceDescription { |
| 427 if (_cachedServiceDescription == null) { | 447 if (_cachedServiceDescription == null) { |
| 428 _cachedServiceDescription = new _ViewManagerServiceDescription(); | 448 _cachedServiceDescription = new _ViewManagerServiceDescription(); |
| 429 } | 449 } |
| 430 return _cachedServiceDescription; | 450 return _cachedServiceDescription; |
| 431 } | 451 } |
| 432 } | 452 } |
| 433 | 453 |
| 434 | 454 |
| 435 | 455 |
| OLD | NEW |