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 http_request_mojom; | 5 library http_request_mojom; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:collection'; |
8 | 9 |
9 import 'package:mojo/bindings.dart' as bindings; | 10 import 'package:mojo/bindings.dart' as bindings; |
10 import 'package:mojo/core.dart' as core; | 11 import 'package:mojo/core.dart' as core; |
| 12 import 'package:mojo/mojo/bindings/types/mojom_types.mojom.dart' as mojom_types; |
11 | 13 |
12 | 14 |
13 | 15 |
| 16 |
14 class HttpRequest extends bindings.Struct { | 17 class HttpRequest extends bindings.Struct { |
15 static const List<bindings.StructDataHeader> kVersions = const [ | 18 static const List<bindings.StructDataHeader> kVersions = const [ |
16 const bindings.StructDataHeader(40, 0) | 19 const bindings.StructDataHeader(40, 0) |
17 ]; | 20 ]; |
18 String relativeUrl = null; | 21 String relativeUrl = null; |
19 String method = "GET"; | 22 String method = "GET"; |
20 Map<String, String> headers = null; | 23 Map<String, String> headers = null; |
21 core.MojoDataPipeConsumer body = null; | 24 core.MojoDataPipeConsumer body = null; |
22 | 25 |
23 HttpRequest() : super(kVersions.last.size); | 26 HttpRequest() : super(kVersions.last.size); |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 "method: $method" ", " | 151 "method: $method" ", " |
149 "headers: $headers" ", " | 152 "headers: $headers" ", " |
150 "body: $body" ")"; | 153 "body: $body" ")"; |
151 } | 154 } |
152 | 155 |
153 Map toJson() { | 156 Map toJson() { |
154 throw new bindings.MojoCodecError( | 157 throw new bindings.MojoCodecError( |
155 'Object containing handles cannot be encoded to JSON.'); | 158 'Object containing handles cannot be encoded to JSON.'); |
156 } | 159 } |
157 } | 160 } |
| 161 mojom_types.MojomStruct _http_request_HttpRequest__() { |
| 162 return new mojom_types.MojomStruct() |
| 163 ..declData = (new mojom_types.DeclarationData() |
| 164 ..shortName = 'HttpRequest' |
| 165 ..fullIdentifier = 'http_server.HttpRequest') |
| 166 ..fields = <mojom_types.StructField>[ |
| 167 new mojom_types.StructField() |
| 168 ..declData = (new mojom_types.DeclarationData()..shortName = 'RelativeUr
l') |
| 169 ..type = (new mojom_types.Type() |
| 170 ..stringType = (new mojom_types.StringType()..nullable = false)), |
| 171 |
| 172 new mojom_types.StructField() |
| 173 ..declData = (new mojom_types.DeclarationData()..shortName = 'Method') |
| 174 ..type = (new mojom_types.Type() |
| 175 ..stringType = (new mojom_types.StringType()..nullable = false)), |
| 176 |
| 177 new mojom_types.StructField() |
| 178 ..declData = (new mojom_types.DeclarationData()..shortName = 'Headers') |
| 179 ..type = (new mojom_types.Type()..mapType = (new mojom_types.MapType() |
| 180 ..nullable = true |
| 181 |
| 182 ..keyType = (new mojom_types.Type() |
| 183 ..stringType = (new mojom_types.StringType()..nullable = false)) |
| 184 ..valueType = (new mojom_types.Type() |
| 185 ..stringType = (new mojom_types.StringType()..nullable = false)))), |
| 186 |
| 187 new mojom_types.StructField() |
| 188 ..declData = (new mojom_types.DeclarationData()..shortName = 'Body') |
| 189 ..type = (new mojom_types.Type() |
| 190 ..handleType = (new mojom_types.HandleType() |
| 191 ..kind = mojom_types.HandleTypeKind.dataPipeConsumer |
| 192 ..nullable = true)), |
| 193 ]; |
| 194 } |
158 | 195 |
159 | 196 |
| 197 |
| 198 |
| 199 |
| 200 |
| 201 |
| 202 |
| 203 Map<String, mojom_types.UserDefinedType> _initDescriptions() { |
| 204 var map = new HashMap<String, mojom_types.UserDefinedType>(); |
| 205 map["_http_request_HttpRequest__"] = |
| 206 new mojom_types.UserDefinedType() |
| 207 ..structType = _http_request_HttpRequest__(); |
| 208 |
| 209 return map; |
| 210 } |
| 211 |
| 212 var _MojomDesc; |
| 213 Map<String, mojom_types.UserDefinedType> getAllMojomTypeDefinitions() { |
| 214 if (_MojomDesc == null) { |
| 215 _MojomDesc = _initDescriptions(); |
| 216 } |
| 217 return _MojomDesc; |
| 218 } |
| 219 |
OLD | NEW |