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

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

Issue 1453823005: Implement Linux IME support (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Avoid modifying NativeViewport Created 5 years, 1 month 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 keyboard_mojom; 5 library keyboard_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_services/mojo/native_viewport.mojom.dart' as native_viewpor t_mojom;
11 class SubmitAction extends bindings.MojoEnum { 12 class SubmitAction extends bindings.MojoEnum {
12 static const DONE = const SubmitAction._(0); 13 static const DONE = const SubmitAction._(0);
13 14
14 const SubmitAction._(int v) : super(v); 15 const SubmitAction._(int v) : super(v);
15 16
16 static const Map<String, SubmitAction> valuesMap = const { 17 static const Map<String, SubmitAction> valuesMap = const {
17 "DONE": DONE, 18 "DONE": DONE,
18 }; 19 };
19 static const List<SubmitAction> values = const [ 20 static const List<SubmitAction> values = const [
20 DONE, 21 DONE,
(...skipping 1190 matching lines...) Expand 10 before | Expand all | Expand 10 after
1211 } 1212 }
1212 1213
1213 Map toJson() { 1214 Map toJson() {
1214 Map map = new Map(); 1215 Map map = new Map();
1215 map["start"] = start; 1216 map["start"] = start;
1216 map["end"] = end; 1217 map["end"] = end;
1217 return map; 1218 return map;
1218 } 1219 }
1219 } 1220 }
1220 1221
1222
1223 class KeyboardServiceFactoryCreateKeyboardServiceParams extends bindings.Struct {
1224 static const List<bindings.StructDataHeader> kVersions = const [
1225 const bindings.StructDataHeader(16, 0)
1226 ];
1227 Object keyEventDispatcher = null;
1228 Object serviceRequest = null;
1229
1230 KeyboardServiceFactoryCreateKeyboardServiceParams() : super(kVersions.last.siz e);
1231
1232 static KeyboardServiceFactoryCreateKeyboardServiceParams deserialize(bindings. Message message) {
1233 var decoder = new bindings.Decoder(message);
1234 var result = decode(decoder);
1235 if (decoder.excessHandles != null) {
1236 decoder.excessHandles.forEach((h) => h.close());
1237 }
1238 return result;
1239 }
1240
1241 static KeyboardServiceFactoryCreateKeyboardServiceParams decode(bindings.Decod er decoder0) {
1242 if (decoder0 == null) {
1243 return null;
1244 }
1245 KeyboardServiceFactoryCreateKeyboardServiceParams result = new KeyboardServi ceFactoryCreateKeyboardServiceParams();
1246
1247 var mainDataHeader = decoder0.decodeStructDataHeader();
1248 if (mainDataHeader.version <= kVersions.last.version) {
1249 // Scan in reverse order to optimize for more recent versions.
1250 for (int i = kVersions.length - 1; i >= 0; --i) {
1251 if (mainDataHeader.version >= kVersions[i].version) {
1252 if (mainDataHeader.size == kVersions[i].size) {
1253 // Found a match.
1254 break;
1255 }
1256 throw new bindings.MojoCodecError(
1257 'Header size doesn\'t correspond to known version size.');
1258 }
1259 }
1260 } else if (mainDataHeader.size < kVersions.last.size) {
1261 throw new bindings.MojoCodecError(
1262 'Message newer than the last known version cannot be shorter than '
1263 'required by the last known version.');
1264 }
1265 if (mainDataHeader.version >= 0) {
1266
1267 result.keyEventDispatcher = decoder0.decodeInterfaceRequest(8, false, nati ve_viewport_mojom.NativeViewportEventDispatcherStub.newFromEndpoint);
1268 }
1269 if (mainDataHeader.version >= 0) {
1270
1271 result.serviceRequest = decoder0.decodeInterfaceRequest(12, false, Keyboar dServiceStub.newFromEndpoint);
1272 }
1273 return result;
1274 }
1275
1276 void encode(bindings.Encoder encoder) {
1277 var encoder0 = encoder.getStructEncoderAtOffset(kVersions.last);
1278
1279 encoder0.encodeInterfaceRequest(keyEventDispatcher, 8, false);
1280
1281 encoder0.encodeInterfaceRequest(serviceRequest, 12, false);
1282 }
1283
1284 String toString() {
1285 return "KeyboardServiceFactoryCreateKeyboardServiceParams("
1286 "keyEventDispatcher: $keyEventDispatcher" ", "
1287 "serviceRequest: $serviceRequest" ")";
1288 }
1289
1290 Map toJson() {
1291 throw new bindings.MojoCodecError(
1292 'Object containing handles cannot be encoded to JSON.');
1293 }
1294 }
1295
1221 const int kKeyboardClient_commitCompletion_name = 0; 1296 const int kKeyboardClient_commitCompletion_name = 0;
1222 const int kKeyboardClient_commitCorrection_name = 1; 1297 const int kKeyboardClient_commitCorrection_name = 1;
1223 const int kKeyboardClient_commitText_name = 2; 1298 const int kKeyboardClient_commitText_name = 2;
1224 const int kKeyboardClient_deleteSurroundingText_name = 3; 1299 const int kKeyboardClient_deleteSurroundingText_name = 3;
1225 const int kKeyboardClient_setComposingRegion_name = 4; 1300 const int kKeyboardClient_setComposingRegion_name = 4;
1226 const int kKeyboardClient_setComposingText_name = 5; 1301 const int kKeyboardClient_setComposingText_name = 5;
1227 const int kKeyboardClient_setSelection_name = 6; 1302 const int kKeyboardClient_setSelection_name = 6;
1228 const int kKeyboardClient_submit_name = 7; 1303 const int kKeyboardClient_submit_name = 7;
1229 1304
1230 const String KeyboardClientName = 1305 const String KeyboardClientName =
(...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after
1753 } 1828 }
1754 1829
1755 String toString() { 1830 String toString() {
1756 var superString = super.toString(); 1831 var superString = super.toString();
1757 return "KeyboardServiceStub($superString)"; 1832 return "KeyboardServiceStub($superString)";
1758 } 1833 }
1759 1834
1760 int get version => 0; 1835 int get version => 0;
1761 } 1836 }
1762 1837
1838 const int kKeyboardServiceFactory_createKeyboardService_name = 0;
1839
1840 const String KeyboardServiceFactoryName =
1841 'keyboard::KeyboardServiceFactory';
1842
1843 abstract class KeyboardServiceFactory {
1844 void createKeyboardService(Object keyEventDispatcher, Object serviceRequest);
1845
1846 }
1847
1848
1849 class KeyboardServiceFactoryProxyImpl extends bindings.Proxy {
1850 KeyboardServiceFactoryProxyImpl.fromEndpoint(
1851 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint);
1852
1853 KeyboardServiceFactoryProxyImpl.fromHandle(core.MojoHandle handle) :
1854 super.fromHandle(handle);
1855
1856 KeyboardServiceFactoryProxyImpl.unbound() : super.unbound();
1857
1858 static KeyboardServiceFactoryProxyImpl newFromEndpoint(
1859 core.MojoMessagePipeEndpoint endpoint) {
1860 assert(endpoint.setDescription("For KeyboardServiceFactoryProxyImpl"));
1861 return new KeyboardServiceFactoryProxyImpl.fromEndpoint(endpoint);
1862 }
1863
1864 String get name => KeyboardServiceFactoryName;
1865
1866 void handleResponse(bindings.ServiceMessage message) {
1867 switch (message.header.type) {
1868 default:
1869 proxyError("Unexpected message type: ${message.header.type}");
1870 close(immediate: true);
1871 break;
1872 }
1873 }
1874
1875 String toString() {
1876 var superString = super.toString();
1877 return "KeyboardServiceFactoryProxyImpl($superString)";
1878 }
1879 }
1880
1881
1882 class _KeyboardServiceFactoryProxyCalls implements KeyboardServiceFactory {
1883 KeyboardServiceFactoryProxyImpl _proxyImpl;
1884
1885 _KeyboardServiceFactoryProxyCalls(this._proxyImpl);
1886 void createKeyboardService(Object keyEventDispatcher, Object serviceRequest) {
1887 if (!_proxyImpl.isBound) {
1888 _proxyImpl.proxyError("The Proxy is closed.");
1889 return;
1890 }
1891 var params = new KeyboardServiceFactoryCreateKeyboardServiceParams();
1892 params.keyEventDispatcher = keyEventDispatcher;
1893 params.serviceRequest = serviceRequest;
1894 _proxyImpl.sendMessage(params, kKeyboardServiceFactory_createKeyboardServi ce_name);
1895 }
1896
1897 }
1898
1899
1900 class KeyboardServiceFactoryProxy implements bindings.ProxyBase {
1901 final bindings.Proxy impl;
1902 KeyboardServiceFactory ptr;
1903 final String name = KeyboardServiceFactoryName;
1904
1905 KeyboardServiceFactoryProxy(KeyboardServiceFactoryProxyImpl proxyImpl) :
1906 impl = proxyImpl,
1907 ptr = new _KeyboardServiceFactoryProxyCalls(proxyImpl);
1908
1909 KeyboardServiceFactoryProxy.fromEndpoint(
1910 core.MojoMessagePipeEndpoint endpoint) :
1911 impl = new KeyboardServiceFactoryProxyImpl.fromEndpoint(endpoint) {
1912 ptr = new _KeyboardServiceFactoryProxyCalls(impl);
1913 }
1914
1915 KeyboardServiceFactoryProxy.fromHandle(core.MojoHandle handle) :
1916 impl = new KeyboardServiceFactoryProxyImpl.fromHandle(handle) {
1917 ptr = new _KeyboardServiceFactoryProxyCalls(impl);
1918 }
1919
1920 KeyboardServiceFactoryProxy.unbound() :
1921 impl = new KeyboardServiceFactoryProxyImpl.unbound() {
1922 ptr = new _KeyboardServiceFactoryProxyCalls(impl);
1923 }
1924
1925 factory KeyboardServiceFactoryProxy.connectToService(
1926 bindings.ServiceConnector s, String url) {
1927 KeyboardServiceFactoryProxy p = new KeyboardServiceFactoryProxy.unbound();
1928 s.connectToService(url, p);
1929 return p;
1930 }
1931
1932 static KeyboardServiceFactoryProxy newFromEndpoint(
1933 core.MojoMessagePipeEndpoint endpoint) {
1934 assert(endpoint.setDescription("For KeyboardServiceFactoryProxy"));
1935 return new KeyboardServiceFactoryProxy.fromEndpoint(endpoint);
1936 }
1937
1938 Future close({bool immediate: false}) => impl.close(immediate: immediate);
1939
1940 Future responseOrError(Future f) => impl.responseOrError(f);
1941
1942 Future get errorFuture => impl.errorFuture;
1943
1944 int get version => impl.version;
1945
1946 Future<int> queryVersion() => impl.queryVersion();
1947
1948 void requireVersion(int requiredVersion) {
1949 impl.requireVersion(requiredVersion);
1950 }
1951
1952 String toString() {
1953 return "KeyboardServiceFactoryProxy($impl)";
1954 }
1955 }
1956
1957
1958 class KeyboardServiceFactoryStub extends bindings.Stub {
1959 KeyboardServiceFactory _impl = null;
1960
1961 KeyboardServiceFactoryStub.fromEndpoint(
1962 core.MojoMessagePipeEndpoint endpoint, [this._impl])
1963 : super.fromEndpoint(endpoint);
1964
1965 KeyboardServiceFactoryStub.fromHandle(core.MojoHandle handle, [this._impl])
1966 : super.fromHandle(handle);
1967
1968 KeyboardServiceFactoryStub.unbound() : super.unbound();
1969
1970 static KeyboardServiceFactoryStub newFromEndpoint(
1971 core.MojoMessagePipeEndpoint endpoint) {
1972 assert(endpoint.setDescription("For KeyboardServiceFactoryStub"));
1973 return new KeyboardServiceFactoryStub.fromEndpoint(endpoint);
1974 }
1975
1976 static const String name = KeyboardServiceFactoryName;
1977
1978
1979
1980 dynamic handleMessage(bindings.ServiceMessage message) {
1981 if (bindings.ControlMessageHandler.isControlMessage(message)) {
1982 return bindings.ControlMessageHandler.handleMessage(this,
1983 0,
1984 message);
1985 }
1986 assert(_impl != null);
1987 switch (message.header.type) {
1988 case kKeyboardServiceFactory_createKeyboardService_name:
1989 var params = KeyboardServiceFactoryCreateKeyboardServiceParams.deseriali ze(
1990 message.payload);
1991 _impl.createKeyboardService(params.keyEventDispatcher, params.serviceReq uest);
1992 break;
1993 default:
1994 throw new bindings.MojoCodecError("Unexpected message name");
1995 break;
1996 }
1997 return null;
1998 }
1999
2000 KeyboardServiceFactory get impl => _impl;
2001 set impl(KeyboardServiceFactory d) {
2002 assert(_impl == null);
2003 _impl = d;
2004 }
2005
2006 String toString() {
2007 var superString = super.toString();
2008 return "KeyboardServiceFactoryStub($superString)";
2009 }
2010
2011 int get version => 0;
2012 }
2013
1763 2014
OLDNEW
« no previous file with comments | « no previous file | mojo/services/keyboard/interfaces/BUILD.gn » ('j') | services/keyboard/linux/keyboard_service_impl.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698