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 authentication_mojom; | 5 library authentication_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 | 11 |
12 | |
13 | |
14 class _AuthenticationServiceSelectAccountParams extends bindings.Struct { | 12 class _AuthenticationServiceSelectAccountParams extends bindings.Struct { |
15 static const List<bindings.StructDataHeader> kVersions = const [ | 13 static const List<bindings.StructDataHeader> kVersions = const [ |
16 const bindings.StructDataHeader(16, 0) | 14 const bindings.StructDataHeader(16, 0) |
17 ]; | 15 ]; |
18 bool returnLastSelected = false; | 16 bool returnLastSelected = false; |
19 | 17 |
20 _AuthenticationServiceSelectAccountParams() : super(kVersions.last.size); | 18 _AuthenticationServiceSelectAccountParams() : super(kVersions.last.size); |
21 | 19 |
22 static _AuthenticationServiceSelectAccountParams deserialize(bindings.Message
message) { | 20 static _AuthenticationServiceSelectAccountParams deserialize( |
| 21 bindings.Message message) { |
23 var decoder = new bindings.Decoder(message); | 22 var decoder = new bindings.Decoder(message); |
24 var result = decode(decoder); | 23 var result = decode(decoder); |
25 if (decoder.excessHandles != null) { | 24 if (decoder.excessHandles != null) { |
26 decoder.excessHandles.forEach((h) => h.close()); | 25 decoder.excessHandles.forEach((h) => h.close()); |
27 } | 26 } |
28 return result; | 27 return result; |
29 } | 28 } |
30 | 29 |
31 static _AuthenticationServiceSelectAccountParams decode(bindings.Decoder decod
er0) { | 30 static _AuthenticationServiceSelectAccountParams decode( |
| 31 bindings.Decoder decoder0) { |
32 if (decoder0 == null) { | 32 if (decoder0 == null) { |
33 return null; | 33 return null; |
34 } | 34 } |
35 _AuthenticationServiceSelectAccountParams result = new _AuthenticationServic
eSelectAccountParams(); | 35 _AuthenticationServiceSelectAccountParams result = |
| 36 new _AuthenticationServiceSelectAccountParams(); |
36 | 37 |
37 var mainDataHeader = decoder0.decodeStructDataHeader(); | 38 var mainDataHeader = decoder0.decodeStructDataHeader(); |
38 if (mainDataHeader.version <= kVersions.last.version) { | 39 if (mainDataHeader.version <= kVersions.last.version) { |
39 // Scan in reverse order to optimize for more recent versions. | 40 // Scan in reverse order to optimize for more recent versions. |
40 for (int i = kVersions.length - 1; i >= 0; --i) { | 41 for (int i = kVersions.length - 1; i >= 0; --i) { |
41 if (mainDataHeader.version >= kVersions[i].version) { | 42 if (mainDataHeader.version >= kVersions[i].version) { |
42 if (mainDataHeader.size == kVersions[i].size) { | 43 if (mainDataHeader.size == kVersions[i].size) { |
43 // Found a match. | 44 // Found a match. |
44 break; | 45 break; |
45 } | 46 } |
46 throw new bindings.MojoCodecError( | 47 throw new bindings.MojoCodecError( |
47 'Header size doesn\'t correspond to known version size.'); | 48 'Header size doesn\'t correspond to known version size.'); |
48 } | 49 } |
49 } | 50 } |
50 } else if (mainDataHeader.size < kVersions.last.size) { | 51 } else if (mainDataHeader.size < kVersions.last.size) { |
51 throw new bindings.MojoCodecError( | 52 throw new bindings.MojoCodecError( |
52 'Message newer than the last known version cannot be shorter than ' | 53 'Message newer than the last known version cannot be shorter than ' |
53 'required by the last known version.'); | 54 'required by the last known version.'); |
54 } | 55 } |
55 if (mainDataHeader.version >= 0) { | 56 if (mainDataHeader.version >= 0) { |
56 | |
57 result.returnLastSelected = decoder0.decodeBool(8, 0); | 57 result.returnLastSelected = decoder0.decodeBool(8, 0); |
58 } | 58 } |
59 return result; | 59 return result; |
60 } | 60 } |
61 | 61 |
62 void encode(bindings.Encoder encoder) { | 62 void encode(bindings.Encoder encoder) { |
63 var encoder0 = encoder.getStructEncoderAtOffset(kVersions.last); | 63 var encoder0 = encoder.getStructEncoderAtOffset(kVersions.last); |
64 | 64 |
65 encoder0.encodeBool(returnLastSelected, 8, 0); | 65 encoder0.encodeBool(returnLastSelected, 8, 0); |
66 } | 66 } |
67 | 67 |
68 String toString() { | 68 String toString() { |
69 return "_AuthenticationServiceSelectAccountParams(" | 69 return "_AuthenticationServiceSelectAccountParams(" |
70 "returnLastSelected: $returnLastSelected" ")"; | 70 "returnLastSelected: $returnLastSelected" |
| 71 ")"; |
71 } | 72 } |
72 | 73 |
73 Map toJson() { | 74 Map toJson() { |
74 Map map = new Map(); | 75 Map map = new Map(); |
75 map["returnLastSelected"] = returnLastSelected; | 76 map["returnLastSelected"] = returnLastSelected; |
76 return map; | 77 return map; |
77 } | 78 } |
78 } | 79 } |
79 | 80 |
80 | |
81 class AuthenticationServiceSelectAccountResponseParams extends bindings.Struct { | 81 class AuthenticationServiceSelectAccountResponseParams extends bindings.Struct { |
82 static const List<bindings.StructDataHeader> kVersions = const [ | 82 static const List<bindings.StructDataHeader> kVersions = const [ |
83 const bindings.StructDataHeader(24, 0) | 83 const bindings.StructDataHeader(24, 0) |
84 ]; | 84 ]; |
85 String username = null; | 85 String username = null; |
86 String error = null; | 86 String error = null; |
87 | 87 |
88 AuthenticationServiceSelectAccountResponseParams() : super(kVersions.last.size
); | 88 AuthenticationServiceSelectAccountResponseParams() |
| 89 : super(kVersions.last.size); |
89 | 90 |
90 static AuthenticationServiceSelectAccountResponseParams deserialize(bindings.M
essage message) { | 91 static AuthenticationServiceSelectAccountResponseParams deserialize( |
| 92 bindings.Message message) { |
91 var decoder = new bindings.Decoder(message); | 93 var decoder = new bindings.Decoder(message); |
92 var result = decode(decoder); | 94 var result = decode(decoder); |
93 if (decoder.excessHandles != null) { | 95 if (decoder.excessHandles != null) { |
94 decoder.excessHandles.forEach((h) => h.close()); | 96 decoder.excessHandles.forEach((h) => h.close()); |
95 } | 97 } |
96 return result; | 98 return result; |
97 } | 99 } |
98 | 100 |
99 static AuthenticationServiceSelectAccountResponseParams decode(bindings.Decode
r decoder0) { | 101 static AuthenticationServiceSelectAccountResponseParams decode( |
| 102 bindings.Decoder decoder0) { |
100 if (decoder0 == null) { | 103 if (decoder0 == null) { |
101 return null; | 104 return null; |
102 } | 105 } |
103 AuthenticationServiceSelectAccountResponseParams result = new Authentication
ServiceSelectAccountResponseParams(); | 106 AuthenticationServiceSelectAccountResponseParams result = |
| 107 new AuthenticationServiceSelectAccountResponseParams(); |
104 | 108 |
105 var mainDataHeader = decoder0.decodeStructDataHeader(); | 109 var mainDataHeader = decoder0.decodeStructDataHeader(); |
106 if (mainDataHeader.version <= kVersions.last.version) { | 110 if (mainDataHeader.version <= kVersions.last.version) { |
107 // Scan in reverse order to optimize for more recent versions. | 111 // Scan in reverse order to optimize for more recent versions. |
108 for (int i = kVersions.length - 1; i >= 0; --i) { | 112 for (int i = kVersions.length - 1; i >= 0; --i) { |
109 if (mainDataHeader.version >= kVersions[i].version) { | 113 if (mainDataHeader.version >= kVersions[i].version) { |
110 if (mainDataHeader.size == kVersions[i].size) { | 114 if (mainDataHeader.size == kVersions[i].size) { |
111 // Found a match. | 115 // Found a match. |
112 break; | 116 break; |
113 } | 117 } |
114 throw new bindings.MojoCodecError( | 118 throw new bindings.MojoCodecError( |
115 'Header size doesn\'t correspond to known version size.'); | 119 'Header size doesn\'t correspond to known version size.'); |
116 } | 120 } |
117 } | 121 } |
118 } else if (mainDataHeader.size < kVersions.last.size) { | 122 } else if (mainDataHeader.size < kVersions.last.size) { |
119 throw new bindings.MojoCodecError( | 123 throw new bindings.MojoCodecError( |
120 'Message newer than the last known version cannot be shorter than ' | 124 'Message newer than the last known version cannot be shorter than ' |
121 'required by the last known version.'); | 125 'required by the last known version.'); |
122 } | 126 } |
123 if (mainDataHeader.version >= 0) { | 127 if (mainDataHeader.version >= 0) { |
124 | |
125 result.username = decoder0.decodeString(8, true); | 128 result.username = decoder0.decodeString(8, true); |
126 } | 129 } |
127 if (mainDataHeader.version >= 0) { | 130 if (mainDataHeader.version >= 0) { |
128 | |
129 result.error = decoder0.decodeString(16, true); | 131 result.error = decoder0.decodeString(16, true); |
130 } | 132 } |
131 return result; | 133 return result; |
132 } | 134 } |
133 | 135 |
134 void encode(bindings.Encoder encoder) { | 136 void encode(bindings.Encoder encoder) { |
135 var encoder0 = encoder.getStructEncoderAtOffset(kVersions.last); | 137 var encoder0 = encoder.getStructEncoderAtOffset(kVersions.last); |
136 | 138 |
137 encoder0.encodeString(username, 8, true); | 139 encoder0.encodeString(username, 8, true); |
138 | 140 |
139 encoder0.encodeString(error, 16, true); | 141 encoder0.encodeString(error, 16, true); |
140 } | 142 } |
141 | 143 |
142 String toString() { | 144 String toString() { |
143 return "AuthenticationServiceSelectAccountResponseParams(" | 145 return "AuthenticationServiceSelectAccountResponseParams(" |
144 "username: $username" ", " | 146 "username: $username" |
145 "error: $error" ")"; | 147 ", " |
| 148 "error: $error" |
| 149 ")"; |
146 } | 150 } |
147 | 151 |
148 Map toJson() { | 152 Map toJson() { |
149 Map map = new Map(); | 153 Map map = new Map(); |
150 map["username"] = username; | 154 map["username"] = username; |
151 map["error"] = error; | 155 map["error"] = error; |
152 return map; | 156 return map; |
153 } | 157 } |
154 } | 158 } |
155 | 159 |
156 | |
157 class _AuthenticationServiceGetOAuth2TokenParams extends bindings.Struct { | 160 class _AuthenticationServiceGetOAuth2TokenParams extends bindings.Struct { |
158 static const List<bindings.StructDataHeader> kVersions = const [ | 161 static const List<bindings.StructDataHeader> kVersions = const [ |
159 const bindings.StructDataHeader(24, 0) | 162 const bindings.StructDataHeader(24, 0) |
160 ]; | 163 ]; |
161 String username = null; | 164 String username = null; |
162 List<String> scopes = null; | 165 List<String> scopes = null; |
163 | 166 |
164 _AuthenticationServiceGetOAuth2TokenParams() : super(kVersions.last.size); | 167 _AuthenticationServiceGetOAuth2TokenParams() : super(kVersions.last.size); |
165 | 168 |
166 static _AuthenticationServiceGetOAuth2TokenParams deserialize(bindings.Message
message) { | 169 static _AuthenticationServiceGetOAuth2TokenParams deserialize( |
| 170 bindings.Message message) { |
167 var decoder = new bindings.Decoder(message); | 171 var decoder = new bindings.Decoder(message); |
168 var result = decode(decoder); | 172 var result = decode(decoder); |
169 if (decoder.excessHandles != null) { | 173 if (decoder.excessHandles != null) { |
170 decoder.excessHandles.forEach((h) => h.close()); | 174 decoder.excessHandles.forEach((h) => h.close()); |
171 } | 175 } |
172 return result; | 176 return result; |
173 } | 177 } |
174 | 178 |
175 static _AuthenticationServiceGetOAuth2TokenParams decode(bindings.Decoder deco
der0) { | 179 static _AuthenticationServiceGetOAuth2TokenParams decode( |
| 180 bindings.Decoder decoder0) { |
176 if (decoder0 == null) { | 181 if (decoder0 == null) { |
177 return null; | 182 return null; |
178 } | 183 } |
179 _AuthenticationServiceGetOAuth2TokenParams result = new _AuthenticationServi
ceGetOAuth2TokenParams(); | 184 _AuthenticationServiceGetOAuth2TokenParams result = |
| 185 new _AuthenticationServiceGetOAuth2TokenParams(); |
180 | 186 |
181 var mainDataHeader = decoder0.decodeStructDataHeader(); | 187 var mainDataHeader = decoder0.decodeStructDataHeader(); |
182 if (mainDataHeader.version <= kVersions.last.version) { | 188 if (mainDataHeader.version <= kVersions.last.version) { |
183 // Scan in reverse order to optimize for more recent versions. | 189 // Scan in reverse order to optimize for more recent versions. |
184 for (int i = kVersions.length - 1; i >= 0; --i) { | 190 for (int i = kVersions.length - 1; i >= 0; --i) { |
185 if (mainDataHeader.version >= kVersions[i].version) { | 191 if (mainDataHeader.version >= kVersions[i].version) { |
186 if (mainDataHeader.size == kVersions[i].size) { | 192 if (mainDataHeader.size == kVersions[i].size) { |
187 // Found a match. | 193 // Found a match. |
188 break; | 194 break; |
189 } | 195 } |
190 throw new bindings.MojoCodecError( | 196 throw new bindings.MojoCodecError( |
191 'Header size doesn\'t correspond to known version size.'); | 197 'Header size doesn\'t correspond to known version size.'); |
192 } | 198 } |
193 } | 199 } |
194 } else if (mainDataHeader.size < kVersions.last.size) { | 200 } else if (mainDataHeader.size < kVersions.last.size) { |
195 throw new bindings.MojoCodecError( | 201 throw new bindings.MojoCodecError( |
196 'Message newer than the last known version cannot be shorter than ' | 202 'Message newer than the last known version cannot be shorter than ' |
197 'required by the last known version.'); | 203 'required by the last known version.'); |
198 } | 204 } |
199 if (mainDataHeader.version >= 0) { | 205 if (mainDataHeader.version >= 0) { |
200 | |
201 result.username = decoder0.decodeString(8, false); | 206 result.username = decoder0.decodeString(8, false); |
202 } | 207 } |
203 if (mainDataHeader.version >= 0) { | 208 if (mainDataHeader.version >= 0) { |
204 | |
205 var decoder1 = decoder0.decodePointer(16, false); | 209 var decoder1 = decoder0.decodePointer(16, false); |
206 { | 210 { |
207 var si1 = decoder1.decodeDataHeaderForPointerArray(bindings.kUnspecified
ArrayLength); | 211 var si1 = decoder1 |
| 212 .decodeDataHeaderForPointerArray(bindings.kUnspecifiedArrayLength); |
208 result.scopes = new List<String>(si1.numElements); | 213 result.scopes = new List<String>(si1.numElements); |
209 for (int i1 = 0; i1 < si1.numElements; ++i1) { | 214 for (int i1 = 0; i1 < si1.numElements; ++i1) { |
210 | 215 result.scopes[i1] = decoder1.decodeString( |
211 result.scopes[i1] = decoder1.decodeString(bindings.ArrayDataHeader.kHe
aderSize + bindings.kPointerSize * i1, false); | 216 bindings.ArrayDataHeader.kHeaderSize + bindings.kPointerSize * i1, |
| 217 false); |
212 } | 218 } |
213 } | 219 } |
214 } | 220 } |
215 return result; | 221 return result; |
216 } | 222 } |
217 | 223 |
218 void encode(bindings.Encoder encoder) { | 224 void encode(bindings.Encoder encoder) { |
219 var encoder0 = encoder.getStructEncoderAtOffset(kVersions.last); | 225 var encoder0 = encoder.getStructEncoderAtOffset(kVersions.last); |
220 | 226 |
221 encoder0.encodeString(username, 8, false); | 227 encoder0.encodeString(username, 8, false); |
222 | 228 |
223 if (scopes == null) { | 229 if (scopes == null) { |
224 encoder0.encodeNullPointer(16, false); | 230 encoder0.encodeNullPointer(16, false); |
225 } else { | 231 } else { |
226 var encoder1 = encoder0.encodePointerArray(scopes.length, 16, bindings.kUn
specifiedArrayLength); | 232 var encoder1 = encoder0.encodePointerArray( |
| 233 scopes.length, 16, bindings.kUnspecifiedArrayLength); |
227 for (int i0 = 0; i0 < scopes.length; ++i0) { | 234 for (int i0 = 0; i0 < scopes.length; ++i0) { |
228 | 235 encoder1.encodeString( |
229 encoder1.encodeString(scopes[i0], bindings.ArrayDataHeader.kHeaderSize +
bindings.kPointerSize * i0, false); | 236 scopes[i0], |
| 237 bindings.ArrayDataHeader.kHeaderSize + bindings.kPointerSize * i0, |
| 238 false); |
230 } | 239 } |
231 } | 240 } |
232 } | 241 } |
233 | 242 |
234 String toString() { | 243 String toString() { |
235 return "_AuthenticationServiceGetOAuth2TokenParams(" | 244 return "_AuthenticationServiceGetOAuth2TokenParams(" |
236 "username: $username" ", " | 245 "username: $username" |
237 "scopes: $scopes" ")"; | 246 ", " |
| 247 "scopes: $scopes" |
| 248 ")"; |
238 } | 249 } |
239 | 250 |
240 Map toJson() { | 251 Map toJson() { |
241 Map map = new Map(); | 252 Map map = new Map(); |
242 map["username"] = username; | 253 map["username"] = username; |
243 map["scopes"] = scopes; | 254 map["scopes"] = scopes; |
244 return map; | 255 return map; |
245 } | 256 } |
246 } | 257 } |
247 | 258 |
248 | 259 class AuthenticationServiceGetOAuth2TokenResponseParams |
249 class AuthenticationServiceGetOAuth2TokenResponseParams extends bindings.Struct
{ | 260 extends bindings.Struct { |
250 static const List<bindings.StructDataHeader> kVersions = const [ | 261 static const List<bindings.StructDataHeader> kVersions = const [ |
251 const bindings.StructDataHeader(24, 0) | 262 const bindings.StructDataHeader(24, 0) |
252 ]; | 263 ]; |
253 String token = null; | 264 String token = null; |
254 String error = null; | 265 String error = null; |
255 | 266 |
256 AuthenticationServiceGetOAuth2TokenResponseParams() : super(kVersions.last.siz
e); | 267 AuthenticationServiceGetOAuth2TokenResponseParams() |
| 268 : super(kVersions.last.size); |
257 | 269 |
258 static AuthenticationServiceGetOAuth2TokenResponseParams deserialize(bindings.
Message message) { | 270 static AuthenticationServiceGetOAuth2TokenResponseParams deserialize( |
| 271 bindings.Message message) { |
259 var decoder = new bindings.Decoder(message); | 272 var decoder = new bindings.Decoder(message); |
260 var result = decode(decoder); | 273 var result = decode(decoder); |
261 if (decoder.excessHandles != null) { | 274 if (decoder.excessHandles != null) { |
262 decoder.excessHandles.forEach((h) => h.close()); | 275 decoder.excessHandles.forEach((h) => h.close()); |
263 } | 276 } |
264 return result; | 277 return result; |
265 } | 278 } |
266 | 279 |
267 static AuthenticationServiceGetOAuth2TokenResponseParams decode(bindings.Decod
er decoder0) { | 280 static AuthenticationServiceGetOAuth2TokenResponseParams decode( |
| 281 bindings.Decoder decoder0) { |
268 if (decoder0 == null) { | 282 if (decoder0 == null) { |
269 return null; | 283 return null; |
270 } | 284 } |
271 AuthenticationServiceGetOAuth2TokenResponseParams result = new Authenticatio
nServiceGetOAuth2TokenResponseParams(); | 285 AuthenticationServiceGetOAuth2TokenResponseParams result = |
| 286 new AuthenticationServiceGetOAuth2TokenResponseParams(); |
272 | 287 |
273 var mainDataHeader = decoder0.decodeStructDataHeader(); | 288 var mainDataHeader = decoder0.decodeStructDataHeader(); |
274 if (mainDataHeader.version <= kVersions.last.version) { | 289 if (mainDataHeader.version <= kVersions.last.version) { |
275 // Scan in reverse order to optimize for more recent versions. | 290 // Scan in reverse order to optimize for more recent versions. |
276 for (int i = kVersions.length - 1; i >= 0; --i) { | 291 for (int i = kVersions.length - 1; i >= 0; --i) { |
277 if (mainDataHeader.version >= kVersions[i].version) { | 292 if (mainDataHeader.version >= kVersions[i].version) { |
278 if (mainDataHeader.size == kVersions[i].size) { | 293 if (mainDataHeader.size == kVersions[i].size) { |
279 // Found a match. | 294 // Found a match. |
280 break; | 295 break; |
281 } | 296 } |
282 throw new bindings.MojoCodecError( | 297 throw new bindings.MojoCodecError( |
283 'Header size doesn\'t correspond to known version size.'); | 298 'Header size doesn\'t correspond to known version size.'); |
284 } | 299 } |
285 } | 300 } |
286 } else if (mainDataHeader.size < kVersions.last.size) { | 301 } else if (mainDataHeader.size < kVersions.last.size) { |
287 throw new bindings.MojoCodecError( | 302 throw new bindings.MojoCodecError( |
288 'Message newer than the last known version cannot be shorter than ' | 303 'Message newer than the last known version cannot be shorter than ' |
289 'required by the last known version.'); | 304 'required by the last known version.'); |
290 } | 305 } |
291 if (mainDataHeader.version >= 0) { | 306 if (mainDataHeader.version >= 0) { |
292 | |
293 result.token = decoder0.decodeString(8, true); | 307 result.token = decoder0.decodeString(8, true); |
294 } | 308 } |
295 if (mainDataHeader.version >= 0) { | 309 if (mainDataHeader.version >= 0) { |
296 | |
297 result.error = decoder0.decodeString(16, true); | 310 result.error = decoder0.decodeString(16, true); |
298 } | 311 } |
299 return result; | 312 return result; |
300 } | 313 } |
301 | 314 |
302 void encode(bindings.Encoder encoder) { | 315 void encode(bindings.Encoder encoder) { |
303 var encoder0 = encoder.getStructEncoderAtOffset(kVersions.last); | 316 var encoder0 = encoder.getStructEncoderAtOffset(kVersions.last); |
304 | 317 |
305 encoder0.encodeString(token, 8, true); | 318 encoder0.encodeString(token, 8, true); |
306 | 319 |
307 encoder0.encodeString(error, 16, true); | 320 encoder0.encodeString(error, 16, true); |
308 } | 321 } |
309 | 322 |
310 String toString() { | 323 String toString() { |
311 return "AuthenticationServiceGetOAuth2TokenResponseParams(" | 324 return "AuthenticationServiceGetOAuth2TokenResponseParams(" |
312 "token: $token" ", " | 325 "token: $token" |
313 "error: $error" ")"; | 326 ", " |
| 327 "error: $error" |
| 328 ")"; |
314 } | 329 } |
315 | 330 |
316 Map toJson() { | 331 Map toJson() { |
317 Map map = new Map(); | 332 Map map = new Map(); |
318 map["token"] = token; | 333 map["token"] = token; |
319 map["error"] = error; | 334 map["error"] = error; |
320 return map; | 335 return map; |
321 } | 336 } |
322 } | 337 } |
323 | 338 |
324 | |
325 class _AuthenticationServiceClearOAuth2TokenParams extends bindings.Struct { | 339 class _AuthenticationServiceClearOAuth2TokenParams extends bindings.Struct { |
326 static const List<bindings.StructDataHeader> kVersions = const [ | 340 static const List<bindings.StructDataHeader> kVersions = const [ |
327 const bindings.StructDataHeader(16, 0) | 341 const bindings.StructDataHeader(16, 0) |
328 ]; | 342 ]; |
329 String token = null; | 343 String token = null; |
330 | 344 |
331 _AuthenticationServiceClearOAuth2TokenParams() : super(kVersions.last.size); | 345 _AuthenticationServiceClearOAuth2TokenParams() : super(kVersions.last.size); |
332 | 346 |
333 static _AuthenticationServiceClearOAuth2TokenParams deserialize(bindings.Messa
ge message) { | 347 static _AuthenticationServiceClearOAuth2TokenParams deserialize( |
| 348 bindings.Message message) { |
334 var decoder = new bindings.Decoder(message); | 349 var decoder = new bindings.Decoder(message); |
335 var result = decode(decoder); | 350 var result = decode(decoder); |
336 if (decoder.excessHandles != null) { | 351 if (decoder.excessHandles != null) { |
337 decoder.excessHandles.forEach((h) => h.close()); | 352 decoder.excessHandles.forEach((h) => h.close()); |
338 } | 353 } |
339 return result; | 354 return result; |
340 } | 355 } |
341 | 356 |
342 static _AuthenticationServiceClearOAuth2TokenParams decode(bindings.Decoder de
coder0) { | 357 static _AuthenticationServiceClearOAuth2TokenParams decode( |
| 358 bindings.Decoder decoder0) { |
343 if (decoder0 == null) { | 359 if (decoder0 == null) { |
344 return null; | 360 return null; |
345 } | 361 } |
346 _AuthenticationServiceClearOAuth2TokenParams result = new _AuthenticationSer
viceClearOAuth2TokenParams(); | 362 _AuthenticationServiceClearOAuth2TokenParams result = |
| 363 new _AuthenticationServiceClearOAuth2TokenParams(); |
347 | 364 |
348 var mainDataHeader = decoder0.decodeStructDataHeader(); | 365 var mainDataHeader = decoder0.decodeStructDataHeader(); |
349 if (mainDataHeader.version <= kVersions.last.version) { | 366 if (mainDataHeader.version <= kVersions.last.version) { |
350 // Scan in reverse order to optimize for more recent versions. | 367 // Scan in reverse order to optimize for more recent versions. |
351 for (int i = kVersions.length - 1; i >= 0; --i) { | 368 for (int i = kVersions.length - 1; i >= 0; --i) { |
352 if (mainDataHeader.version >= kVersions[i].version) { | 369 if (mainDataHeader.version >= kVersions[i].version) { |
353 if (mainDataHeader.size == kVersions[i].size) { | 370 if (mainDataHeader.size == kVersions[i].size) { |
354 // Found a match. | 371 // Found a match. |
355 break; | 372 break; |
356 } | 373 } |
357 throw new bindings.MojoCodecError( | 374 throw new bindings.MojoCodecError( |
358 'Header size doesn\'t correspond to known version size.'); | 375 'Header size doesn\'t correspond to known version size.'); |
359 } | 376 } |
360 } | 377 } |
361 } else if (mainDataHeader.size < kVersions.last.size) { | 378 } else if (mainDataHeader.size < kVersions.last.size) { |
362 throw new bindings.MojoCodecError( | 379 throw new bindings.MojoCodecError( |
363 'Message newer than the last known version cannot be shorter than ' | 380 'Message newer than the last known version cannot be shorter than ' |
364 'required by the last known version.'); | 381 'required by the last known version.'); |
365 } | 382 } |
366 if (mainDataHeader.version >= 0) { | 383 if (mainDataHeader.version >= 0) { |
367 | |
368 result.token = decoder0.decodeString(8, false); | 384 result.token = decoder0.decodeString(8, false); |
369 } | 385 } |
370 return result; | 386 return result; |
371 } | 387 } |
372 | 388 |
373 void encode(bindings.Encoder encoder) { | 389 void encode(bindings.Encoder encoder) { |
374 var encoder0 = encoder.getStructEncoderAtOffset(kVersions.last); | 390 var encoder0 = encoder.getStructEncoderAtOffset(kVersions.last); |
375 | 391 |
376 encoder0.encodeString(token, 8, false); | 392 encoder0.encodeString(token, 8, false); |
377 } | 393 } |
378 | 394 |
379 String toString() { | 395 String toString() { |
380 return "_AuthenticationServiceClearOAuth2TokenParams(" | 396 return "_AuthenticationServiceClearOAuth2TokenParams(" |
381 "token: $token" ")"; | 397 "token: $token" |
| 398 ")"; |
382 } | 399 } |
383 | 400 |
384 Map toJson() { | 401 Map toJson() { |
385 Map map = new Map(); | 402 Map map = new Map(); |
386 map["token"] = token; | 403 map["token"] = token; |
387 return map; | 404 return map; |
388 } | 405 } |
389 } | 406 } |
390 | 407 |
| 408 class _AuthenticationServiceGetOAuth2DeviceCodeParams extends bindings.Struct { |
| 409 static const List<bindings.StructDataHeader> kVersions = const [ |
| 410 const bindings.StructDataHeader(16, 0) |
| 411 ]; |
| 412 List<String> scopes = null; |
| 413 |
| 414 _AuthenticationServiceGetOAuth2DeviceCodeParams() |
| 415 : super(kVersions.last.size); |
| 416 |
| 417 static _AuthenticationServiceGetOAuth2DeviceCodeParams deserialize( |
| 418 bindings.Message message) { |
| 419 var decoder = new bindings.Decoder(message); |
| 420 var result = decode(decoder); |
| 421 if (decoder.excessHandles != null) { |
| 422 decoder.excessHandles.forEach((h) => h.close()); |
| 423 } |
| 424 return result; |
| 425 } |
| 426 |
| 427 static _AuthenticationServiceGetOAuth2DeviceCodeParams decode( |
| 428 bindings.Decoder decoder0) { |
| 429 if (decoder0 == null) { |
| 430 return null; |
| 431 } |
| 432 _AuthenticationServiceGetOAuth2DeviceCodeParams result = |
| 433 new _AuthenticationServiceGetOAuth2DeviceCodeParams(); |
| 434 |
| 435 var mainDataHeader = decoder0.decodeStructDataHeader(); |
| 436 if (mainDataHeader.version <= kVersions.last.version) { |
| 437 // Scan in reverse order to optimize for more recent versions. |
| 438 for (int i = kVersions.length - 1; i >= 0; --i) { |
| 439 if (mainDataHeader.version >= kVersions[i].version) { |
| 440 if (mainDataHeader.size == kVersions[i].size) { |
| 441 // Found a match. |
| 442 break; |
| 443 } |
| 444 throw new bindings.MojoCodecError( |
| 445 'Header size doesn\'t correspond to known version size.'); |
| 446 } |
| 447 } |
| 448 } else if (mainDataHeader.size < kVersions.last.size) { |
| 449 throw new bindings.MojoCodecError( |
| 450 'Message newer than the last known version cannot be shorter than ' |
| 451 'required by the last known version.'); |
| 452 } |
| 453 if (mainDataHeader.version >= 0) { |
| 454 var decoder1 = decoder0.decodePointer(8, false); |
| 455 { |
| 456 var si1 = decoder1 |
| 457 .decodeDataHeaderForPointerArray(bindings.kUnspecifiedArrayLength); |
| 458 result.scopes = new List<String>(si1.numElements); |
| 459 for (int i1 = 0; i1 < si1.numElements; ++i1) { |
| 460 result.scopes[i1] = decoder1.decodeString( |
| 461 bindings.ArrayDataHeader.kHeaderSize + bindings.kPointerSize * i1, |
| 462 false); |
| 463 } |
| 464 } |
| 465 } |
| 466 return result; |
| 467 } |
| 468 |
| 469 void encode(bindings.Encoder encoder) { |
| 470 var encoder0 = encoder.getStructEncoderAtOffset(kVersions.last); |
| 471 |
| 472 if (scopes == null) { |
| 473 encoder0.encodeNullPointer(8, false); |
| 474 } else { |
| 475 var encoder1 = encoder0.encodePointerArray( |
| 476 scopes.length, 8, bindings.kUnspecifiedArrayLength); |
| 477 for (int i0 = 0; i0 < scopes.length; ++i0) { |
| 478 encoder1.encodeString( |
| 479 scopes[i0], |
| 480 bindings.ArrayDataHeader.kHeaderSize + bindings.kPointerSize * i0, |
| 481 false); |
| 482 } |
| 483 } |
| 484 } |
| 485 |
| 486 String toString() { |
| 487 return "_AuthenticationServiceGetOAuth2DeviceCodeParams(" |
| 488 "scopes: $scopes" |
| 489 ")"; |
| 490 } |
| 491 |
| 492 Map toJson() { |
| 493 Map map = new Map(); |
| 494 map["scopes"] = scopes; |
| 495 return map; |
| 496 } |
| 497 } |
| 498 |
| 499 class AuthenticationServiceGetOAuth2DeviceCodeResponseParams |
| 500 extends bindings.Struct { |
| 501 static const List<bindings.StructDataHeader> kVersions = const [ |
| 502 const bindings.StructDataHeader(40, 0) |
| 503 ]; |
| 504 String verificationUrl = null; |
| 505 String deviceCode = null; |
| 506 String userCode = null; |
| 507 String error = null; |
| 508 |
| 509 AuthenticationServiceGetOAuth2DeviceCodeResponseParams() |
| 510 : super(kVersions.last.size); |
| 511 |
| 512 static AuthenticationServiceGetOAuth2DeviceCodeResponseParams deserialize( |
| 513 bindings.Message message) { |
| 514 var decoder = new bindings.Decoder(message); |
| 515 var result = decode(decoder); |
| 516 if (decoder.excessHandles != null) { |
| 517 decoder.excessHandles.forEach((h) => h.close()); |
| 518 } |
| 519 return result; |
| 520 } |
| 521 |
| 522 static AuthenticationServiceGetOAuth2DeviceCodeResponseParams decode( |
| 523 bindings.Decoder decoder0) { |
| 524 if (decoder0 == null) { |
| 525 return null; |
| 526 } |
| 527 AuthenticationServiceGetOAuth2DeviceCodeResponseParams result = |
| 528 new AuthenticationServiceGetOAuth2DeviceCodeResponseParams(); |
| 529 |
| 530 var mainDataHeader = decoder0.decodeStructDataHeader(); |
| 531 if (mainDataHeader.version <= kVersions.last.version) { |
| 532 // Scan in reverse order to optimize for more recent versions. |
| 533 for (int i = kVersions.length - 1; i >= 0; --i) { |
| 534 if (mainDataHeader.version >= kVersions[i].version) { |
| 535 if (mainDataHeader.size == kVersions[i].size) { |
| 536 // Found a match. |
| 537 break; |
| 538 } |
| 539 throw new bindings.MojoCodecError( |
| 540 'Header size doesn\'t correspond to known version size.'); |
| 541 } |
| 542 } |
| 543 } else if (mainDataHeader.size < kVersions.last.size) { |
| 544 throw new bindings.MojoCodecError( |
| 545 'Message newer than the last known version cannot be shorter than ' |
| 546 'required by the last known version.'); |
| 547 } |
| 548 if (mainDataHeader.version >= 0) { |
| 549 result.verificationUrl = decoder0.decodeString(8, true); |
| 550 } |
| 551 if (mainDataHeader.version >= 0) { |
| 552 result.deviceCode = decoder0.decodeString(16, true); |
| 553 } |
| 554 if (mainDataHeader.version >= 0) { |
| 555 result.userCode = decoder0.decodeString(24, true); |
| 556 } |
| 557 if (mainDataHeader.version >= 0) { |
| 558 result.error = decoder0.decodeString(32, true); |
| 559 } |
| 560 return result; |
| 561 } |
| 562 |
| 563 void encode(bindings.Encoder encoder) { |
| 564 var encoder0 = encoder.getStructEncoderAtOffset(kVersions.last); |
| 565 |
| 566 encoder0.encodeString(verificationUrl, 8, true); |
| 567 |
| 568 encoder0.encodeString(deviceCode, 16, true); |
| 569 |
| 570 encoder0.encodeString(userCode, 24, true); |
| 571 |
| 572 encoder0.encodeString(error, 32, true); |
| 573 } |
| 574 |
| 575 String toString() { |
| 576 return "AuthenticationServiceGetOAuth2DeviceCodeResponseParams(" |
| 577 "verificationUrl: $verificationUrl" |
| 578 ", " |
| 579 "deviceCode: $deviceCode" |
| 580 ", " |
| 581 "userCode: $userCode" |
| 582 ", " |
| 583 "error: $error" |
| 584 ")"; |
| 585 } |
| 586 |
| 587 Map toJson() { |
| 588 Map map = new Map(); |
| 589 map["verificationUrl"] = verificationUrl; |
| 590 map["deviceCode"] = deviceCode; |
| 591 map["userCode"] = userCode; |
| 592 map["error"] = error; |
| 593 return map; |
| 594 } |
| 595 } |
| 596 |
| 597 class _AuthenticationServiceAddAccountParams extends bindings.Struct { |
| 598 static const List<bindings.StructDataHeader> kVersions = const [ |
| 599 const bindings.StructDataHeader(16, 0) |
| 600 ]; |
| 601 String deviceCode = null; |
| 602 |
| 603 _AuthenticationServiceAddAccountParams() : super(kVersions.last.size); |
| 604 |
| 605 static _AuthenticationServiceAddAccountParams deserialize( |
| 606 bindings.Message message) { |
| 607 var decoder = new bindings.Decoder(message); |
| 608 var result = decode(decoder); |
| 609 if (decoder.excessHandles != null) { |
| 610 decoder.excessHandles.forEach((h) => h.close()); |
| 611 } |
| 612 return result; |
| 613 } |
| 614 |
| 615 static _AuthenticationServiceAddAccountParams decode( |
| 616 bindings.Decoder decoder0) { |
| 617 if (decoder0 == null) { |
| 618 return null; |
| 619 } |
| 620 _AuthenticationServiceAddAccountParams result = |
| 621 new _AuthenticationServiceAddAccountParams(); |
| 622 |
| 623 var mainDataHeader = decoder0.decodeStructDataHeader(); |
| 624 if (mainDataHeader.version <= kVersions.last.version) { |
| 625 // Scan in reverse order to optimize for more recent versions. |
| 626 for (int i = kVersions.length - 1; i >= 0; --i) { |
| 627 if (mainDataHeader.version >= kVersions[i].version) { |
| 628 if (mainDataHeader.size == kVersions[i].size) { |
| 629 // Found a match. |
| 630 break; |
| 631 } |
| 632 throw new bindings.MojoCodecError( |
| 633 'Header size doesn\'t correspond to known version size.'); |
| 634 } |
| 635 } |
| 636 } else if (mainDataHeader.size < kVersions.last.size) { |
| 637 throw new bindings.MojoCodecError( |
| 638 'Message newer than the last known version cannot be shorter than ' |
| 639 'required by the last known version.'); |
| 640 } |
| 641 if (mainDataHeader.version >= 0) { |
| 642 result.deviceCode = decoder0.decodeString(8, false); |
| 643 } |
| 644 return result; |
| 645 } |
| 646 |
| 647 void encode(bindings.Encoder encoder) { |
| 648 var encoder0 = encoder.getStructEncoderAtOffset(kVersions.last); |
| 649 |
| 650 encoder0.encodeString(deviceCode, 8, false); |
| 651 } |
| 652 |
| 653 String toString() { |
| 654 return "_AuthenticationServiceAddAccountParams(" |
| 655 "deviceCode: $deviceCode" |
| 656 ")"; |
| 657 } |
| 658 |
| 659 Map toJson() { |
| 660 Map map = new Map(); |
| 661 map["deviceCode"] = deviceCode; |
| 662 return map; |
| 663 } |
| 664 } |
| 665 |
| 666 class AuthenticationServiceAddAccountResponseParams extends bindings.Struct { |
| 667 static const List<bindings.StructDataHeader> kVersions = const [ |
| 668 const bindings.StructDataHeader(24, 0) |
| 669 ]; |
| 670 String username = null; |
| 671 String error = null; |
| 672 |
| 673 AuthenticationServiceAddAccountResponseParams() : super(kVersions.last.size); |
| 674 |
| 675 static AuthenticationServiceAddAccountResponseParams deserialize( |
| 676 bindings.Message message) { |
| 677 var decoder = new bindings.Decoder(message); |
| 678 var result = decode(decoder); |
| 679 if (decoder.excessHandles != null) { |
| 680 decoder.excessHandles.forEach((h) => h.close()); |
| 681 } |
| 682 return result; |
| 683 } |
| 684 |
| 685 static AuthenticationServiceAddAccountResponseParams decode( |
| 686 bindings.Decoder decoder0) { |
| 687 if (decoder0 == null) { |
| 688 return null; |
| 689 } |
| 690 AuthenticationServiceAddAccountResponseParams result = |
| 691 new AuthenticationServiceAddAccountResponseParams(); |
| 692 |
| 693 var mainDataHeader = decoder0.decodeStructDataHeader(); |
| 694 if (mainDataHeader.version <= kVersions.last.version) { |
| 695 // Scan in reverse order to optimize for more recent versions. |
| 696 for (int i = kVersions.length - 1; i >= 0; --i) { |
| 697 if (mainDataHeader.version >= kVersions[i].version) { |
| 698 if (mainDataHeader.size == kVersions[i].size) { |
| 699 // Found a match. |
| 700 break; |
| 701 } |
| 702 throw new bindings.MojoCodecError( |
| 703 'Header size doesn\'t correspond to known version size.'); |
| 704 } |
| 705 } |
| 706 } else if (mainDataHeader.size < kVersions.last.size) { |
| 707 throw new bindings.MojoCodecError( |
| 708 'Message newer than the last known version cannot be shorter than ' |
| 709 'required by the last known version.'); |
| 710 } |
| 711 if (mainDataHeader.version >= 0) { |
| 712 result.username = decoder0.decodeString(8, true); |
| 713 } |
| 714 if (mainDataHeader.version >= 0) { |
| 715 result.error = decoder0.decodeString(16, true); |
| 716 } |
| 717 return result; |
| 718 } |
| 719 |
| 720 void encode(bindings.Encoder encoder) { |
| 721 var encoder0 = encoder.getStructEncoderAtOffset(kVersions.last); |
| 722 |
| 723 encoder0.encodeString(username, 8, true); |
| 724 |
| 725 encoder0.encodeString(error, 16, true); |
| 726 } |
| 727 |
| 728 String toString() { |
| 729 return "AuthenticationServiceAddAccountResponseParams(" |
| 730 "username: $username" |
| 731 ", " |
| 732 "error: $error" |
| 733 ")"; |
| 734 } |
| 735 |
| 736 Map toJson() { |
| 737 Map map = new Map(); |
| 738 map["username"] = username; |
| 739 map["error"] = error; |
| 740 return map; |
| 741 } |
| 742 } |
| 743 |
391 const int _AuthenticationService_selectAccountName = 0; | 744 const int _AuthenticationService_selectAccountName = 0; |
392 const int _AuthenticationService_getOAuth2TokenName = 1; | 745 const int _AuthenticationService_getOAuth2TokenName = 1; |
393 const int _AuthenticationService_clearOAuth2TokenName = 2; | 746 const int _AuthenticationService_clearOAuth2TokenName = 2; |
| 747 const int _AuthenticationService_getOAuth2DeviceCodeName = 3; |
| 748 const int _AuthenticationService_addAccountName = 4; |
394 | 749 |
395 abstract class AuthenticationService { | 750 abstract class AuthenticationService { |
396 static const String serviceName = "authentication::AuthenticationService"; | 751 static const String serviceName = "authentication::AuthenticationService"; |
397 dynamic selectAccount(bool returnLastSelected,[Function responseFactory = null
]); | 752 dynamic selectAccount(bool returnLastSelected, |
398 dynamic getOAuth2Token(String username,List<String> scopes,[Function responseF
actory = null]); | 753 [Function responseFactory = null]); |
| 754 dynamic getOAuth2Token(String username, List<String> scopes, |
| 755 [Function responseFactory = null]); |
399 void clearOAuth2Token(String token); | 756 void clearOAuth2Token(String token); |
400 } | 757 dynamic getOAuth2DeviceCode(List<String> scopes, |
401 | 758 [Function responseFactory = null]); |
| 759 dynamic addAccount(String deviceCode, [Function responseFactory = null]); |
| 760 } |
402 | 761 |
403 class _AuthenticationServiceProxyImpl extends bindings.Proxy { | 762 class _AuthenticationServiceProxyImpl extends bindings.Proxy { |
404 _AuthenticationServiceProxyImpl.fromEndpoint( | 763 _AuthenticationServiceProxyImpl.fromEndpoint( |
405 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); | 764 core.MojoMessagePipeEndpoint endpoint) |
406 | 765 : super.fromEndpoint(endpoint); |
407 _AuthenticationServiceProxyImpl.fromHandle(core.MojoHandle handle) : | 766 |
408 super.fromHandle(handle); | 767 _AuthenticationServiceProxyImpl.fromHandle(core.MojoHandle handle) |
| 768 : super.fromHandle(handle); |
409 | 769 |
410 _AuthenticationServiceProxyImpl.unbound() : super.unbound(); | 770 _AuthenticationServiceProxyImpl.unbound() : super.unbound(); |
411 | 771 |
412 static _AuthenticationServiceProxyImpl newFromEndpoint( | 772 static _AuthenticationServiceProxyImpl newFromEndpoint( |
413 core.MojoMessagePipeEndpoint endpoint) { | 773 core.MojoMessagePipeEndpoint endpoint) { |
414 assert(endpoint.setDescription("For _AuthenticationServiceProxyImpl")); | 774 assert(endpoint.setDescription("For _AuthenticationServiceProxyImpl")); |
415 return new _AuthenticationServiceProxyImpl.fromEndpoint(endpoint); | 775 return new _AuthenticationServiceProxyImpl.fromEndpoint(endpoint); |
416 } | 776 } |
417 | 777 |
418 void handleResponse(bindings.ServiceMessage message) { | 778 void handleResponse(bindings.ServiceMessage message) { |
419 switch (message.header.type) { | 779 switch (message.header.type) { |
420 case _AuthenticationService_selectAccountName: | 780 case _AuthenticationService_selectAccountName: |
421 var r = AuthenticationServiceSelectAccountResponseParams.deserialize( | 781 var r = AuthenticationServiceSelectAccountResponseParams |
422 message.payload); | 782 .deserialize(message.payload); |
423 if (!message.header.hasRequestId) { | 783 if (!message.header.hasRequestId) { |
424 proxyError("Expected a message with a valid request Id."); | 784 proxyError("Expected a message with a valid request Id."); |
425 return; | 785 return; |
426 } | 786 } |
427 Completer c = completerMap[message.header.requestId]; | 787 Completer c = completerMap[message.header.requestId]; |
428 if (c == null) { | 788 if (c == null) { |
429 proxyError( | 789 proxyError( |
430 "Message had unknown request Id: ${message.header.requestId}"); | 790 "Message had unknown request Id: ${message.header.requestId}"); |
431 return; | 791 return; |
432 } | 792 } |
433 completerMap.remove(message.header.requestId); | 793 completerMap.remove(message.header.requestId); |
434 if (c.isCompleted) { | 794 if (c.isCompleted) { |
435 proxyError("Response completer already completed"); | 795 proxyError("Response completer already completed"); |
436 return; | 796 return; |
437 } | 797 } |
438 c.complete(r); | 798 c.complete(r); |
439 break; | 799 break; |
440 case _AuthenticationService_getOAuth2TokenName: | 800 case _AuthenticationService_getOAuth2TokenName: |
441 var r = AuthenticationServiceGetOAuth2TokenResponseParams.deserialize( | 801 var r = AuthenticationServiceGetOAuth2TokenResponseParams |
442 message.payload); | 802 .deserialize(message.payload); |
443 if (!message.header.hasRequestId) { | 803 if (!message.header.hasRequestId) { |
444 proxyError("Expected a message with a valid request Id."); | 804 proxyError("Expected a message with a valid request Id."); |
445 return; | 805 return; |
| 806 } |
| 807 Completer c = completerMap[message.header.requestId]; |
| 808 if (c == null) { |
| 809 proxyError( |
| 810 "Message had unknown request Id: ${message.header.requestId}"); |
| 811 return; |
| 812 } |
| 813 completerMap.remove(message.header.requestId); |
| 814 if (c.isCompleted) { |
| 815 proxyError("Response completer already completed"); |
| 816 return; |
| 817 } |
| 818 c.complete(r); |
| 819 break; |
| 820 case _AuthenticationService_getOAuth2DeviceCodeName: |
| 821 var r = AuthenticationServiceGetOAuth2DeviceCodeResponseParams |
| 822 .deserialize(message.payload); |
| 823 if (!message.header.hasRequestId) { |
| 824 proxyError("Expected a message with a valid request Id."); |
| 825 return; |
| 826 } |
| 827 Completer c = completerMap[message.header.requestId]; |
| 828 if (c == null) { |
| 829 proxyError( |
| 830 "Message had unknown request Id: ${message.header.requestId}"); |
| 831 return; |
| 832 } |
| 833 completerMap.remove(message.header.requestId); |
| 834 if (c.isCompleted) { |
| 835 proxyError("Response completer already completed"); |
| 836 return; |
| 837 } |
| 838 c.complete(r); |
| 839 break; |
| 840 case _AuthenticationService_addAccountName: |
| 841 var r = AuthenticationServiceAddAccountResponseParams |
| 842 .deserialize(message.payload); |
| 843 if (!message.header.hasRequestId) { |
| 844 proxyError("Expected a message with a valid request Id."); |
| 845 return; |
446 } | 846 } |
447 Completer c = completerMap[message.header.requestId]; | 847 Completer c = completerMap[message.header.requestId]; |
448 if (c == null) { | 848 if (c == null) { |
449 proxyError( | 849 proxyError( |
450 "Message had unknown request Id: ${message.header.requestId}"); | 850 "Message had unknown request Id: ${message.header.requestId}"); |
451 return; | 851 return; |
452 } | 852 } |
453 completerMap.remove(message.header.requestId); | 853 completerMap.remove(message.header.requestId); |
454 if (c.isCompleted) { | 854 if (c.isCompleted) { |
455 proxyError("Response completer already completed"); | 855 proxyError("Response completer already completed"); |
456 return; | 856 return; |
457 } | 857 } |
458 c.complete(r); | 858 c.complete(r); |
459 break; | 859 break; |
460 default: | 860 default: |
461 proxyError("Unexpected message type: ${message.header.type}"); | 861 proxyError("Unexpected message type: ${message.header.type}"); |
462 close(immediate: true); | 862 close(immediate: true); |
463 break; | 863 break; |
464 } | 864 } |
465 } | 865 } |
466 | 866 |
467 String toString() { | 867 String toString() { |
468 var superString = super.toString(); | 868 var superString = super.toString(); |
469 return "_AuthenticationServiceProxyImpl($superString)"; | 869 return "_AuthenticationServiceProxyImpl($superString)"; |
470 } | 870 } |
471 } | 871 } |
472 | 872 |
473 | |
474 class _AuthenticationServiceProxyCalls implements AuthenticationService { | 873 class _AuthenticationServiceProxyCalls implements AuthenticationService { |
475 _AuthenticationServiceProxyImpl _proxyImpl; | 874 _AuthenticationServiceProxyImpl _proxyImpl; |
476 | 875 |
477 _AuthenticationServiceProxyCalls(this._proxyImpl); | 876 _AuthenticationServiceProxyCalls(this._proxyImpl); |
478 dynamic selectAccount(bool returnLastSelected,[Function responseFactory = nu
ll]) { | 877 dynamic selectAccount(bool returnLastSelected, |
479 var params = new _AuthenticationServiceSelectAccountParams(); | 878 [Function responseFactory = null]) { |
480 params.returnLastSelected = returnLastSelected; | 879 var params = new _AuthenticationServiceSelectAccountParams(); |
481 return _proxyImpl.sendMessageWithRequestId( | 880 params.returnLastSelected = returnLastSelected; |
482 params, | 881 return _proxyImpl.sendMessageWithRequestId( |
483 _AuthenticationService_selectAccountName, | 882 params, |
484 -1, | 883 _AuthenticationService_selectAccountName, |
485 bindings.MessageHeader.kMessageExpectsResponse); | 884 -1, |
| 885 bindings.MessageHeader.kMessageExpectsResponse); |
| 886 } |
| 887 |
| 888 dynamic getOAuth2Token(String username, List<String> scopes, |
| 889 [Function responseFactory = null]) { |
| 890 var params = new _AuthenticationServiceGetOAuth2TokenParams(); |
| 891 params.username = username; |
| 892 params.scopes = scopes; |
| 893 return _proxyImpl.sendMessageWithRequestId( |
| 894 params, |
| 895 _AuthenticationService_getOAuth2TokenName, |
| 896 -1, |
| 897 bindings.MessageHeader.kMessageExpectsResponse); |
| 898 } |
| 899 |
| 900 void clearOAuth2Token(String token) { |
| 901 if (!_proxyImpl.isBound) { |
| 902 _proxyImpl.proxyError("The Proxy is closed."); |
| 903 return; |
486 } | 904 } |
487 dynamic getOAuth2Token(String username,List<String> scopes,[Function respons
eFactory = null]) { | 905 var params = new _AuthenticationServiceClearOAuth2TokenParams(); |
488 var params = new _AuthenticationServiceGetOAuth2TokenParams(); | 906 params.token = token; |
489 params.username = username; | 907 _proxyImpl.sendMessage(params, _AuthenticationService_clearOAuth2TokenName); |
490 params.scopes = scopes; | 908 } |
491 return _proxyImpl.sendMessageWithRequestId( | 909 |
492 params, | 910 dynamic getOAuth2DeviceCode(List<String> scopes, |
493 _AuthenticationService_getOAuth2TokenName, | 911 [Function responseFactory = null]) { |
494 -1, | 912 var params = new _AuthenticationServiceGetOAuth2DeviceCodeParams(); |
495 bindings.MessageHeader.kMessageExpectsResponse); | 913 params.scopes = scopes; |
496 } | 914 return _proxyImpl.sendMessageWithRequestId( |
497 void clearOAuth2Token(String token) { | 915 params, |
498 if (!_proxyImpl.isBound) { | 916 _AuthenticationService_getOAuth2DeviceCodeName, |
499 _proxyImpl.proxyError("The Proxy is closed."); | 917 -1, |
500 return; | 918 bindings.MessageHeader.kMessageExpectsResponse); |
501 } | 919 } |
502 var params = new _AuthenticationServiceClearOAuth2TokenParams(); | 920 |
503 params.token = token; | 921 dynamic addAccount(String deviceCode, [Function responseFactory = null]) { |
504 _proxyImpl.sendMessage(params, _AuthenticationService_clearOAuth2TokenName
); | 922 var params = new _AuthenticationServiceAddAccountParams(); |
505 } | 923 params.deviceCode = deviceCode; |
| 924 return _proxyImpl.sendMessageWithRequestId( |
| 925 params, |
| 926 _AuthenticationService_addAccountName, |
| 927 -1, |
| 928 bindings.MessageHeader.kMessageExpectsResponse); |
| 929 } |
506 } | 930 } |
507 | 931 |
508 | |
509 class AuthenticationServiceProxy implements bindings.ProxyBase { | 932 class AuthenticationServiceProxy implements bindings.ProxyBase { |
510 final bindings.Proxy impl; | 933 final bindings.Proxy impl; |
511 AuthenticationService ptr; | 934 AuthenticationService ptr; |
512 | 935 |
513 AuthenticationServiceProxy(_AuthenticationServiceProxyImpl proxyImpl) : | 936 AuthenticationServiceProxy(_AuthenticationServiceProxyImpl proxyImpl) |
514 impl = proxyImpl, | 937 : impl = proxyImpl, |
515 ptr = new _AuthenticationServiceProxyCalls(proxyImpl); | 938 ptr = new _AuthenticationServiceProxyCalls(proxyImpl); |
516 | 939 |
517 AuthenticationServiceProxy.fromEndpoint( | 940 AuthenticationServiceProxy.fromEndpoint(core.MojoMessagePipeEndpoint endpoint) |
518 core.MojoMessagePipeEndpoint endpoint) : | 941 : impl = new _AuthenticationServiceProxyImpl.fromEndpoint(endpoint) { |
519 impl = new _AuthenticationServiceProxyImpl.fromEndpoint(endpoint) { | |
520 ptr = new _AuthenticationServiceProxyCalls(impl); | 942 ptr = new _AuthenticationServiceProxyCalls(impl); |
521 } | 943 } |
522 | 944 |
523 AuthenticationServiceProxy.fromHandle(core.MojoHandle handle) : | 945 AuthenticationServiceProxy.fromHandle(core.MojoHandle handle) |
524 impl = new _AuthenticationServiceProxyImpl.fromHandle(handle) { | 946 : impl = new _AuthenticationServiceProxyImpl.fromHandle(handle) { |
525 ptr = new _AuthenticationServiceProxyCalls(impl); | 947 ptr = new _AuthenticationServiceProxyCalls(impl); |
526 } | 948 } |
527 | 949 |
528 AuthenticationServiceProxy.unbound() : | 950 AuthenticationServiceProxy.unbound() |
529 impl = new _AuthenticationServiceProxyImpl.unbound() { | 951 : impl = new _AuthenticationServiceProxyImpl.unbound() { |
530 ptr = new _AuthenticationServiceProxyCalls(impl); | 952 ptr = new _AuthenticationServiceProxyCalls(impl); |
531 } | 953 } |
532 | 954 |
533 factory AuthenticationServiceProxy.connectToService( | 955 factory AuthenticationServiceProxy.connectToService( |
534 bindings.ServiceConnector s, String url, [String serviceName]) { | 956 bindings.ServiceConnector s, String url, |
| 957 [String serviceName]) { |
535 AuthenticationServiceProxy p = new AuthenticationServiceProxy.unbound(); | 958 AuthenticationServiceProxy p = new AuthenticationServiceProxy.unbound(); |
536 s.connectToService(url, p, serviceName); | 959 s.connectToService(url, p, serviceName); |
537 return p; | 960 return p; |
538 } | 961 } |
539 | 962 |
540 static AuthenticationServiceProxy newFromEndpoint( | 963 static AuthenticationServiceProxy newFromEndpoint( |
541 core.MojoMessagePipeEndpoint endpoint) { | 964 core.MojoMessagePipeEndpoint endpoint) { |
542 assert(endpoint.setDescription("For AuthenticationServiceProxy")); | 965 assert(endpoint.setDescription("For AuthenticationServiceProxy")); |
543 return new AuthenticationServiceProxy.fromEndpoint(endpoint); | 966 return new AuthenticationServiceProxy.fromEndpoint(endpoint); |
544 } | 967 } |
(...skipping 12 matching lines...) Expand all Loading... |
557 | 980 |
558 void requireVersion(int requiredVersion) { | 981 void requireVersion(int requiredVersion) { |
559 impl.requireVersion(requiredVersion); | 982 impl.requireVersion(requiredVersion); |
560 } | 983 } |
561 | 984 |
562 String toString() { | 985 String toString() { |
563 return "AuthenticationServiceProxy($impl)"; | 986 return "AuthenticationServiceProxy($impl)"; |
564 } | 987 } |
565 } | 988 } |
566 | 989 |
567 | |
568 class AuthenticationServiceStub extends bindings.Stub { | 990 class AuthenticationServiceStub extends bindings.Stub { |
569 AuthenticationService _impl = null; | 991 AuthenticationService _impl = null; |
570 | 992 |
571 AuthenticationServiceStub.fromEndpoint( | 993 AuthenticationServiceStub.fromEndpoint(core.MojoMessagePipeEndpoint endpoint, |
572 core.MojoMessagePipeEndpoint endpoint, [this._impl]) | 994 [this._impl]) |
573 : super.fromEndpoint(endpoint); | 995 : super.fromEndpoint(endpoint); |
574 | 996 |
575 AuthenticationServiceStub.fromHandle(core.MojoHandle handle, [this._impl]) | 997 AuthenticationServiceStub.fromHandle(core.MojoHandle handle, [this._impl]) |
576 : super.fromHandle(handle); | 998 : super.fromHandle(handle); |
577 | 999 |
578 AuthenticationServiceStub.unbound() : super.unbound(); | 1000 AuthenticationServiceStub.unbound() : super.unbound(); |
579 | 1001 |
580 static AuthenticationServiceStub newFromEndpoint( | 1002 static AuthenticationServiceStub newFromEndpoint( |
581 core.MojoMessagePipeEndpoint endpoint) { | 1003 core.MojoMessagePipeEndpoint endpoint) { |
582 assert(endpoint.setDescription("For AuthenticationServiceStub")); | 1004 assert(endpoint.setDescription("For AuthenticationServiceStub")); |
583 return new AuthenticationServiceStub.fromEndpoint(endpoint); | 1005 return new AuthenticationServiceStub.fromEndpoint(endpoint); |
584 } | 1006 } |
585 | 1007 |
586 | 1008 AuthenticationServiceSelectAccountResponseParams _AuthenticationServiceSelectA
ccountResponseParamsFactory( |
587 AuthenticationServiceSelectAccountResponseParams _AuthenticationServiceSelectA
ccountResponseParamsFactory(String username, String error) { | 1009 String username, String error) { |
588 var mojo_factory_result = new AuthenticationServiceSelectAccountResponsePara
ms(); | 1010 var mojo_factory_result = |
| 1011 new AuthenticationServiceSelectAccountResponseParams(); |
589 mojo_factory_result.username = username; | 1012 mojo_factory_result.username = username; |
590 mojo_factory_result.error = error; | 1013 mojo_factory_result.error = error; |
591 return mojo_factory_result; | 1014 return mojo_factory_result; |
592 } | 1015 } |
593 AuthenticationServiceGetOAuth2TokenResponseParams _AuthenticationServiceGetOAu
th2TokenResponseParamsFactory(String token, String error) { | 1016 |
594 var mojo_factory_result = new AuthenticationServiceGetOAuth2TokenResponsePar
ams(); | 1017 AuthenticationServiceGetOAuth2TokenResponseParams _AuthenticationServiceGetOAu
th2TokenResponseParamsFactory( |
| 1018 String token, String error) { |
| 1019 var mojo_factory_result = |
| 1020 new AuthenticationServiceGetOAuth2TokenResponseParams(); |
595 mojo_factory_result.token = token; | 1021 mojo_factory_result.token = token; |
596 mojo_factory_result.error = error; | 1022 mojo_factory_result.error = error; |
597 return mojo_factory_result; | 1023 return mojo_factory_result; |
598 } | 1024 } |
599 | 1025 |
| 1026 AuthenticationServiceGetOAuth2DeviceCodeResponseParams _AuthenticationServiceG
etOAuth2DeviceCodeResponseParamsFactory( |
| 1027 String verificationUrl, |
| 1028 String deviceCode, |
| 1029 String userCode, |
| 1030 String error) { |
| 1031 var mojo_factory_result = |
| 1032 new AuthenticationServiceGetOAuth2DeviceCodeResponseParams(); |
| 1033 mojo_factory_result.verificationUrl = verificationUrl; |
| 1034 mojo_factory_result.deviceCode = deviceCode; |
| 1035 mojo_factory_result.userCode = userCode; |
| 1036 mojo_factory_result.error = error; |
| 1037 return mojo_factory_result; |
| 1038 } |
| 1039 |
| 1040 AuthenticationServiceAddAccountResponseParams _AuthenticationServiceAddAccount
ResponseParamsFactory( |
| 1041 String username, String error) { |
| 1042 var mojo_factory_result = |
| 1043 new AuthenticationServiceAddAccountResponseParams(); |
| 1044 mojo_factory_result.username = username; |
| 1045 mojo_factory_result.error = error; |
| 1046 return mojo_factory_result; |
| 1047 } |
| 1048 |
600 dynamic handleMessage(bindings.ServiceMessage message) { | 1049 dynamic handleMessage(bindings.ServiceMessage message) { |
601 if (bindings.ControlMessageHandler.isControlMessage(message)) { | 1050 if (bindings.ControlMessageHandler.isControlMessage(message)) { |
602 return bindings.ControlMessageHandler.handleMessage(this, | 1051 return bindings.ControlMessageHandler.handleMessage(this, 0, message); |
603 0, | |
604 message); | |
605 } | 1052 } |
606 assert(_impl != null); | 1053 assert(_impl != null); |
607 switch (message.header.type) { | 1054 switch (message.header.type) { |
608 case _AuthenticationService_selectAccountName: | 1055 case _AuthenticationService_selectAccountName: |
609 var params = _AuthenticationServiceSelectAccountParams.deserialize( | 1056 var params = _AuthenticationServiceSelectAccountParams |
610 message.payload); | 1057 .deserialize(message.payload); |
611 var response = _impl.selectAccount(params.returnLastSelected,_Authentica
tionServiceSelectAccountResponseParamsFactory); | 1058 var response = _impl.selectAccount(params.returnLastSelected, |
| 1059 _AuthenticationServiceSelectAccountResponseParamsFactory); |
612 if (response is Future) { | 1060 if (response is Future) { |
613 return response.then((response) { | 1061 return response.then((response) { |
614 if (response != null) { | 1062 if (response != null) { |
615 return buildResponseWithId( | 1063 return buildResponseWithId( |
616 response, | 1064 response, |
617 _AuthenticationService_selectAccountName, | 1065 _AuthenticationService_selectAccountName, |
618 message.header.requestId, | 1066 message.header.requestId, |
619 bindings.MessageHeader.kMessageIsResponse); | 1067 bindings.MessageHeader.kMessageIsResponse); |
620 } | 1068 } |
621 }); | 1069 }); |
622 } else if (response != null) { | 1070 } else if (response != null) { |
623 return buildResponseWithId( | 1071 return buildResponseWithId( |
624 response, | 1072 response, |
625 _AuthenticationService_selectAccountName, | 1073 _AuthenticationService_selectAccountName, |
626 message.header.requestId, | 1074 message.header.requestId, |
627 bindings.MessageHeader.kMessageIsResponse); | 1075 bindings.MessageHeader.kMessageIsResponse); |
628 } | 1076 } |
629 break; | 1077 break; |
630 case _AuthenticationService_getOAuth2TokenName: | 1078 case _AuthenticationService_getOAuth2TokenName: |
631 var params = _AuthenticationServiceGetOAuth2TokenParams.deserialize( | 1079 var params = _AuthenticationServiceGetOAuth2TokenParams |
632 message.payload); | 1080 .deserialize(message.payload); |
633 var response = _impl.getOAuth2Token(params.username,params.scopes,_Authe
nticationServiceGetOAuth2TokenResponseParamsFactory); | 1081 var response = _impl.getOAuth2Token(params.username, params.scopes, |
| 1082 _AuthenticationServiceGetOAuth2TokenResponseParamsFactory); |
634 if (response is Future) { | 1083 if (response is Future) { |
635 return response.then((response) { | 1084 return response.then((response) { |
636 if (response != null) { | 1085 if (response != null) { |
637 return buildResponseWithId( | 1086 return buildResponseWithId( |
638 response, | 1087 response, |
639 _AuthenticationService_getOAuth2TokenName, | 1088 _AuthenticationService_getOAuth2TokenName, |
640 message.header.requestId, | 1089 message.header.requestId, |
641 bindings.MessageHeader.kMessageIsResponse); | 1090 bindings.MessageHeader.kMessageIsResponse); |
642 } | 1091 } |
643 }); | 1092 }); |
644 } else if (response != null) { | 1093 } else if (response != null) { |
645 return buildResponseWithId( | 1094 return buildResponseWithId( |
646 response, | 1095 response, |
647 _AuthenticationService_getOAuth2TokenName, | 1096 _AuthenticationService_getOAuth2TokenName, |
648 message.header.requestId, | 1097 message.header.requestId, |
649 bindings.MessageHeader.kMessageIsResponse); | 1098 bindings.MessageHeader.kMessageIsResponse); |
650 } | 1099 } |
651 break; | 1100 break; |
652 case _AuthenticationService_clearOAuth2TokenName: | 1101 case _AuthenticationService_clearOAuth2TokenName: |
653 var params = _AuthenticationServiceClearOAuth2TokenParams.deserialize( | 1102 var params = _AuthenticationServiceClearOAuth2TokenParams |
654 message.payload); | 1103 .deserialize(message.payload); |
655 _impl.clearOAuth2Token(params.token); | 1104 _impl.clearOAuth2Token(params.token); |
656 break; | 1105 break; |
| 1106 case _AuthenticationService_getOAuth2DeviceCodeName: |
| 1107 var params = _AuthenticationServiceGetOAuth2DeviceCodeParams |
| 1108 .deserialize(message.payload); |
| 1109 var response = _impl.getOAuth2DeviceCode(params.scopes, |
| 1110 _AuthenticationServiceGetOAuth2DeviceCodeResponseParamsFactory); |
| 1111 if (response is Future) { |
| 1112 return response.then((response) { |
| 1113 if (response != null) { |
| 1114 return buildResponseWithId( |
| 1115 response, |
| 1116 _AuthenticationService_getOAuth2DeviceCodeName, |
| 1117 message.header.requestId, |
| 1118 bindings.MessageHeader.kMessageIsResponse); |
| 1119 } |
| 1120 }); |
| 1121 } else if (response != null) { |
| 1122 return buildResponseWithId( |
| 1123 response, |
| 1124 _AuthenticationService_getOAuth2DeviceCodeName, |
| 1125 message.header.requestId, |
| 1126 bindings.MessageHeader.kMessageIsResponse); |
| 1127 } |
| 1128 break; |
| 1129 case _AuthenticationService_addAccountName: |
| 1130 var params = |
| 1131 _AuthenticationServiceAddAccountParams.deserialize(message.payload); |
| 1132 var response = _impl.addAccount(params.deviceCode, |
| 1133 _AuthenticationServiceAddAccountResponseParamsFactory); |
| 1134 if (response is Future) { |
| 1135 return response.then((response) { |
| 1136 if (response != null) { |
| 1137 return buildResponseWithId( |
| 1138 response, |
| 1139 _AuthenticationService_addAccountName, |
| 1140 message.header.requestId, |
| 1141 bindings.MessageHeader.kMessageIsResponse); |
| 1142 } |
| 1143 }); |
| 1144 } else if (response != null) { |
| 1145 return buildResponseWithId( |
| 1146 response, |
| 1147 _AuthenticationService_addAccountName, |
| 1148 message.header.requestId, |
| 1149 bindings.MessageHeader.kMessageIsResponse); |
| 1150 } |
| 1151 break; |
657 default: | 1152 default: |
658 throw new bindings.MojoCodecError("Unexpected message name"); | 1153 throw new bindings.MojoCodecError("Unexpected message name"); |
659 break; | 1154 break; |
660 } | 1155 } |
661 return null; | 1156 return null; |
662 } | 1157 } |
663 | 1158 |
664 AuthenticationService get impl => _impl; | 1159 AuthenticationService get impl => _impl; |
665 set impl(AuthenticationService d) { | 1160 set impl(AuthenticationService d) { |
666 assert(_impl == null); | 1161 assert(_impl == null); |
667 _impl = d; | 1162 _impl = d; |
668 } | 1163 } |
669 | 1164 |
670 String toString() { | 1165 String toString() { |
671 var superString = super.toString(); | 1166 var superString = super.toString(); |
672 return "AuthenticationServiceStub($superString)"; | 1167 return "AuthenticationServiceStub($superString)"; |
673 } | 1168 } |
674 | 1169 |
675 int get version => 0; | 1170 int get version => 0; |
676 } | 1171 } |
677 | |
678 | |
OLD | NEW |