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 url_loader_mojom; | 5 library url_loader_mojom; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 | 8 |
9 import 'package:mojo/bindings.dart' as bindings; | 9 import 'package:mojo/bindings.dart' as bindings; |
10 import 'package:mojo/core.dart' as core; | 10 import 'package:mojo/core.dart' as core; |
| 11 import 'package:mojo/mojo/bindings/types/mojom_types.mojom.dart' as mojom_types; |
| 12 import 'package:mojo/mojo/bindings/types/service_describer.mojom.dart' as servic
e_describer; |
11 import 'package:mojo/mojo/network_error.mojom.dart' as network_error_mojom; | 13 import 'package:mojo/mojo/network_error.mojom.dart' as network_error_mojom; |
12 import 'package:mojo/mojo/url_request.mojom.dart' as url_request_mojom; | 14 import 'package:mojo/mojo/url_request.mojom.dart' as url_request_mojom; |
13 import 'package:mojo/mojo/url_response.mojom.dart' as url_response_mojom; | 15 import 'package:mojo/mojo/url_response.mojom.dart' as url_response_mojom; |
14 | 16 |
15 | 17 |
16 | 18 |
17 class UrlLoaderStatus extends bindings.Struct { | 19 class UrlLoaderStatus extends bindings.Struct { |
18 static const List<bindings.StructDataHeader> kVersions = const [ | 20 static const List<bindings.StructDataHeader> kVersions = const [ |
19 const bindings.StructDataHeader(24, 0) | 21 const bindings.StructDataHeader(24, 0) |
20 ]; | 22 ]; |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 | 86 |
85 Map toJson() { | 87 Map toJson() { |
86 Map map = new Map(); | 88 Map map = new Map(); |
87 map["error"] = error; | 89 map["error"] = error; |
88 map["isLoading"] = isLoading; | 90 map["isLoading"] = isLoading; |
89 return map; | 91 return map; |
90 } | 92 } |
91 } | 93 } |
92 | 94 |
93 | 95 |
| 96 |
| 97 |
94 class _UrlLoaderStartParams extends bindings.Struct { | 98 class _UrlLoaderStartParams extends bindings.Struct { |
95 static const List<bindings.StructDataHeader> kVersions = const [ | 99 static const List<bindings.StructDataHeader> kVersions = const [ |
96 const bindings.StructDataHeader(16, 0) | 100 const bindings.StructDataHeader(16, 0) |
97 ]; | 101 ]; |
98 url_request_mojom.UrlRequest request = null; | 102 url_request_mojom.UrlRequest request = null; |
99 | 103 |
100 _UrlLoaderStartParams() : super(kVersions.last.size); | 104 _UrlLoaderStartParams() : super(kVersions.last.size); |
101 | 105 |
102 static _UrlLoaderStartParams deserialize(bindings.Message message) { | 106 static _UrlLoaderStartParams deserialize(bindings.Message message) { |
103 var decoder = new bindings.Decoder(message); | 107 var decoder = new bindings.Decoder(message); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 "request: $request" ")"; | 155 "request: $request" ")"; |
152 } | 156 } |
153 | 157 |
154 Map toJson() { | 158 Map toJson() { |
155 throw new bindings.MojoCodecError( | 159 throw new bindings.MojoCodecError( |
156 'Object containing handles cannot be encoded to JSON.'); | 160 'Object containing handles cannot be encoded to JSON.'); |
157 } | 161 } |
158 } | 162 } |
159 | 163 |
160 | 164 |
| 165 |
| 166 |
161 class UrlLoaderStartResponseParams extends bindings.Struct { | 167 class UrlLoaderStartResponseParams extends bindings.Struct { |
162 static const List<bindings.StructDataHeader> kVersions = const [ | 168 static const List<bindings.StructDataHeader> kVersions = const [ |
163 const bindings.StructDataHeader(16, 0) | 169 const bindings.StructDataHeader(16, 0) |
164 ]; | 170 ]; |
165 url_response_mojom.UrlResponse response = null; | 171 url_response_mojom.UrlResponse response = null; |
166 | 172 |
167 UrlLoaderStartResponseParams() : super(kVersions.last.size); | 173 UrlLoaderStartResponseParams() : super(kVersions.last.size); |
168 | 174 |
169 static UrlLoaderStartResponseParams deserialize(bindings.Message message) { | 175 static UrlLoaderStartResponseParams deserialize(bindings.Message message) { |
170 var decoder = new bindings.Decoder(message); | 176 var decoder = new bindings.Decoder(message); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 "response: $response" ")"; | 224 "response: $response" ")"; |
219 } | 225 } |
220 | 226 |
221 Map toJson() { | 227 Map toJson() { |
222 throw new bindings.MojoCodecError( | 228 throw new bindings.MojoCodecError( |
223 'Object containing handles cannot be encoded to JSON.'); | 229 'Object containing handles cannot be encoded to JSON.'); |
224 } | 230 } |
225 } | 231 } |
226 | 232 |
227 | 233 |
| 234 |
| 235 |
228 class _UrlLoaderFollowRedirectParams extends bindings.Struct { | 236 class _UrlLoaderFollowRedirectParams extends bindings.Struct { |
229 static const List<bindings.StructDataHeader> kVersions = const [ | 237 static const List<bindings.StructDataHeader> kVersions = const [ |
230 const bindings.StructDataHeader(8, 0) | 238 const bindings.StructDataHeader(8, 0) |
231 ]; | 239 ]; |
232 | 240 |
233 _UrlLoaderFollowRedirectParams() : super(kVersions.last.size); | 241 _UrlLoaderFollowRedirectParams() : super(kVersions.last.size); |
234 | 242 |
235 static _UrlLoaderFollowRedirectParams deserialize(bindings.Message message) { | 243 static _UrlLoaderFollowRedirectParams deserialize(bindings.Message message) { |
236 var decoder = new bindings.Decoder(message); | 244 var decoder = new bindings.Decoder(message); |
237 var result = decode(decoder); | 245 var result = decode(decoder); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 return "_UrlLoaderFollowRedirectParams("")"; | 284 return "_UrlLoaderFollowRedirectParams("")"; |
277 } | 285 } |
278 | 286 |
279 Map toJson() { | 287 Map toJson() { |
280 Map map = new Map(); | 288 Map map = new Map(); |
281 return map; | 289 return map; |
282 } | 290 } |
283 } | 291 } |
284 | 292 |
285 | 293 |
| 294 |
| 295 |
286 class UrlLoaderFollowRedirectResponseParams extends bindings.Struct { | 296 class UrlLoaderFollowRedirectResponseParams extends bindings.Struct { |
287 static const List<bindings.StructDataHeader> kVersions = const [ | 297 static const List<bindings.StructDataHeader> kVersions = const [ |
288 const bindings.StructDataHeader(16, 0) | 298 const bindings.StructDataHeader(16, 0) |
289 ]; | 299 ]; |
290 url_response_mojom.UrlResponse response = null; | 300 url_response_mojom.UrlResponse response = null; |
291 | 301 |
292 UrlLoaderFollowRedirectResponseParams() : super(kVersions.last.size); | 302 UrlLoaderFollowRedirectResponseParams() : super(kVersions.last.size); |
293 | 303 |
294 static UrlLoaderFollowRedirectResponseParams deserialize(bindings.Message mess
age) { | 304 static UrlLoaderFollowRedirectResponseParams deserialize(bindings.Message mess
age) { |
295 var decoder = new bindings.Decoder(message); | 305 var decoder = new bindings.Decoder(message); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
343 "response: $response" ")"; | 353 "response: $response" ")"; |
344 } | 354 } |
345 | 355 |
346 Map toJson() { | 356 Map toJson() { |
347 throw new bindings.MojoCodecError( | 357 throw new bindings.MojoCodecError( |
348 'Object containing handles cannot be encoded to JSON.'); | 358 'Object containing handles cannot be encoded to JSON.'); |
349 } | 359 } |
350 } | 360 } |
351 | 361 |
352 | 362 |
| 363 |
| 364 |
353 class _UrlLoaderQueryStatusParams extends bindings.Struct { | 365 class _UrlLoaderQueryStatusParams extends bindings.Struct { |
354 static const List<bindings.StructDataHeader> kVersions = const [ | 366 static const List<bindings.StructDataHeader> kVersions = const [ |
355 const bindings.StructDataHeader(8, 0) | 367 const bindings.StructDataHeader(8, 0) |
356 ]; | 368 ]; |
357 | 369 |
358 _UrlLoaderQueryStatusParams() : super(kVersions.last.size); | 370 _UrlLoaderQueryStatusParams() : super(kVersions.last.size); |
359 | 371 |
360 static _UrlLoaderQueryStatusParams deserialize(bindings.Message message) { | 372 static _UrlLoaderQueryStatusParams deserialize(bindings.Message message) { |
361 var decoder = new bindings.Decoder(message); | 373 var decoder = new bindings.Decoder(message); |
362 var result = decode(decoder); | 374 var result = decode(decoder); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
401 return "_UrlLoaderQueryStatusParams("")"; | 413 return "_UrlLoaderQueryStatusParams("")"; |
402 } | 414 } |
403 | 415 |
404 Map toJson() { | 416 Map toJson() { |
405 Map map = new Map(); | 417 Map map = new Map(); |
406 return map; | 418 return map; |
407 } | 419 } |
408 } | 420 } |
409 | 421 |
410 | 422 |
| 423 |
| 424 |
411 class UrlLoaderQueryStatusResponseParams extends bindings.Struct { | 425 class UrlLoaderQueryStatusResponseParams extends bindings.Struct { |
412 static const List<bindings.StructDataHeader> kVersions = const [ | 426 static const List<bindings.StructDataHeader> kVersions = const [ |
413 const bindings.StructDataHeader(16, 0) | 427 const bindings.StructDataHeader(16, 0) |
414 ]; | 428 ]; |
415 UrlLoaderStatus status = null; | 429 UrlLoaderStatus status = null; |
416 | 430 |
417 UrlLoaderQueryStatusResponseParams() : super(kVersions.last.size); | 431 UrlLoaderQueryStatusResponseParams() : super(kVersions.last.size); |
418 | 432 |
419 static UrlLoaderQueryStatusResponseParams deserialize(bindings.Message message
) { | 433 static UrlLoaderQueryStatusResponseParams deserialize(bindings.Message message
) { |
420 var decoder = new bindings.Decoder(message); | 434 var decoder = new bindings.Decoder(message); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
468 "status: $status" ")"; | 482 "status: $status" ")"; |
469 } | 483 } |
470 | 484 |
471 Map toJson() { | 485 Map toJson() { |
472 Map map = new Map(); | 486 Map map = new Map(); |
473 map["status"] = status; | 487 map["status"] = status; |
474 return map; | 488 return map; |
475 } | 489 } |
476 } | 490 } |
477 | 491 |
| 492 |
| 493 |
| 494 |
478 const int _UrlLoader_startName = 0; | 495 const int _UrlLoader_startName = 0; |
479 const int _UrlLoader_followRedirectName = 1; | 496 const int _UrlLoader_followRedirectName = 1; |
480 const int _UrlLoader_queryStatusName = 2; | 497 const int _UrlLoader_queryStatusName = 2; |
481 | 498 |
| 499 |
| 500 |
| 501 class _UrlLoaderServiceDescription implements service_describer.ServiceDescripti
on { |
| 502 dynamic getTopLevelInterface([Function responseFactory]) => null; |
| 503 |
| 504 dynamic getTypeDefinition(String typeKey, [Function responseFactory]) => null; |
| 505 |
| 506 dynamic getAllTypeDefinitions([Function responseFactory]) => null; |
| 507 } |
| 508 |
482 abstract class UrlLoader { | 509 abstract class UrlLoader { |
483 static const String serviceName = null; | 510 static const String serviceName = null; |
484 dynamic start(url_request_mojom.UrlRequest request,[Function responseFactory =
null]); | 511 dynamic start(url_request_mojom.UrlRequest request,[Function responseFactory =
null]); |
485 dynamic followRedirect([Function responseFactory = null]); | 512 dynamic followRedirect([Function responseFactory = null]); |
486 dynamic queryStatus([Function responseFactory = null]); | 513 dynamic queryStatus([Function responseFactory = null]); |
487 } | 514 } |
488 | 515 |
489 | 516 |
490 class _UrlLoaderProxyImpl extends bindings.Proxy { | 517 class _UrlLoaderProxyImpl extends bindings.Proxy { |
491 _UrlLoaderProxyImpl.fromEndpoint( | 518 _UrlLoaderProxyImpl.fromEndpoint( |
492 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); | 519 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); |
493 | 520 |
494 _UrlLoaderProxyImpl.fromHandle(core.MojoHandle handle) : | 521 _UrlLoaderProxyImpl.fromHandle(core.MojoHandle handle) : |
495 super.fromHandle(handle); | 522 super.fromHandle(handle); |
496 | 523 |
497 _UrlLoaderProxyImpl.unbound() : super.unbound(); | 524 _UrlLoaderProxyImpl.unbound() : super.unbound(); |
498 | 525 |
499 static _UrlLoaderProxyImpl newFromEndpoint( | 526 static _UrlLoaderProxyImpl newFromEndpoint( |
500 core.MojoMessagePipeEndpoint endpoint) { | 527 core.MojoMessagePipeEndpoint endpoint) { |
501 assert(endpoint.setDescription("For _UrlLoaderProxyImpl")); | 528 assert(endpoint.setDescription("For _UrlLoaderProxyImpl")); |
502 return new _UrlLoaderProxyImpl.fromEndpoint(endpoint); | 529 return new _UrlLoaderProxyImpl.fromEndpoint(endpoint); |
503 } | 530 } |
504 | 531 |
| 532 service_describer.ServiceDescription get serviceDescription => |
| 533 new _UrlLoaderServiceDescription(); |
| 534 |
505 void handleResponse(bindings.ServiceMessage message) { | 535 void handleResponse(bindings.ServiceMessage message) { |
506 switch (message.header.type) { | 536 switch (message.header.type) { |
507 case _UrlLoader_startName: | 537 case _UrlLoader_startName: |
508 var r = UrlLoaderStartResponseParams.deserialize( | 538 var r = UrlLoaderStartResponseParams.deserialize( |
509 message.payload); | 539 message.payload); |
510 if (!message.header.hasRequestId) { | 540 if (!message.header.hasRequestId) { |
511 proxyError("Expected a message with a valid request Id."); | 541 proxyError("Expected a message with a valid request Id."); |
512 return; | 542 return; |
513 } | 543 } |
514 Completer c = completerMap[message.header.requestId]; | 544 Completer c = completerMap[message.header.requestId]; |
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
790 assert(_impl == null); | 820 assert(_impl == null); |
791 _impl = d; | 821 _impl = d; |
792 } | 822 } |
793 | 823 |
794 String toString() { | 824 String toString() { |
795 var superString = super.toString(); | 825 var superString = super.toString(); |
796 return "UrlLoaderStub($superString)"; | 826 return "UrlLoaderStub($superString)"; |
797 } | 827 } |
798 | 828 |
799 int get version => 0; | 829 int get version => 0; |
| 830 |
| 831 service_describer.ServiceDescription get serviceDescription => |
| 832 new _UrlLoaderServiceDescription(); |
800 } | 833 } |
801 | 834 |
802 | 835 |
| 836 |
OLD | NEW |