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 view_manager_mojom; | 5 library view_manager_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_services/mojo/ui/views.mojom.dart' as views_mojom; | 13 import 'package:mojo_services/mojo/ui/views.mojom.dart' as views_mojom; |
12 import 'package:mojo_services/mojo/ui/view_associates.mojom.dart' as view_associ
ates_mojom; | 14 import 'package:mojo_services/mojo/ui/view_associates.mojom.dart' as view_associ
ates_mojom; |
13 import 'package:mojo_services/mojo/ui/view_trees.mojom.dart' as view_trees_mojom
; | 15 import 'package:mojo_services/mojo/ui/view_trees.mojom.dart' as view_trees_mojom
; |
14 const int kLabelMaxLength = 32; | 16 const int kLabelMaxLength = 32; |
15 | 17 |
16 | 18 |
17 | 19 |
18 class _ViewManagerRegisterViewParams extends bindings.Struct { | 20 class _ViewManagerRegisterViewParams extends bindings.Struct { |
19 static const List<bindings.StructDataHeader> kVersions = const [ | 21 static const List<bindings.StructDataHeader> kVersions = const [ |
20 const bindings.StructDataHeader(32, 0) | 22 const bindings.StructDataHeader(32, 0) |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 "label: $label" ")"; | 92 "label: $label" ")"; |
91 } | 93 } |
92 | 94 |
93 Map toJson() { | 95 Map toJson() { |
94 throw new bindings.MojoCodecError( | 96 throw new bindings.MojoCodecError( |
95 'Object containing handles cannot be encoded to JSON.'); | 97 'Object containing handles cannot be encoded to JSON.'); |
96 } | 98 } |
97 } | 99 } |
98 | 100 |
99 | 101 |
| 102 |
| 103 |
100 class ViewManagerRegisterViewResponseParams extends bindings.Struct { | 104 class ViewManagerRegisterViewResponseParams extends bindings.Struct { |
101 static const List<bindings.StructDataHeader> kVersions = const [ | 105 static const List<bindings.StructDataHeader> kVersions = const [ |
102 const bindings.StructDataHeader(16, 0) | 106 const bindings.StructDataHeader(16, 0) |
103 ]; | 107 ]; |
104 views_mojom.ViewToken viewToken = null; | 108 views_mojom.ViewToken viewToken = null; |
105 | 109 |
106 ViewManagerRegisterViewResponseParams() : super(kVersions.last.size); | 110 ViewManagerRegisterViewResponseParams() : super(kVersions.last.size); |
107 | 111 |
108 static ViewManagerRegisterViewResponseParams deserialize(bindings.Message mess
age) { | 112 static ViewManagerRegisterViewResponseParams deserialize(bindings.Message mess
age) { |
109 var decoder = new bindings.Decoder(message); | 113 var decoder = new bindings.Decoder(message); |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 } | 162 } |
159 | 163 |
160 Map toJson() { | 164 Map toJson() { |
161 Map map = new Map(); | 165 Map map = new Map(); |
162 map["viewToken"] = viewToken; | 166 map["viewToken"] = viewToken; |
163 return map; | 167 return map; |
164 } | 168 } |
165 } | 169 } |
166 | 170 |
167 | 171 |
| 172 |
| 173 |
168 class _ViewManagerRegisterViewTreeParams extends bindings.Struct { | 174 class _ViewManagerRegisterViewTreeParams extends bindings.Struct { |
169 static const List<bindings.StructDataHeader> kVersions = const [ | 175 static const List<bindings.StructDataHeader> kVersions = const [ |
170 const bindings.StructDataHeader(32, 0) | 176 const bindings.StructDataHeader(32, 0) |
171 ]; | 177 ]; |
172 Object viewTree = null; | 178 Object viewTree = null; |
173 Object viewTreeHost = null; | 179 Object viewTreeHost = null; |
174 String label = null; | 180 String label = null; |
175 | 181 |
176 _ViewManagerRegisterViewTreeParams() : super(kVersions.last.size); | 182 _ViewManagerRegisterViewTreeParams() : super(kVersions.last.size); |
177 | 183 |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 "label: $label" ")"; | 246 "label: $label" ")"; |
241 } | 247 } |
242 | 248 |
243 Map toJson() { | 249 Map toJson() { |
244 throw new bindings.MojoCodecError( | 250 throw new bindings.MojoCodecError( |
245 'Object containing handles cannot be encoded to JSON.'); | 251 'Object containing handles cannot be encoded to JSON.'); |
246 } | 252 } |
247 } | 253 } |
248 | 254 |
249 | 255 |
| 256 |
| 257 |
250 class ViewManagerRegisterViewTreeResponseParams extends bindings.Struct { | 258 class ViewManagerRegisterViewTreeResponseParams extends bindings.Struct { |
251 static const List<bindings.StructDataHeader> kVersions = const [ | 259 static const List<bindings.StructDataHeader> kVersions = const [ |
252 const bindings.StructDataHeader(16, 0) | 260 const bindings.StructDataHeader(16, 0) |
253 ]; | 261 ]; |
254 view_trees_mojom.ViewTreeToken viewTreeToken = null; | 262 view_trees_mojom.ViewTreeToken viewTreeToken = null; |
255 | 263 |
256 ViewManagerRegisterViewTreeResponseParams() : super(kVersions.last.size); | 264 ViewManagerRegisterViewTreeResponseParams() : super(kVersions.last.size); |
257 | 265 |
258 static ViewManagerRegisterViewTreeResponseParams deserialize(bindings.Message
message) { | 266 static ViewManagerRegisterViewTreeResponseParams deserialize(bindings.Message
message) { |
259 var decoder = new bindings.Decoder(message); | 267 var decoder = new bindings.Decoder(message); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
307 "viewTreeToken: $viewTreeToken" ")"; | 315 "viewTreeToken: $viewTreeToken" ")"; |
308 } | 316 } |
309 | 317 |
310 Map toJson() { | 318 Map toJson() { |
311 Map map = new Map(); | 319 Map map = new Map(); |
312 map["viewTreeToken"] = viewTreeToken; | 320 map["viewTreeToken"] = viewTreeToken; |
313 return map; | 321 return map; |
314 } | 322 } |
315 } | 323 } |
316 | 324 |
| 325 |
| 326 |
| 327 |
317 const int _ViewManager_registerViewName = 0; | 328 const int _ViewManager_registerViewName = 0; |
318 const int _ViewManager_registerViewTreeName = 1; | 329 const int _ViewManager_registerViewTreeName = 1; |
319 | 330 |
| 331 |
| 332 |
| 333 class _ViewManagerServiceDescription implements service_describer.ServiceDescrip
tion { |
| 334 dynamic getTopLevelInterface([Function responseFactory]) => null; |
| 335 |
| 336 dynamic getTypeDefinition(String typeKey, [Function responseFactory]) => null; |
| 337 |
| 338 dynamic getAllTypeDefinitions([Function responseFactory]) => null; |
| 339 } |
| 340 |
320 abstract class ViewManager { | 341 abstract class ViewManager { |
321 static const String serviceName = "mojo::ui::ViewManager"; | 342 static const String serviceName = "mojo::ui::ViewManager"; |
322 dynamic registerView(Object view,Object viewHost,String label,[Function respon
seFactory = null]); | 343 dynamic registerView(Object view,Object viewHost,String label,[Function respon
seFactory = null]); |
323 dynamic registerViewTree(Object viewTree,Object viewTreeHost,String label,[Fun
ction responseFactory = null]); | 344 dynamic registerViewTree(Object viewTree,Object viewTreeHost,String label,[Fun
ction responseFactory = null]); |
324 } | 345 } |
325 | 346 |
326 | 347 |
327 class _ViewManagerProxyImpl extends bindings.Proxy { | 348 class _ViewManagerProxyImpl extends bindings.Proxy { |
328 _ViewManagerProxyImpl.fromEndpoint( | 349 _ViewManagerProxyImpl.fromEndpoint( |
329 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); | 350 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); |
330 | 351 |
331 _ViewManagerProxyImpl.fromHandle(core.MojoHandle handle) : | 352 _ViewManagerProxyImpl.fromHandle(core.MojoHandle handle) : |
332 super.fromHandle(handle); | 353 super.fromHandle(handle); |
333 | 354 |
334 _ViewManagerProxyImpl.unbound() : super.unbound(); | 355 _ViewManagerProxyImpl.unbound() : super.unbound(); |
335 | 356 |
336 static _ViewManagerProxyImpl newFromEndpoint( | 357 static _ViewManagerProxyImpl newFromEndpoint( |
337 core.MojoMessagePipeEndpoint endpoint) { | 358 core.MojoMessagePipeEndpoint endpoint) { |
338 assert(endpoint.setDescription("For _ViewManagerProxyImpl")); | 359 assert(endpoint.setDescription("For _ViewManagerProxyImpl")); |
339 return new _ViewManagerProxyImpl.fromEndpoint(endpoint); | 360 return new _ViewManagerProxyImpl.fromEndpoint(endpoint); |
340 } | 361 } |
341 | 362 |
| 363 service_describer.ServiceDescription get serviceDescription => |
| 364 new _ViewManagerServiceDescription(); |
| 365 |
342 void handleResponse(bindings.ServiceMessage message) { | 366 void handleResponse(bindings.ServiceMessage message) { |
343 switch (message.header.type) { | 367 switch (message.header.type) { |
344 case _ViewManager_registerViewName: | 368 case _ViewManager_registerViewName: |
345 var r = ViewManagerRegisterViewResponseParams.deserialize( | 369 var r = ViewManagerRegisterViewResponseParams.deserialize( |
346 message.payload); | 370 message.payload); |
347 if (!message.header.hasRequestId) { | 371 if (!message.header.hasRequestId) { |
348 proxyError("Expected a message with a valid request Id."); | 372 proxyError("Expected a message with a valid request Id."); |
349 return; | 373 return; |
350 } | 374 } |
351 Completer c = completerMap[message.header.requestId]; | 375 Completer c = completerMap[message.header.requestId]; |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
577 assert(_impl == null); | 601 assert(_impl == null); |
578 _impl = d; | 602 _impl = d; |
579 } | 603 } |
580 | 604 |
581 String toString() { | 605 String toString() { |
582 var superString = super.toString(); | 606 var superString = super.toString(); |
583 return "ViewManagerStub($superString)"; | 607 return "ViewManagerStub($superString)"; |
584 } | 608 } |
585 | 609 |
586 int get version => 0; | 610 int get version => 0; |
| 611 |
| 612 service_describer.ServiceDescription get serviceDescription => |
| 613 new _ViewManagerServiceDescription(); |
587 } | 614 } |
588 | 615 |
589 | 616 |
| 617 |
OLD | NEW |