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 cookie_store_mojom; | 5 library cookie_store_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 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 dynamic getAllTypeDefinitions([Function responseFactory]) => | 324 dynamic getAllTypeDefinitions([Function responseFactory]) => |
325 responseFactory(null); | 325 responseFactory(null); |
326 } | 326 } |
327 | 327 |
328 abstract class CookieStore { | 328 abstract class CookieStore { |
329 static const String serviceName = null; | 329 static const String serviceName = null; |
330 dynamic get(String url,[Function responseFactory = null]); | 330 dynamic get(String url,[Function responseFactory = null]); |
331 dynamic set(String url,String cookie,[Function responseFactory = null]); | 331 dynamic set(String url,String cookie,[Function responseFactory = null]); |
332 } | 332 } |
333 | 333 |
334 | 334 class _CookieStoreProxyControl |
335 class _CookieStoreProxyControl extends bindings.ProxyMessageHandler | 335 extends bindings.ProxyMessageHandler |
336 implements bindings.ProxyControl { | 336 implements bindings.ProxyControl { |
337 _CookieStoreProxyControl.fromEndpoint( | 337 _CookieStoreProxyControl.fromEndpoint( |
338 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); | 338 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); |
339 | 339 |
340 _CookieStoreProxyControl.fromHandle( | 340 _CookieStoreProxyControl.fromHandle( |
341 core.MojoHandle handle) : super.fromHandle(handle); | 341 core.MojoHandle handle) : super.fromHandle(handle); |
342 | 342 |
343 _CookieStoreProxyControl.unbound() : super.unbound(); | 343 _CookieStoreProxyControl.unbound() : super.unbound(); |
344 | 344 |
345 service_describer.ServiceDescription get serviceDescription => | 345 service_describer.ServiceDescription get serviceDescription => |
346 new _CookieStoreServiceDescription(); | 346 new _CookieStoreServiceDescription(); |
347 | 347 |
348 String get serviceName => CookieStore.serviceName; | 348 String get serviceName => CookieStore.serviceName; |
349 | 349 |
350 @override | |
351 void handleResponse(bindings.ServiceMessage message) { | 350 void handleResponse(bindings.ServiceMessage message) { |
352 switch (message.header.type) { | 351 switch (message.header.type) { |
353 case _cookieStoreMethodGetName: | 352 case _cookieStoreMethodGetName: |
354 var r = CookieStoreGetResponseParams.deserialize( | 353 var r = CookieStoreGetResponseParams.deserialize( |
355 message.payload); | 354 message.payload); |
356 if (!message.header.hasRequestId) { | 355 if (!message.header.hasRequestId) { |
357 proxyError("Expected a message with a valid request Id."); | 356 proxyError("Expected a message with a valid request Id."); |
358 return; | 357 return; |
359 } | 358 } |
360 Completer c = completerMap[message.header.requestId]; | 359 Completer c = completerMap[message.header.requestId]; |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
397 } | 396 } |
398 } | 397 } |
399 | 398 |
400 @override | 399 @override |
401 String toString() { | 400 String toString() { |
402 var superString = super.toString(); | 401 var superString = super.toString(); |
403 return "_CookieStoreProxyControl($superString)"; | 402 return "_CookieStoreProxyControl($superString)"; |
404 } | 403 } |
405 } | 404 } |
406 | 405 |
407 | 406 class CookieStoreProxy |
408 class CookieStoreProxy extends bindings.Proxy | 407 extends bindings.Proxy |
409 implements CookieStore { | 408 implements CookieStore { |
410 CookieStoreProxy.fromEndpoint( | 409 CookieStoreProxy.fromEndpoint( |
411 core.MojoMessagePipeEndpoint endpoint) | 410 core.MojoMessagePipeEndpoint endpoint) |
412 : super(new _CookieStoreProxyControl.fromEndpoint(endpoint)); | 411 : super(new _CookieStoreProxyControl.fromEndpoint(endpoint)); |
413 | 412 |
414 CookieStoreProxy.fromHandle(core.MojoHandle handle) | 413 CookieStoreProxy.fromHandle(core.MojoHandle handle) |
415 : super(new _CookieStoreProxyControl.fromHandle(handle)); | 414 : super(new _CookieStoreProxyControl.fromHandle(handle)); |
416 | 415 |
417 CookieStoreProxy.unbound() | 416 CookieStoreProxy.unbound() |
418 : super(new _CookieStoreProxyControl.unbound()); | 417 : super(new _CookieStoreProxyControl.unbound()); |
419 | 418 |
(...skipping 25 matching lines...) Expand all Loading... |
445 params.url = url; | 444 params.url = url; |
446 params.cookie = cookie; | 445 params.cookie = cookie; |
447 return ctrl.sendMessageWithRequestId( | 446 return ctrl.sendMessageWithRequestId( |
448 params, | 447 params, |
449 _cookieStoreMethodSetName, | 448 _cookieStoreMethodSetName, |
450 -1, | 449 -1, |
451 bindings.MessageHeader.kMessageExpectsResponse); | 450 bindings.MessageHeader.kMessageExpectsResponse); |
452 } | 451 } |
453 } | 452 } |
454 | 453 |
455 | 454 class _CookieStoreStubControl |
456 class CookieStoreStub extends bindings.Stub { | 455 extends bindings.StubMessageHandler |
| 456 implements bindings.StubControl<CookieStore> { |
457 CookieStore _impl; | 457 CookieStore _impl; |
458 | 458 |
459 CookieStoreStub.fromEndpoint( | 459 _CookieStoreStubControl.fromEndpoint( |
460 core.MojoMessagePipeEndpoint endpoint, [CookieStore impl]) | 460 core.MojoMessagePipeEndpoint endpoint, [CookieStore impl]) |
461 : super.fromEndpoint(endpoint, autoBegin: impl != null) { | 461 : super.fromEndpoint(endpoint, autoBegin: impl != null) { |
462 _impl = impl; | 462 _impl = impl; |
463 } | 463 } |
464 | 464 |
465 CookieStoreStub.fromHandle( | 465 _CookieStoreStubControl.fromHandle( |
466 core.MojoHandle handle, [CookieStore impl]) | 466 core.MojoHandle handle, [CookieStore impl]) |
467 : super.fromHandle(handle, autoBegin: impl != null) { | 467 : super.fromHandle(handle, autoBegin: impl != null) { |
468 _impl = impl; | 468 _impl = impl; |
469 } | 469 } |
470 | 470 |
471 CookieStoreStub.unbound([this._impl]) : super.unbound(); | 471 _CookieStoreStubControl.unbound([this._impl]) : super.unbound(); |
472 | |
473 static CookieStoreStub newFromEndpoint( | |
474 core.MojoMessagePipeEndpoint endpoint) { | |
475 assert(endpoint.setDescription("For CookieStoreStub")); | |
476 return new CookieStoreStub.fromEndpoint(endpoint); | |
477 } | |
478 | 472 |
479 | 473 |
480 CookieStoreGetResponseParams _cookieStoreGetResponseParamsFactory(String cooki
es) { | 474 CookieStoreGetResponseParams _cookieStoreGetResponseParamsFactory(String cooki
es) { |
481 var result = new CookieStoreGetResponseParams(); | 475 var result = new CookieStoreGetResponseParams(); |
482 result.cookies = cookies; | 476 result.cookies = cookies; |
483 return result; | 477 return result; |
484 } | 478 } |
485 CookieStoreSetResponseParams _cookieStoreSetResponseParamsFactory(bool success
) { | 479 CookieStoreSetResponseParams _cookieStoreSetResponseParamsFactory(bool success
) { |
486 var result = new CookieStoreSetResponseParams(); | 480 var result = new CookieStoreSetResponseParams(); |
487 result.success = success; | 481 result.success = success; |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
561 } | 555 } |
562 | 556 |
563 @override | 557 @override |
564 void bind(core.MojoMessagePipeEndpoint endpoint) { | 558 void bind(core.MojoMessagePipeEndpoint endpoint) { |
565 super.bind(endpoint); | 559 super.bind(endpoint); |
566 if (!isOpen && (_impl != null)) { | 560 if (!isOpen && (_impl != null)) { |
567 beginHandlingEvents(); | 561 beginHandlingEvents(); |
568 } | 562 } |
569 } | 563 } |
570 | 564 |
| 565 @override |
571 String toString() { | 566 String toString() { |
572 var superString = super.toString(); | 567 var superString = super.toString(); |
573 return "CookieStoreStub($superString)"; | 568 return "_CookieStoreStubControl($superString)"; |
574 } | 569 } |
575 | 570 |
576 int get version => 0; | 571 int get version => 0; |
577 | 572 |
578 static service_describer.ServiceDescription _cachedServiceDescription; | 573 static service_describer.ServiceDescription _cachedServiceDescription; |
579 static service_describer.ServiceDescription get serviceDescription { | 574 static service_describer.ServiceDescription get serviceDescription { |
580 if (_cachedServiceDescription == null) { | 575 if (_cachedServiceDescription == null) { |
581 _cachedServiceDescription = new _CookieStoreServiceDescription(); | 576 _cachedServiceDescription = new _CookieStoreServiceDescription(); |
582 } | 577 } |
583 return _cachedServiceDescription; | 578 return _cachedServiceDescription; |
584 } | 579 } |
585 } | 580 } |
586 | 581 |
| 582 class CookieStoreStub |
| 583 extends bindings.Stub<CookieStore> |
| 584 implements CookieStore { |
| 585 CookieStoreStub.fromEndpoint( |
| 586 core.MojoMessagePipeEndpoint endpoint, [CookieStore impl]) |
| 587 : super(new _CookieStoreStubControl.fromEndpoint(endpoint, impl)); |
| 588 |
| 589 CookieStoreStub.fromHandle( |
| 590 core.MojoHandle handle, [CookieStore impl]) |
| 591 : super(new _CookieStoreStubControl.fromHandle(handle, impl)); |
| 592 |
| 593 CookieStoreStub.unbound([CookieStore impl]) |
| 594 : super(new _CookieStoreStubControl.unbound(impl)); |
| 595 |
| 596 static CookieStoreStub newFromEndpoint( |
| 597 core.MojoMessagePipeEndpoint endpoint) { |
| 598 assert(endpoint.setDescription("For CookieStoreStub")); |
| 599 return new CookieStoreStub.fromEndpoint(endpoint); |
| 600 } |
| 601 |
| 602 static service_describer.ServiceDescription get serviceDescription => |
| 603 _CookieStoreStubControl.serviceDescription; |
| 604 |
| 605 |
| 606 dynamic get(String url,[Function responseFactory = null]) { |
| 607 return impl.get(url,responseFactory); |
| 608 } |
| 609 dynamic set(String url,String cookie,[Function responseFactory = null]) { |
| 610 return impl.set(url,cookie,responseFactory); |
| 611 } |
| 612 } |
| 613 |
587 | 614 |
588 | 615 |
OLD | NEW |