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 | 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 | 13 |
12 | 14 |
13 | 15 |
14 class _CookieStoreGetParams extends bindings.Struct { | 16 class _CookieStoreGetParams extends bindings.Struct { |
15 static const List<bindings.StructDataHeader> kVersions = const [ | 17 static const List<bindings.StructDataHeader> kVersions = const [ |
16 const bindings.StructDataHeader(16, 0) | 18 const bindings.StructDataHeader(16, 0) |
17 ]; | 19 ]; |
18 String url = null; | 20 String url = null; |
19 | 21 |
20 _CookieStoreGetParams() : super(kVersions.last.size); | 22 _CookieStoreGetParams() : super(kVersions.last.size); |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 } | 73 } |
72 | 74 |
73 Map toJson() { | 75 Map toJson() { |
74 Map map = new Map(); | 76 Map map = new Map(); |
75 map["url"] = url; | 77 map["url"] = url; |
76 return map; | 78 return map; |
77 } | 79 } |
78 } | 80 } |
79 | 81 |
80 | 82 |
| 83 |
| 84 |
81 class CookieStoreGetResponseParams extends bindings.Struct { | 85 class CookieStoreGetResponseParams extends bindings.Struct { |
82 static const List<bindings.StructDataHeader> kVersions = const [ | 86 static const List<bindings.StructDataHeader> kVersions = const [ |
83 const bindings.StructDataHeader(16, 0) | 87 const bindings.StructDataHeader(16, 0) |
84 ]; | 88 ]; |
85 String cookies = null; | 89 String cookies = null; |
86 | 90 |
87 CookieStoreGetResponseParams() : super(kVersions.last.size); | 91 CookieStoreGetResponseParams() : super(kVersions.last.size); |
88 | 92 |
89 static CookieStoreGetResponseParams deserialize(bindings.Message message) { | 93 static CookieStoreGetResponseParams deserialize(bindings.Message message) { |
90 var decoder = new bindings.Decoder(message); | 94 var decoder = new bindings.Decoder(message); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 } | 142 } |
139 | 143 |
140 Map toJson() { | 144 Map toJson() { |
141 Map map = new Map(); | 145 Map map = new Map(); |
142 map["cookies"] = cookies; | 146 map["cookies"] = cookies; |
143 return map; | 147 return map; |
144 } | 148 } |
145 } | 149 } |
146 | 150 |
147 | 151 |
| 152 |
| 153 |
148 class _CookieStoreSetParams extends bindings.Struct { | 154 class _CookieStoreSetParams extends bindings.Struct { |
149 static const List<bindings.StructDataHeader> kVersions = const [ | 155 static const List<bindings.StructDataHeader> kVersions = const [ |
150 const bindings.StructDataHeader(24, 0) | 156 const bindings.StructDataHeader(24, 0) |
151 ]; | 157 ]; |
152 String url = null; | 158 String url = null; |
153 String cookie = null; | 159 String cookie = null; |
154 | 160 |
155 _CookieStoreSetParams() : super(kVersions.last.size); | 161 _CookieStoreSetParams() : super(kVersions.last.size); |
156 | 162 |
157 static _CookieStoreSetParams deserialize(bindings.Message message) { | 163 static _CookieStoreSetParams deserialize(bindings.Message message) { |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 | 220 |
215 Map toJson() { | 221 Map toJson() { |
216 Map map = new Map(); | 222 Map map = new Map(); |
217 map["url"] = url; | 223 map["url"] = url; |
218 map["cookie"] = cookie; | 224 map["cookie"] = cookie; |
219 return map; | 225 return map; |
220 } | 226 } |
221 } | 227 } |
222 | 228 |
223 | 229 |
| 230 |
| 231 |
224 class CookieStoreSetResponseParams extends bindings.Struct { | 232 class CookieStoreSetResponseParams extends bindings.Struct { |
225 static const List<bindings.StructDataHeader> kVersions = const [ | 233 static const List<bindings.StructDataHeader> kVersions = const [ |
226 const bindings.StructDataHeader(16, 0) | 234 const bindings.StructDataHeader(16, 0) |
227 ]; | 235 ]; |
228 bool success = false; | 236 bool success = false; |
229 | 237 |
230 CookieStoreSetResponseParams() : super(kVersions.last.size); | 238 CookieStoreSetResponseParams() : super(kVersions.last.size); |
231 | 239 |
232 static CookieStoreSetResponseParams deserialize(bindings.Message message) { | 240 static CookieStoreSetResponseParams deserialize(bindings.Message message) { |
233 var decoder = new bindings.Decoder(message); | 241 var decoder = new bindings.Decoder(message); |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 "success: $success" ")"; | 288 "success: $success" ")"; |
281 } | 289 } |
282 | 290 |
283 Map toJson() { | 291 Map toJson() { |
284 Map map = new Map(); | 292 Map map = new Map(); |
285 map["success"] = success; | 293 map["success"] = success; |
286 return map; | 294 return map; |
287 } | 295 } |
288 } | 296 } |
289 | 297 |
| 298 |
| 299 |
| 300 |
290 const int _CookieStore_getName = 0; | 301 const int _CookieStore_getName = 0; |
291 const int _CookieStore_setName = 1; | 302 const int _CookieStore_setName = 1; |
292 | 303 |
| 304 |
| 305 |
| 306 class _CookieStoreServiceDescription implements service_describer.ServiceDescrip
tion { |
| 307 dynamic getTopLevelInterface([Function responseFactory]) => null; |
| 308 |
| 309 dynamic getTypeDefinition(String typeKey, [Function responseFactory]) => null; |
| 310 |
| 311 dynamic getAllTypeDefinitions([Function responseFactory]) => null; |
| 312 } |
| 313 |
293 abstract class CookieStore { | 314 abstract class CookieStore { |
294 static const String serviceName = null; | 315 static const String serviceName = null; |
295 dynamic get(String url,[Function responseFactory = null]); | 316 dynamic get(String url,[Function responseFactory = null]); |
296 dynamic set(String url,String cookie,[Function responseFactory = null]); | 317 dynamic set(String url,String cookie,[Function responseFactory = null]); |
297 } | 318 } |
298 | 319 |
299 | 320 |
300 class _CookieStoreProxyImpl extends bindings.Proxy { | 321 class _CookieStoreProxyImpl extends bindings.Proxy { |
301 _CookieStoreProxyImpl.fromEndpoint( | 322 _CookieStoreProxyImpl.fromEndpoint( |
302 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); | 323 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); |
303 | 324 |
304 _CookieStoreProxyImpl.fromHandle(core.MojoHandle handle) : | 325 _CookieStoreProxyImpl.fromHandle(core.MojoHandle handle) : |
305 super.fromHandle(handle); | 326 super.fromHandle(handle); |
306 | 327 |
307 _CookieStoreProxyImpl.unbound() : super.unbound(); | 328 _CookieStoreProxyImpl.unbound() : super.unbound(); |
308 | 329 |
309 static _CookieStoreProxyImpl newFromEndpoint( | 330 static _CookieStoreProxyImpl newFromEndpoint( |
310 core.MojoMessagePipeEndpoint endpoint) { | 331 core.MojoMessagePipeEndpoint endpoint) { |
311 assert(endpoint.setDescription("For _CookieStoreProxyImpl")); | 332 assert(endpoint.setDescription("For _CookieStoreProxyImpl")); |
312 return new _CookieStoreProxyImpl.fromEndpoint(endpoint); | 333 return new _CookieStoreProxyImpl.fromEndpoint(endpoint); |
313 } | 334 } |
314 | 335 |
| 336 service_describer.ServiceDescription get serviceDescription => |
| 337 new _CookieStoreServiceDescription(); |
| 338 |
315 void handleResponse(bindings.ServiceMessage message) { | 339 void handleResponse(bindings.ServiceMessage message) { |
316 switch (message.header.type) { | 340 switch (message.header.type) { |
317 case _CookieStore_getName: | 341 case _CookieStore_getName: |
318 var r = CookieStoreGetResponseParams.deserialize( | 342 var r = CookieStoreGetResponseParams.deserialize( |
319 message.payload); | 343 message.payload); |
320 if (!message.header.hasRequestId) { | 344 if (!message.header.hasRequestId) { |
321 proxyError("Expected a message with a valid request Id."); | 345 proxyError("Expected a message with a valid request Id."); |
322 return; | 346 return; |
323 } | 347 } |
324 Completer c = completerMap[message.header.requestId]; | 348 Completer c = completerMap[message.header.requestId]; |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
547 assert(_impl == null); | 571 assert(_impl == null); |
548 _impl = d; | 572 _impl = d; |
549 } | 573 } |
550 | 574 |
551 String toString() { | 575 String toString() { |
552 var superString = super.toString(); | 576 var superString = super.toString(); |
553 return "CookieStoreStub($superString)"; | 577 return "CookieStoreStub($superString)"; |
554 } | 578 } |
555 | 579 |
556 int get version => 0; | 580 int get version => 0; |
| 581 |
| 582 service_describer.ServiceDescription get serviceDescription => |
| 583 new _CookieStoreServiceDescription(); |
557 } | 584 } |
558 | 585 |
559 | 586 |
| 587 |
OLD | NEW |