Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(139)

Side by Side Diff: mojo/dart/packages/mojo_services/lib/mojo/ui/input_dispatcher.mojom.dart

Issue 1983453002: Dart: Refactor Stubs (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Merge Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 input_dispatcher_mojom; 5 library input_dispatcher_mojom;
6 import 'dart:async'; 6 import 'dart:async';
7 import 'package:mojo/bindings.dart' as bindings; 7 import 'package:mojo/bindings.dart' as bindings;
8 import 'package:mojo/core.dart' as core; 8 import 'package:mojo/core.dart' as core;
9 import 'package:mojo/mojo/bindings/types/service_describer.mojom.dart' as servic e_describer; 9 import 'package:mojo/mojo/bindings/types/service_describer.mojom.dart' as servic e_describer;
10 import 'package:mojo_services/mojo/input_events.mojom.dart' as input_events_mojo m; 10 import 'package:mojo_services/mojo/input_events.mojom.dart' as input_events_mojo m;
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 94
95 dynamic getAllTypeDefinitions([Function responseFactory]) => 95 dynamic getAllTypeDefinitions([Function responseFactory]) =>
96 responseFactory(null); 96 responseFactory(null);
97 } 97 }
98 98
99 abstract class InputDispatcher { 99 abstract class InputDispatcher {
100 static const String serviceName = "mojo::ui::InputDispatcher"; 100 static const String serviceName = "mojo::ui::InputDispatcher";
101 void dispatchEvent(input_events_mojom.Event event); 101 void dispatchEvent(input_events_mojom.Event event);
102 } 102 }
103 103
104 104 class _InputDispatcherProxyControl
105 class _InputDispatcherProxyControl extends bindings.ProxyMessageHandler 105 extends bindings.ProxyMessageHandler
106 implements bindings.ProxyControl { 106 implements bindings.ProxyControl {
107 _InputDispatcherProxyControl.fromEndpoint( 107 _InputDispatcherProxyControl.fromEndpoint(
108 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); 108 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint);
109 109
110 _InputDispatcherProxyControl.fromHandle( 110 _InputDispatcherProxyControl.fromHandle(
111 core.MojoHandle handle) : super.fromHandle(handle); 111 core.MojoHandle handle) : super.fromHandle(handle);
112 112
113 _InputDispatcherProxyControl.unbound() : super.unbound(); 113 _InputDispatcherProxyControl.unbound() : super.unbound();
114 114
115 service_describer.ServiceDescription get serviceDescription => 115 service_describer.ServiceDescription get serviceDescription =>
116 new _InputDispatcherServiceDescription(); 116 new _InputDispatcherServiceDescription();
117 117
118 String get serviceName => InputDispatcher.serviceName; 118 String get serviceName => InputDispatcher.serviceName;
119 119
120 @override
121 void handleResponse(bindings.ServiceMessage message) { 120 void handleResponse(bindings.ServiceMessage message) {
122 switch (message.header.type) { 121 switch (message.header.type) {
123 default: 122 default:
124 proxyError("Unexpected message type: ${message.header.type}"); 123 proxyError("Unexpected message type: ${message.header.type}");
125 close(immediate: true); 124 close(immediate: true);
126 break; 125 break;
127 } 126 }
128 } 127 }
129 128
130 @override 129 @override
131 String toString() { 130 String toString() {
132 var superString = super.toString(); 131 var superString = super.toString();
133 return "_InputDispatcherProxyControl($superString)"; 132 return "_InputDispatcherProxyControl($superString)";
134 } 133 }
135 } 134 }
136 135
137 136 class InputDispatcherProxy
138 class InputDispatcherProxy extends bindings.Proxy 137 extends bindings.Proxy
139 implements InputDispatcher { 138 implements InputDispatcher {
140 InputDispatcherProxy.fromEndpoint( 139 InputDispatcherProxy.fromEndpoint(
141 core.MojoMessagePipeEndpoint endpoint) 140 core.MojoMessagePipeEndpoint endpoint)
142 : super(new _InputDispatcherProxyControl.fromEndpoint(endpoint)); 141 : super(new _InputDispatcherProxyControl.fromEndpoint(endpoint));
143 142
144 InputDispatcherProxy.fromHandle(core.MojoHandle handle) 143 InputDispatcherProxy.fromHandle(core.MojoHandle handle)
145 : super(new _InputDispatcherProxyControl.fromHandle(handle)); 144 : super(new _InputDispatcherProxyControl.fromHandle(handle));
146 145
147 InputDispatcherProxy.unbound() 146 InputDispatcherProxy.unbound()
148 : super(new _InputDispatcherProxyControl.unbound()); 147 : super(new _InputDispatcherProxyControl.unbound());
149 148
(...skipping 16 matching lines...) Expand all
166 ctrl.proxyError("The Proxy is closed."); 165 ctrl.proxyError("The Proxy is closed.");
167 return; 166 return;
168 } 167 }
169 var params = new _InputDispatcherDispatchEventParams(); 168 var params = new _InputDispatcherDispatchEventParams();
170 params.event = event; 169 params.event = event;
171 ctrl.sendMessage(params, 170 ctrl.sendMessage(params,
172 _inputDispatcherMethodDispatchEventName); 171 _inputDispatcherMethodDispatchEventName);
173 } 172 }
174 } 173 }
175 174
176 175 class _InputDispatcherStubControl
177 class InputDispatcherStub extends bindings.Stub { 176 extends bindings.StubMessageHandler
177 implements bindings.StubControl<InputDispatcher> {
178 InputDispatcher _impl; 178 InputDispatcher _impl;
179 179
180 InputDispatcherStub.fromEndpoint( 180 _InputDispatcherStubControl.fromEndpoint(
181 core.MojoMessagePipeEndpoint endpoint, [InputDispatcher impl]) 181 core.MojoMessagePipeEndpoint endpoint, [InputDispatcher impl])
182 : super.fromEndpoint(endpoint, autoBegin: impl != null) { 182 : super.fromEndpoint(endpoint, autoBegin: impl != null) {
183 _impl = impl; 183 _impl = impl;
184 } 184 }
185 185
186 InputDispatcherStub.fromHandle( 186 _InputDispatcherStubControl.fromHandle(
187 core.MojoHandle handle, [InputDispatcher impl]) 187 core.MojoHandle handle, [InputDispatcher impl])
188 : super.fromHandle(handle, autoBegin: impl != null) { 188 : super.fromHandle(handle, autoBegin: impl != null) {
189 _impl = impl; 189 _impl = impl;
190 } 190 }
191 191
192 InputDispatcherStub.unbound([this._impl]) : super.unbound(); 192 _InputDispatcherStubControl.unbound([this._impl]) : super.unbound();
193
194 static InputDispatcherStub newFromEndpoint(
195 core.MojoMessagePipeEndpoint endpoint) {
196 assert(endpoint.setDescription("For InputDispatcherStub"));
197 return new InputDispatcherStub.fromEndpoint(endpoint);
198 }
199 193
200 194
201 195
202 dynamic handleMessage(bindings.ServiceMessage message) { 196 dynamic handleMessage(bindings.ServiceMessage message) {
203 if (bindings.ControlMessageHandler.isControlMessage(message)) { 197 if (bindings.ControlMessageHandler.isControlMessage(message)) {
204 return bindings.ControlMessageHandler.handleMessage(this, 198 return bindings.ControlMessageHandler.handleMessage(this,
205 0, 199 0,
206 message); 200 message);
207 } 201 }
208 if (_impl == null) { 202 if (_impl == null) {
(...skipping 24 matching lines...) Expand all
233 } 227 }
234 228
235 @override 229 @override
236 void bind(core.MojoMessagePipeEndpoint endpoint) { 230 void bind(core.MojoMessagePipeEndpoint endpoint) {
237 super.bind(endpoint); 231 super.bind(endpoint);
238 if (!isOpen && (_impl != null)) { 232 if (!isOpen && (_impl != null)) {
239 beginHandlingEvents(); 233 beginHandlingEvents();
240 } 234 }
241 } 235 }
242 236
237 @override
243 String toString() { 238 String toString() {
244 var superString = super.toString(); 239 var superString = super.toString();
245 return "InputDispatcherStub($superString)"; 240 return "_InputDispatcherStubControl($superString)";
246 } 241 }
247 242
248 int get version => 0; 243 int get version => 0;
249 244
250 static service_describer.ServiceDescription _cachedServiceDescription; 245 static service_describer.ServiceDescription _cachedServiceDescription;
251 static service_describer.ServiceDescription get serviceDescription { 246 static service_describer.ServiceDescription get serviceDescription {
252 if (_cachedServiceDescription == null) { 247 if (_cachedServiceDescription == null) {
253 _cachedServiceDescription = new _InputDispatcherServiceDescription(); 248 _cachedServiceDescription = new _InputDispatcherServiceDescription();
254 } 249 }
255 return _cachedServiceDescription; 250 return _cachedServiceDescription;
256 } 251 }
257 } 252 }
258 253
254 class InputDispatcherStub
255 extends bindings.Stub<InputDispatcher>
256 implements InputDispatcher {
257 InputDispatcherStub.fromEndpoint(
258 core.MojoMessagePipeEndpoint endpoint, [InputDispatcher impl])
259 : super(new _InputDispatcherStubControl.fromEndpoint(endpoint, impl));
260
261 InputDispatcherStub.fromHandle(
262 core.MojoHandle handle, [InputDispatcher impl])
263 : super(new _InputDispatcherStubControl.fromHandle(handle, impl));
264
265 InputDispatcherStub.unbound([InputDispatcher impl])
266 : super(new _InputDispatcherStubControl.unbound(impl));
267
268 static InputDispatcherStub newFromEndpoint(
269 core.MojoMessagePipeEndpoint endpoint) {
270 assert(endpoint.setDescription("For InputDispatcherStub"));
271 return new InputDispatcherStub.fromEndpoint(endpoint);
272 }
273
274 static service_describer.ServiceDescription get serviceDescription =>
275 _InputDispatcherStubControl.serviceDescription;
276
277
278 void dispatchEvent(input_events_mojom.Event event) {
279 return impl.dispatchEvent(event);
280 }
281 }
282
259 283
260 284
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698