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 content_handler_mojom; | 5 library content_handler_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/application.mojom.dart' as application_mojom; | 13 import 'package:mojo/mojo/application.mojom.dart' as application_mojom; |
12 import 'package:mojo/mojo/url_response.mojom.dart' as url_response_mojom; | 14 import 'package:mojo/mojo/url_response.mojom.dart' as url_response_mojom; |
13 | 15 |
14 | 16 |
15 | 17 |
16 class _ContentHandlerStartApplicationParams extends bindings.Struct { | 18 class _ContentHandlerStartApplicationParams 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 Object application = null; | 22 Object application = null; |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 "application: $application" ", " | 82 "application: $application" ", " |
81 "response: $response" ")"; | 83 "response: $response" ")"; |
82 } | 84 } |
83 | 85 |
84 Map toJson() { | 86 Map toJson() { |
85 throw new bindings.MojoCodecError( | 87 throw new bindings.MojoCodecError( |
86 'Object containing handles cannot be encoded to JSON.'); | 88 'Object containing handles cannot be encoded to JSON.'); |
87 } | 89 } |
88 } | 90 } |
89 | 91 |
| 92 |
| 93 |
| 94 |
90 const int _ContentHandler_startApplicationName = 0; | 95 const int _ContentHandler_startApplicationName = 0; |
91 | 96 |
| 97 |
| 98 |
| 99 class _ContentHandlerServiceDescription implements service_describer.ServiceDesc
ription { |
| 100 dynamic getTopLevelInterface([Function responseFactory]) => null; |
| 101 |
| 102 dynamic getTypeDefinition(String typeKey, [Function responseFactory]) => null; |
| 103 |
| 104 dynamic getAllTypeDefinitions([Function responseFactory]) => null; |
| 105 } |
| 106 |
92 abstract class ContentHandler { | 107 abstract class ContentHandler { |
93 static const String serviceName = "mojo::ContentHandler"; | 108 static const String serviceName = "mojo::ContentHandler"; |
94 void startApplication(Object application, url_response_mojom.UrlResponse respo
nse); | 109 void startApplication(Object application, url_response_mojom.UrlResponse respo
nse); |
95 } | 110 } |
96 | 111 |
97 | 112 |
98 class _ContentHandlerProxyImpl extends bindings.Proxy { | 113 class _ContentHandlerProxyImpl extends bindings.Proxy { |
99 _ContentHandlerProxyImpl.fromEndpoint( | 114 _ContentHandlerProxyImpl.fromEndpoint( |
100 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); | 115 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); |
101 | 116 |
102 _ContentHandlerProxyImpl.fromHandle(core.MojoHandle handle) : | 117 _ContentHandlerProxyImpl.fromHandle(core.MojoHandle handle) : |
103 super.fromHandle(handle); | 118 super.fromHandle(handle); |
104 | 119 |
105 _ContentHandlerProxyImpl.unbound() : super.unbound(); | 120 _ContentHandlerProxyImpl.unbound() : super.unbound(); |
106 | 121 |
107 static _ContentHandlerProxyImpl newFromEndpoint( | 122 static _ContentHandlerProxyImpl newFromEndpoint( |
108 core.MojoMessagePipeEndpoint endpoint) { | 123 core.MojoMessagePipeEndpoint endpoint) { |
109 assert(endpoint.setDescription("For _ContentHandlerProxyImpl")); | 124 assert(endpoint.setDescription("For _ContentHandlerProxyImpl")); |
110 return new _ContentHandlerProxyImpl.fromEndpoint(endpoint); | 125 return new _ContentHandlerProxyImpl.fromEndpoint(endpoint); |
111 } | 126 } |
112 | 127 |
| 128 service_describer.ServiceDescription get serviceDescription => |
| 129 new _ContentHandlerServiceDescription(); |
| 130 |
113 void handleResponse(bindings.ServiceMessage message) { | 131 void handleResponse(bindings.ServiceMessage message) { |
114 switch (message.header.type) { | 132 switch (message.header.type) { |
115 default: | 133 default: |
116 proxyError("Unexpected message type: ${message.header.type}"); | 134 proxyError("Unexpected message type: ${message.header.type}"); |
117 close(immediate: true); | 135 close(immediate: true); |
118 break; | 136 break; |
119 } | 137 } |
120 } | 138 } |
121 | 139 |
122 String toString() { | 140 String toString() { |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 assert(_impl == null); | 265 assert(_impl == null); |
248 _impl = d; | 266 _impl = d; |
249 } | 267 } |
250 | 268 |
251 String toString() { | 269 String toString() { |
252 var superString = super.toString(); | 270 var superString = super.toString(); |
253 return "ContentHandlerStub($superString)"; | 271 return "ContentHandlerStub($superString)"; |
254 } | 272 } |
255 | 273 |
256 int get version => 0; | 274 int get version => 0; |
| 275 |
| 276 service_describer.ServiceDescription get serviceDescription => |
| 277 new _ContentHandlerServiceDescription(); |
257 } | 278 } |
258 | 279 |
259 | 280 |
| 281 |
OLD | NEW |