| 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 terminal_mojom; | 5 library terminal_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/files/file.mojom.dart' as file_mojom; | 10 import 'package:mojo_services/mojo/files/file.mojom.dart' as file_mojom; |
| (...skipping 925 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 936 impl.requireVersion(requiredVersion); | 936 impl.requireVersion(requiredVersion); |
| 937 } | 937 } |
| 938 | 938 |
| 939 String toString() { | 939 String toString() { |
| 940 return "TerminalProxy($impl)"; | 940 return "TerminalProxy($impl)"; |
| 941 } | 941 } |
| 942 } | 942 } |
| 943 | 943 |
| 944 | 944 |
| 945 class TerminalStub extends bindings.Stub { | 945 class TerminalStub extends bindings.Stub { |
| 946 Terminal _impl = null; | 946 Terminal _impl; |
| 947 | 947 |
| 948 TerminalStub.fromEndpoint( | 948 TerminalStub.fromEndpoint( |
| 949 core.MojoMessagePipeEndpoint endpoint, [this._impl]) | 949 core.MojoMessagePipeEndpoint endpoint, [Terminal impl]) |
| 950 : super.fromEndpoint(endpoint); | 950 : super.fromEndpoint(endpoint, autoBegin: impl != null) { |
| 951 _impl = impl; |
| 952 } |
| 951 | 953 |
| 952 TerminalStub.fromHandle(core.MojoHandle handle, [this._impl]) | 954 TerminalStub.fromHandle( |
| 953 : super.fromHandle(handle); | 955 core.MojoHandle handle, [Terminal impl]) |
| 956 : super.fromHandle(handle, autoBegin: impl != null) { |
| 957 _impl = impl; |
| 958 } |
| 954 | 959 |
| 955 TerminalStub.unbound() : super.unbound(); | 960 TerminalStub.unbound() : super.unbound(); |
| 956 | 961 |
| 957 static TerminalStub newFromEndpoint( | 962 static TerminalStub newFromEndpoint( |
| 958 core.MojoMessagePipeEndpoint endpoint) { | 963 core.MojoMessagePipeEndpoint endpoint) { |
| 959 assert(endpoint.setDescription("For TerminalStub")); | 964 assert(endpoint.setDescription("For TerminalStub")); |
| 960 return new TerminalStub.fromEndpoint(endpoint); | 965 return new TerminalStub.fromEndpoint(endpoint); |
| 961 } | 966 } |
| 962 | 967 |
| 963 | 968 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 985 result.columns = columns; | 990 result.columns = columns; |
| 986 return result; | 991 return result; |
| 987 } | 992 } |
| 988 | 993 |
| 989 dynamic handleMessage(bindings.ServiceMessage message) { | 994 dynamic handleMessage(bindings.ServiceMessage message) { |
| 990 if (bindings.ControlMessageHandler.isControlMessage(message)) { | 995 if (bindings.ControlMessageHandler.isControlMessage(message)) { |
| 991 return bindings.ControlMessageHandler.handleMessage(this, | 996 return bindings.ControlMessageHandler.handleMessage(this, |
| 992 0, | 997 0, |
| 993 message); | 998 message); |
| 994 } | 999 } |
| 995 assert(_impl != null); | 1000 if (_impl == null) { |
| 1001 throw new core.MojoApiError("$this has no implementation set"); |
| 1002 } |
| 996 switch (message.header.type) { | 1003 switch (message.header.type) { |
| 997 case _terminalMethodConnectName: | 1004 case _terminalMethodConnectName: |
| 998 var params = _TerminalConnectParams.deserialize( | 1005 var params = _TerminalConnectParams.deserialize( |
| 999 message.payload); | 1006 message.payload); |
| 1000 var response = _impl.connect(params.terminalFile,params.force,_terminalC
onnectResponseParamsFactory); | 1007 var response = _impl.connect(params.terminalFile,params.force,_terminalC
onnectResponseParamsFactory); |
| 1001 if (response is Future) { | 1008 if (response is Future) { |
| 1002 return response.then((response) { | 1009 return response.then((response) { |
| 1003 if (response != null) { | 1010 if (response != null) { |
| 1004 return buildResponseWithId( | 1011 return buildResponseWithId( |
| 1005 response, | 1012 response, |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1082 break; | 1089 break; |
| 1083 default: | 1090 default: |
| 1084 throw new bindings.MojoCodecError("Unexpected message name"); | 1091 throw new bindings.MojoCodecError("Unexpected message name"); |
| 1085 break; | 1092 break; |
| 1086 } | 1093 } |
| 1087 return null; | 1094 return null; |
| 1088 } | 1095 } |
| 1089 | 1096 |
| 1090 Terminal get impl => _impl; | 1097 Terminal get impl => _impl; |
| 1091 set impl(Terminal d) { | 1098 set impl(Terminal d) { |
| 1092 assert(_impl == null); | 1099 if (d == null) { |
| 1100 throw new core.MojoApiError("$this: Cannot set a null implementation"); |
| 1101 } |
| 1102 if (isBound && (_impl == null)) { |
| 1103 beginHandlingEvents(); |
| 1104 } |
| 1093 _impl = d; | 1105 _impl = d; |
| 1094 } | 1106 } |
| 1095 | 1107 |
| 1108 @override |
| 1109 void bind(core.MojoMessagePipeEndpoint endpoint) { |
| 1110 super.bind(endpoint); |
| 1111 if (!isOpen && (_impl != null)) { |
| 1112 beginHandlingEvents(); |
| 1113 } |
| 1114 } |
| 1115 |
| 1096 String toString() { | 1116 String toString() { |
| 1097 var superString = super.toString(); | 1117 var superString = super.toString(); |
| 1098 return "TerminalStub($superString)"; | 1118 return "TerminalStub($superString)"; |
| 1099 } | 1119 } |
| 1100 | 1120 |
| 1101 int get version => 0; | 1121 int get version => 0; |
| 1102 | 1122 |
| 1103 static service_describer.ServiceDescription _cachedServiceDescription; | 1123 static service_describer.ServiceDescription _cachedServiceDescription; |
| 1104 static service_describer.ServiceDescription get serviceDescription { | 1124 static service_describer.ServiceDescription get serviceDescription { |
| 1105 if (_cachedServiceDescription == null) { | 1125 if (_cachedServiceDescription == null) { |
| 1106 _cachedServiceDescription = new _TerminalServiceDescription(); | 1126 _cachedServiceDescription = new _TerminalServiceDescription(); |
| 1107 } | 1127 } |
| 1108 return _cachedServiceDescription; | 1128 return _cachedServiceDescription; |
| 1109 } | 1129 } |
| 1110 } | 1130 } |
| 1111 | 1131 |
| 1112 | 1132 |
| 1113 | 1133 |
| OLD | NEW |