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 files_mojom; | 5 library files_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/files/directory.mojom.dart' as directory_mojo
m; | 13 import 'package:mojo_services/mojo/files/directory.mojom.dart' as directory_mojo
m; |
12 import 'package:mojo_services/mojo/files/types.mojom.dart' as types_mojom; | 14 import 'package:mojo_services/mojo/files/types.mojom.dart' as types_mojom; |
13 | 15 |
14 | 16 |
15 | 17 |
16 class _FilesOpenFileSystemParams extends bindings.Struct { | 18 class _FilesOpenFileSystemParams extends bindings.Struct { |
17 static const List<bindings.StructDataHeader> kVersions = const [ | 19 static const List<bindings.StructDataHeader> kVersions = const [ |
18 const bindings.StructDataHeader(24, 0) | 20 const bindings.StructDataHeader(24, 0) |
19 ]; | 21 ]; |
20 String fileSystem = null; | 22 String fileSystem = null; |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 "directory: $directory" ")"; | 82 "directory: $directory" ")"; |
81 } | 83 } |
82 | 84 |
83 Map toJson() { | 85 Map toJson() { |
84 throw new bindings.MojoCodecError( | 86 throw new bindings.MojoCodecError( |
85 'Object containing handles cannot be encoded to JSON.'); | 87 'Object containing handles cannot be encoded to JSON.'); |
86 } | 88 } |
87 } | 89 } |
88 | 90 |
89 | 91 |
| 92 |
| 93 |
90 class FilesOpenFileSystemResponseParams extends bindings.Struct { | 94 class FilesOpenFileSystemResponseParams extends bindings.Struct { |
91 static const List<bindings.StructDataHeader> kVersions = const [ | 95 static const List<bindings.StructDataHeader> kVersions = const [ |
92 const bindings.StructDataHeader(16, 0) | 96 const bindings.StructDataHeader(16, 0) |
93 ]; | 97 ]; |
94 types_mojom.Error error = null; | 98 types_mojom.Error error = null; |
95 | 99 |
96 FilesOpenFileSystemResponseParams() : super(kVersions.last.size); | 100 FilesOpenFileSystemResponseParams() : super(kVersions.last.size); |
97 | 101 |
98 static FilesOpenFileSystemResponseParams deserialize(bindings.Message message)
{ | 102 static FilesOpenFileSystemResponseParams deserialize(bindings.Message message)
{ |
99 var decoder = new bindings.Decoder(message); | 103 var decoder = new bindings.Decoder(message); |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 "error: $error" ")"; | 154 "error: $error" ")"; |
151 } | 155 } |
152 | 156 |
153 Map toJson() { | 157 Map toJson() { |
154 Map map = new Map(); | 158 Map map = new Map(); |
155 map["error"] = error; | 159 map["error"] = error; |
156 return map; | 160 return map; |
157 } | 161 } |
158 } | 162 } |
159 | 163 |
| 164 |
| 165 |
| 166 |
160 const int _Files_openFileSystemName = 0; | 167 const int _Files_openFileSystemName = 0; |
161 | 168 |
| 169 |
| 170 |
| 171 class _FilesServiceDescription implements service_describer.ServiceDescription { |
| 172 dynamic getTopLevelInterface([Function responseFactory]) => null; |
| 173 |
| 174 dynamic getTypeDefinition(String typeKey, [Function responseFactory]) => null; |
| 175 |
| 176 dynamic getAllTypeDefinitions([Function responseFactory]) => null; |
| 177 } |
| 178 |
162 abstract class Files { | 179 abstract class Files { |
163 static const String serviceName = "mojo::files::Files"; | 180 static const String serviceName = "mojo::files::Files"; |
164 dynamic openFileSystem(String fileSystem,Object directory,[Function responseFa
ctory = null]); | 181 dynamic openFileSystem(String fileSystem,Object directory,[Function responseFa
ctory = null]); |
165 } | 182 } |
166 | 183 |
167 | 184 |
168 class _FilesProxyImpl extends bindings.Proxy { | 185 class _FilesProxyImpl extends bindings.Proxy { |
169 _FilesProxyImpl.fromEndpoint( | 186 _FilesProxyImpl.fromEndpoint( |
170 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); | 187 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); |
171 | 188 |
172 _FilesProxyImpl.fromHandle(core.MojoHandle handle) : | 189 _FilesProxyImpl.fromHandle(core.MojoHandle handle) : |
173 super.fromHandle(handle); | 190 super.fromHandle(handle); |
174 | 191 |
175 _FilesProxyImpl.unbound() : super.unbound(); | 192 _FilesProxyImpl.unbound() : super.unbound(); |
176 | 193 |
177 static _FilesProxyImpl newFromEndpoint( | 194 static _FilesProxyImpl newFromEndpoint( |
178 core.MojoMessagePipeEndpoint endpoint) { | 195 core.MojoMessagePipeEndpoint endpoint) { |
179 assert(endpoint.setDescription("For _FilesProxyImpl")); | 196 assert(endpoint.setDescription("For _FilesProxyImpl")); |
180 return new _FilesProxyImpl.fromEndpoint(endpoint); | 197 return new _FilesProxyImpl.fromEndpoint(endpoint); |
181 } | 198 } |
182 | 199 |
| 200 service_describer.ServiceDescription get serviceDescription => |
| 201 new _FilesServiceDescription(); |
| 202 |
183 void handleResponse(bindings.ServiceMessage message) { | 203 void handleResponse(bindings.ServiceMessage message) { |
184 switch (message.header.type) { | 204 switch (message.header.type) { |
185 case _Files_openFileSystemName: | 205 case _Files_openFileSystemName: |
186 var r = FilesOpenFileSystemResponseParams.deserialize( | 206 var r = FilesOpenFileSystemResponseParams.deserialize( |
187 message.payload); | 207 message.payload); |
188 if (!message.header.hasRequestId) { | 208 if (!message.header.hasRequestId) { |
189 proxyError("Expected a message with a valid request Id."); | 209 proxyError("Expected a message with a valid request Id."); |
190 return; | 210 return; |
191 } | 211 } |
192 Completer c = completerMap[message.header.requestId]; | 212 Completer c = completerMap[message.header.requestId]; |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
359 assert(_impl == null); | 379 assert(_impl == null); |
360 _impl = d; | 380 _impl = d; |
361 } | 381 } |
362 | 382 |
363 String toString() { | 383 String toString() { |
364 var superString = super.toString(); | 384 var superString = super.toString(); |
365 return "FilesStub($superString)"; | 385 return "FilesStub($superString)"; |
366 } | 386 } |
367 | 387 |
368 int get version => 0; | 388 int get version => 0; |
| 389 |
| 390 service_describer.ServiceDescription get serviceDescription => |
| 391 new _FilesServiceDescription(); |
369 } | 392 } |
370 | 393 |
371 | 394 |
| 395 |
OLD | NEW |