| 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 files_mojom; | 5 library files_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/files/directory.mojom.dart' as directory_mojo
m; | 10 import 'package:mojo_services/mojo/files/directory.mojom.dart' as directory_mojo
m; |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 | 182 |
| 183 dynamic getAllTypeDefinitions([Function responseFactory]) => | 183 dynamic getAllTypeDefinitions([Function responseFactory]) => |
| 184 responseFactory(null); | 184 responseFactory(null); |
| 185 } | 185 } |
| 186 | 186 |
| 187 abstract class Files { | 187 abstract class Files { |
| 188 static const String serviceName = "mojo::files::Files"; | 188 static const String serviceName = "mojo::files::Files"; |
| 189 dynamic openFileSystem(String fileSystem,Object directory,[Function responseFa
ctory = null]); | 189 dynamic openFileSystem(String fileSystem,Object directory,[Function responseFa
ctory = null]); |
| 190 } | 190 } |
| 191 | 191 |
| 192 | 192 class _FilesProxyControl |
| 193 class _FilesProxyControl extends bindings.ProxyMessageHandler | 193 extends bindings.ProxyMessageHandler |
| 194 implements bindings.ProxyControl { | 194 implements bindings.ProxyControl { |
| 195 _FilesProxyControl.fromEndpoint( | 195 _FilesProxyControl.fromEndpoint( |
| 196 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); | 196 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); |
| 197 | 197 |
| 198 _FilesProxyControl.fromHandle( | 198 _FilesProxyControl.fromHandle( |
| 199 core.MojoHandle handle) : super.fromHandle(handle); | 199 core.MojoHandle handle) : super.fromHandle(handle); |
| 200 | 200 |
| 201 _FilesProxyControl.unbound() : super.unbound(); | 201 _FilesProxyControl.unbound() : super.unbound(); |
| 202 | 202 |
| 203 service_describer.ServiceDescription get serviceDescription => | 203 service_describer.ServiceDescription get serviceDescription => |
| 204 new _FilesServiceDescription(); | 204 new _FilesServiceDescription(); |
| 205 | 205 |
| 206 String get serviceName => Files.serviceName; | 206 String get serviceName => Files.serviceName; |
| 207 | 207 |
| 208 @override | |
| 209 void handleResponse(bindings.ServiceMessage message) { | 208 void handleResponse(bindings.ServiceMessage message) { |
| 210 switch (message.header.type) { | 209 switch (message.header.type) { |
| 211 case _filesMethodOpenFileSystemName: | 210 case _filesMethodOpenFileSystemName: |
| 212 var r = FilesOpenFileSystemResponseParams.deserialize( | 211 var r = FilesOpenFileSystemResponseParams.deserialize( |
| 213 message.payload); | 212 message.payload); |
| 214 if (!message.header.hasRequestId) { | 213 if (!message.header.hasRequestId) { |
| 215 proxyError("Expected a message with a valid request Id."); | 214 proxyError("Expected a message with a valid request Id."); |
| 216 return; | 215 return; |
| 217 } | 216 } |
| 218 Completer c = completerMap[message.header.requestId]; | 217 Completer c = completerMap[message.header.requestId]; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 235 } | 234 } |
| 236 } | 235 } |
| 237 | 236 |
| 238 @override | 237 @override |
| 239 String toString() { | 238 String toString() { |
| 240 var superString = super.toString(); | 239 var superString = super.toString(); |
| 241 return "_FilesProxyControl($superString)"; | 240 return "_FilesProxyControl($superString)"; |
| 242 } | 241 } |
| 243 } | 242 } |
| 244 | 243 |
| 245 | 244 class FilesProxy |
| 246 class FilesProxy extends bindings.Proxy | 245 extends bindings.Proxy |
| 247 implements Files { | 246 implements Files { |
| 248 FilesProxy.fromEndpoint( | 247 FilesProxy.fromEndpoint( |
| 249 core.MojoMessagePipeEndpoint endpoint) | 248 core.MojoMessagePipeEndpoint endpoint) |
| 250 : super(new _FilesProxyControl.fromEndpoint(endpoint)); | 249 : super(new _FilesProxyControl.fromEndpoint(endpoint)); |
| 251 | 250 |
| 252 FilesProxy.fromHandle(core.MojoHandle handle) | 251 FilesProxy.fromHandle(core.MojoHandle handle) |
| 253 : super(new _FilesProxyControl.fromHandle(handle)); | 252 : super(new _FilesProxyControl.fromHandle(handle)); |
| 254 | 253 |
| 255 FilesProxy.unbound() | 254 FilesProxy.unbound() |
| 256 : super(new _FilesProxyControl.unbound()); | 255 : super(new _FilesProxyControl.unbound()); |
| 257 | 256 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 274 params.fileSystem = fileSystem; | 273 params.fileSystem = fileSystem; |
| 275 params.directory = directory; | 274 params.directory = directory; |
| 276 return ctrl.sendMessageWithRequestId( | 275 return ctrl.sendMessageWithRequestId( |
| 277 params, | 276 params, |
| 278 _filesMethodOpenFileSystemName, | 277 _filesMethodOpenFileSystemName, |
| 279 -1, | 278 -1, |
| 280 bindings.MessageHeader.kMessageExpectsResponse); | 279 bindings.MessageHeader.kMessageExpectsResponse); |
| 281 } | 280 } |
| 282 } | 281 } |
| 283 | 282 |
| 284 | 283 class _FilesStubControl |
| 285 class FilesStub extends bindings.Stub { | 284 extends bindings.StubMessageHandler |
| 285 implements bindings.StubControl<Files> { |
| 286 Files _impl; | 286 Files _impl; |
| 287 | 287 |
| 288 FilesStub.fromEndpoint( | 288 _FilesStubControl.fromEndpoint( |
| 289 core.MojoMessagePipeEndpoint endpoint, [Files impl]) | 289 core.MojoMessagePipeEndpoint endpoint, [Files impl]) |
| 290 : super.fromEndpoint(endpoint, autoBegin: impl != null) { | 290 : super.fromEndpoint(endpoint, autoBegin: impl != null) { |
| 291 _impl = impl; | 291 _impl = impl; |
| 292 } | 292 } |
| 293 | 293 |
| 294 FilesStub.fromHandle( | 294 _FilesStubControl.fromHandle( |
| 295 core.MojoHandle handle, [Files impl]) | 295 core.MojoHandle handle, [Files impl]) |
| 296 : super.fromHandle(handle, autoBegin: impl != null) { | 296 : super.fromHandle(handle, autoBegin: impl != null) { |
| 297 _impl = impl; | 297 _impl = impl; |
| 298 } | 298 } |
| 299 | 299 |
| 300 FilesStub.unbound([this._impl]) : super.unbound(); | 300 _FilesStubControl.unbound([this._impl]) : super.unbound(); |
| 301 | |
| 302 static FilesStub newFromEndpoint( | |
| 303 core.MojoMessagePipeEndpoint endpoint) { | |
| 304 assert(endpoint.setDescription("For FilesStub")); | |
| 305 return new FilesStub.fromEndpoint(endpoint); | |
| 306 } | |
| 307 | 301 |
| 308 | 302 |
| 309 FilesOpenFileSystemResponseParams _filesOpenFileSystemResponseParamsFactory(ty
pes_mojom.Error error) { | 303 FilesOpenFileSystemResponseParams _filesOpenFileSystemResponseParamsFactory(ty
pes_mojom.Error error) { |
| 310 var result = new FilesOpenFileSystemResponseParams(); | 304 var result = new FilesOpenFileSystemResponseParams(); |
| 311 result.error = error; | 305 result.error = error; |
| 312 return result; | 306 return result; |
| 313 } | 307 } |
| 314 | 308 |
| 315 dynamic handleMessage(bindings.ServiceMessage message) { | 309 dynamic handleMessage(bindings.ServiceMessage message) { |
| 316 if (bindings.ControlMessageHandler.isControlMessage(message)) { | 310 if (bindings.ControlMessageHandler.isControlMessage(message)) { |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 363 } | 357 } |
| 364 | 358 |
| 365 @override | 359 @override |
| 366 void bind(core.MojoMessagePipeEndpoint endpoint) { | 360 void bind(core.MojoMessagePipeEndpoint endpoint) { |
| 367 super.bind(endpoint); | 361 super.bind(endpoint); |
| 368 if (!isOpen && (_impl != null)) { | 362 if (!isOpen && (_impl != null)) { |
| 369 beginHandlingEvents(); | 363 beginHandlingEvents(); |
| 370 } | 364 } |
| 371 } | 365 } |
| 372 | 366 |
| 367 @override |
| 373 String toString() { | 368 String toString() { |
| 374 var superString = super.toString(); | 369 var superString = super.toString(); |
| 375 return "FilesStub($superString)"; | 370 return "_FilesStubControl($superString)"; |
| 376 } | 371 } |
| 377 | 372 |
| 378 int get version => 0; | 373 int get version => 0; |
| 379 | 374 |
| 380 static service_describer.ServiceDescription _cachedServiceDescription; | 375 static service_describer.ServiceDescription _cachedServiceDescription; |
| 381 static service_describer.ServiceDescription get serviceDescription { | 376 static service_describer.ServiceDescription get serviceDescription { |
| 382 if (_cachedServiceDescription == null) { | 377 if (_cachedServiceDescription == null) { |
| 383 _cachedServiceDescription = new _FilesServiceDescription(); | 378 _cachedServiceDescription = new _FilesServiceDescription(); |
| 384 } | 379 } |
| 385 return _cachedServiceDescription; | 380 return _cachedServiceDescription; |
| 386 } | 381 } |
| 387 } | 382 } |
| 388 | 383 |
| 384 class FilesStub |
| 385 extends bindings.Stub<Files> |
| 386 implements Files { |
| 387 FilesStub.fromEndpoint( |
| 388 core.MojoMessagePipeEndpoint endpoint, [Files impl]) |
| 389 : super(new _FilesStubControl.fromEndpoint(endpoint, impl)); |
| 390 |
| 391 FilesStub.fromHandle( |
| 392 core.MojoHandle handle, [Files impl]) |
| 393 : super(new _FilesStubControl.fromHandle(handle, impl)); |
| 394 |
| 395 FilesStub.unbound([Files impl]) |
| 396 : super(new _FilesStubControl.unbound(impl)); |
| 397 |
| 398 static FilesStub newFromEndpoint( |
| 399 core.MojoMessagePipeEndpoint endpoint) { |
| 400 assert(endpoint.setDescription("For FilesStub")); |
| 401 return new FilesStub.fromEndpoint(endpoint); |
| 402 } |
| 403 |
| 404 static service_describer.ServiceDescription get serviceDescription => |
| 405 _FilesStubControl.serviceDescription; |
| 406 |
| 407 |
| 408 dynamic openFileSystem(String fileSystem,Object directory,[Function responseFa
ctory = null]) { |
| 409 return impl.openFileSystem(fileSystem,directory,responseFactory); |
| 410 } |
| 411 } |
| 412 |
| 389 | 413 |
| 390 | 414 |
| OLD | NEW |