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

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

Issue 1466733002: Google OAuth Device Flow support for FNL (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: updated demo namespaces Created 5 years 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 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 m essage) { 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 decode r0) { 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 AuthenticationServiceS electAccountParams(); 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 decod er0) { 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 AuthenticationService GetOAuth2TokenParams(); 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.Messag e 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 dec oder0) { 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 AuthenticationServi ceClearOAuth2TokenParams(); 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() : super(kVersions.last.size);
415
416 static AuthenticationServiceGetOAuth2DeviceCodeParams deserialize(
417 bindings.Message message) {
418 var decoder = new bindings.Decoder(message);
419 var result = decode(decoder);
420 if (decoder.excessHandles != null) {
421 decoder.excessHandles.forEach((h) => h.close());
422 }
423 return result;
424 }
425
426 static AuthenticationServiceGetOAuth2DeviceCodeParams decode(
427 bindings.Decoder decoder0) {
428 if (decoder0 == null) {
429 return null;
430 }
431 AuthenticationServiceGetOAuth2DeviceCodeParams result =
432 new AuthenticationServiceGetOAuth2DeviceCodeParams();
433
434 var mainDataHeader = decoder0.decodeStructDataHeader();
435 if (mainDataHeader.version <= kVersions.last.version) {
436 // Scan in reverse order to optimize for more recent versions.
437 for (int i = kVersions.length - 1; i >= 0; --i) {
438 if (mainDataHeader.version >= kVersions[i].version) {
439 if (mainDataHeader.size == kVersions[i].size) {
440 // Found a match.
441 break;
442 }
443 throw new bindings.MojoCodecError(
444 'Header size doesn\'t correspond to known version size.');
445 }
446 }
447 } else if (mainDataHeader.size < kVersions.last.size) {
448 throw new bindings.MojoCodecError(
449 'Message newer than the last known version cannot be shorter than '
450 'required by the last known version.');
451 }
452 if (mainDataHeader.version >= 0) {
453 var decoder1 = decoder0.decodePointer(8, false);
454 {
455 var si1 = decoder1
456 .decodeDataHeaderForPointerArray(bindings.kUnspecifiedArrayLength);
457 result.scopes = new List<String>(si1.numElements);
458 for (int i1 = 0; i1 < si1.numElements; ++i1) {
459 result.scopes[i1] = decoder1.decodeString(
460 bindings.ArrayDataHeader.kHeaderSize + bindings.kPointerSize * i1,
461 false);
462 }
463 }
464 }
465 return result;
466 }
467
468 void encode(bindings.Encoder encoder) {
469 var encoder0 = encoder.getStructEncoderAtOffset(kVersions.last);
470
471 if (scopes == null) {
472 encoder0.encodeNullPointer(8, false);
473 } else {
474 var encoder1 = encoder0.encodePointerArray(
475 scopes.length, 8, bindings.kUnspecifiedArrayLength);
476 for (int i0 = 0; i0 < scopes.length; ++i0) {
477 encoder1.encodeString(
478 scopes[i0],
479 bindings.ArrayDataHeader.kHeaderSize + bindings.kPointerSize * i0,
480 false);
481 }
482 }
483 }
484
485 String toString() {
486 return "AuthenticationServiceGetOAuth2DeviceCodeParams("
487 "scopes: $scopes"
488 ")";
489 }
490
491 Map toJson() {
492 Map map = new Map();
493 map["scopes"] = scopes;
494 return map;
495 }
496 }
497
498 class AuthenticationServiceGetOAuth2DeviceCodeResponseParams
499 extends bindings.Struct {
500 static const List<bindings.StructDataHeader> kVersions = const [
501 const bindings.StructDataHeader(40, 0)
502 ];
503 String verificationUrl = null;
504 String deviceCode = null;
505 String userCode = null;
506 String error = null;
507
508 AuthenticationServiceGetOAuth2DeviceCodeResponseParams()
509 : super(kVersions.last.size);
510
511 static AuthenticationServiceGetOAuth2DeviceCodeResponseParams deserialize(
512 bindings.Message message) {
513 var decoder = new bindings.Decoder(message);
514 var result = decode(decoder);
515 if (decoder.excessHandles != null) {
516 decoder.excessHandles.forEach((h) => h.close());
517 }
518 return result;
519 }
520
521 static AuthenticationServiceGetOAuth2DeviceCodeResponseParams decode(
522 bindings.Decoder decoder0) {
523 if (decoder0 == null) {
524 return null;
525 }
526 AuthenticationServiceGetOAuth2DeviceCodeResponseParams result =
527 new AuthenticationServiceGetOAuth2DeviceCodeResponseParams();
528
529 var mainDataHeader = decoder0.decodeStructDataHeader();
530 if (mainDataHeader.version <= kVersions.last.version) {
531 // Scan in reverse order to optimize for more recent versions.
532 for (int i = kVersions.length - 1; i >= 0; --i) {
533 if (mainDataHeader.version >= kVersions[i].version) {
534 if (mainDataHeader.size == kVersions[i].size) {
535 // Found a match.
536 break;
537 }
538 throw new bindings.MojoCodecError(
539 'Header size doesn\'t correspond to known version size.');
540 }
541 }
542 } else if (mainDataHeader.size < kVersions.last.size) {
543 throw new bindings.MojoCodecError(
544 'Message newer than the last known version cannot be shorter than '
545 'required by the last known version.');
546 }
547 if (mainDataHeader.version >= 0) {
548 result.verificationUrl = decoder0.decodeString(8, true);
549 }
550 if (mainDataHeader.version >= 0) {
551 result.deviceCode = decoder0.decodeString(16, true);
552 }
553 if (mainDataHeader.version >= 0) {
554 result.userCode = decoder0.decodeString(24, true);
555 }
556 if (mainDataHeader.version >= 0) {
557 result.error = decoder0.decodeString(32, true);
558 }
559 return result;
560 }
561
562 void encode(bindings.Encoder encoder) {
563 var encoder0 = encoder.getStructEncoderAtOffset(kVersions.last);
564
565 encoder0.encodeString(verificationUrl, 8, true);
566
567 encoder0.encodeString(deviceCode, 16, true);
568
569 encoder0.encodeString(userCode, 24, true);
570
571 encoder0.encodeString(error, 32, true);
572 }
573
574 String toString() {
575 return "AuthenticationServiceGetOAuth2DeviceCodeResponseParams("
576 "verificationUrl: $verificationUrl"
577 ", "
578 "deviceCode: $deviceCode"
579 ", "
580 "userCode: $userCode"
581 ", "
582 "error: $error"
583 ")";
584 }
585
586 Map toJson() {
587 Map map = new Map();
588 map["verificationUrl"] = verificationUrl;
589 map["deviceCode"] = deviceCode;
590 map["userCode"] = userCode;
591 map["error"] = error;
592 return map;
593 }
594 }
595
596 class AuthenticationServiceAddAccountParams extends bindings.Struct {
597 static const List<bindings.StructDataHeader> kVersions = const [
598 const bindings.StructDataHeader(16, 0)
599 ];
600 String deviceCode = null;
601
602 AuthenticationServiceAddAccountParams() : super(kVersions.last.size);
603
604 static AuthenticationServiceAddAccountParams deserialize(
605 bindings.Message message) {
606 var decoder = new bindings.Decoder(message);
607 var result = decode(decoder);
608 if (decoder.excessHandles != null) {
609 decoder.excessHandles.forEach((h) => h.close());
610 }
611 return result;
612 }
613
614 static AuthenticationServiceAddAccountParams decode(
615 bindings.Decoder decoder0) {
616 if (decoder0 == null) {
617 return null;
618 }
619 AuthenticationServiceAddAccountParams result =
620 new AuthenticationServiceAddAccountParams();
621
622 var mainDataHeader = decoder0.decodeStructDataHeader();
623 if (mainDataHeader.version <= kVersions.last.version) {
624 // Scan in reverse order to optimize for more recent versions.
625 for (int i = kVersions.length - 1; i >= 0; --i) {
626 if (mainDataHeader.version >= kVersions[i].version) {
627 if (mainDataHeader.size == kVersions[i].size) {
628 // Found a match.
629 break;
630 }
631 throw new bindings.MojoCodecError(
632 'Header size doesn\'t correspond to known version size.');
633 }
634 }
635 } else if (mainDataHeader.size < kVersions.last.size) {
636 throw new bindings.MojoCodecError(
637 'Message newer than the last known version cannot be shorter than '
638 'required by the last known version.');
639 }
640 if (mainDataHeader.version >= 0) {
641 result.deviceCode = decoder0.decodeString(8, false);
642 }
643 return result;
644 }
645
646 void encode(bindings.Encoder encoder) {
647 var encoder0 = encoder.getStructEncoderAtOffset(kVersions.last);
648
649 encoder0.encodeString(deviceCode, 8, false);
650 }
651
652 String toString() {
653 return "AuthenticationServiceAddAccountParams("
654 "deviceCode: $deviceCode"
655 ")";
656 }
657
658 Map toJson() {
659 Map map = new Map();
660 map["deviceCode"] = deviceCode;
661 return map;
662 }
663 }
664
665 class AuthenticationServiceAddAccountResponseParams extends bindings.Struct {
666 static const List<bindings.StructDataHeader> kVersions = const [
667 const bindings.StructDataHeader(24, 0)
668 ];
669 String username = null;
670 String error = null;
671
672 AuthenticationServiceAddAccountResponseParams() : super(kVersions.last.size);
673
674 static AuthenticationServiceAddAccountResponseParams deserialize(
675 bindings.Message message) {
676 var decoder = new bindings.Decoder(message);
677 var result = decode(decoder);
678 if (decoder.excessHandles != null) {
679 decoder.excessHandles.forEach((h) => h.close());
680 }
681 return result;
682 }
683
684 static AuthenticationServiceAddAccountResponseParams decode(
685 bindings.Decoder decoder0) {
686 if (decoder0 == null) {
687 return null;
688 }
689 AuthenticationServiceAddAccountResponseParams result =
690 new AuthenticationServiceAddAccountResponseParams();
691
692 var mainDataHeader = decoder0.decodeStructDataHeader();
693 if (mainDataHeader.version <= kVersions.last.version) {
694 // Scan in reverse order to optimize for more recent versions.
695 for (int i = kVersions.length - 1; i >= 0; --i) {
696 if (mainDataHeader.version >= kVersions[i].version) {
697 if (mainDataHeader.size == kVersions[i].size) {
698 // Found a match.
699 break;
700 }
701 throw new bindings.MojoCodecError(
702 'Header size doesn\'t correspond to known version size.');
703 }
704 }
705 } else if (mainDataHeader.size < kVersions.last.size) {
706 throw new bindings.MojoCodecError(
707 'Message newer than the last known version cannot be shorter than '
708 'required by the last known version.');
709 }
710 if (mainDataHeader.version >= 0) {
711 result.username = decoder0.decodeString(8, true);
712 }
713 if (mainDataHeader.version >= 0) {
714 result.error = decoder0.decodeString(16, true);
715 }
716 return result;
717 }
718
719 void encode(bindings.Encoder encoder) {
720 var encoder0 = encoder.getStructEncoderAtOffset(kVersions.last);
721
722 encoder0.encodeString(username, 8, true);
723
724 encoder0.encodeString(error, 16, true);
725 }
726
727 String toString() {
728 return "AuthenticationServiceAddAccountResponseParams("
729 "username: $username"
730 ", "
731 "error: $error"
732 ")";
733 }
734
735 Map toJson() {
736 Map map = new Map();
737 map["username"] = username;
738 map["error"] = error;
739 return map;
740 }
741 }
742
391 const int kAuthenticationService_selectAccount_name = 0; 743 const int kAuthenticationService_selectAccount_name = 0;
392 const int kAuthenticationService_getOAuth2Token_name = 1; 744 const int kAuthenticationService_getOAuth2Token_name = 1;
393 const int kAuthenticationService_clearOAuth2Token_name = 2; 745 const int kAuthenticationService_clearOAuth2Token_name = 2;
746 const int kAuthenticationService_getOAuth2DeviceCode_name = 3;
747 const int kAuthenticationService_addAccount_name = 4;
394 748
395 const String AuthenticationServiceName = 749 const String AuthenticationServiceName =
396 'authentication::AuthenticationService'; 750 'authentication::AuthenticationService';
397 751
398 abstract class AuthenticationService { 752 abstract class AuthenticationService {
399 dynamic selectAccount(bool returnLastSelected,[Function responseFactory = null ]); 753 dynamic selectAccount(bool returnLastSelected,
400 dynamic getOAuth2Token(String username,List<String> scopes,[Function responseF actory = null]); 754 [Function responseFactory = null]);
755 dynamic getOAuth2Token(String username, List<String> scopes,
756 [Function responseFactory = null]);
401 void clearOAuth2Token(String token); 757 void clearOAuth2Token(String token);
402 758 dynamic getOAuth2DeviceCode(List<String> scopes,
403 } 759 [Function responseFactory = null]);
404 760 dynamic addAccount(String deviceCode, [Function responseFactory = null]);
761 }
405 762
406 class AuthenticationServiceProxyImpl extends bindings.Proxy { 763 class AuthenticationServiceProxyImpl extends bindings.Proxy {
407 AuthenticationServiceProxyImpl.fromEndpoint( 764 AuthenticationServiceProxyImpl.fromEndpoint(
408 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); 765 core.MojoMessagePipeEndpoint endpoint)
409 766 : super.fromEndpoint(endpoint);
410 AuthenticationServiceProxyImpl.fromHandle(core.MojoHandle handle) : 767
411 super.fromHandle(handle); 768 AuthenticationServiceProxyImpl.fromHandle(core.MojoHandle handle)
769 : super.fromHandle(handle);
412 770
413 AuthenticationServiceProxyImpl.unbound() : super.unbound(); 771 AuthenticationServiceProxyImpl.unbound() : super.unbound();
414 772
415 static AuthenticationServiceProxyImpl newFromEndpoint( 773 static AuthenticationServiceProxyImpl newFromEndpoint(
416 core.MojoMessagePipeEndpoint endpoint) { 774 core.MojoMessagePipeEndpoint endpoint) {
417 assert(endpoint.setDescription("For AuthenticationServiceProxyImpl")); 775 assert(endpoint.setDescription("For AuthenticationServiceProxyImpl"));
418 return new AuthenticationServiceProxyImpl.fromEndpoint(endpoint); 776 return new AuthenticationServiceProxyImpl.fromEndpoint(endpoint);
419 } 777 }
420 778
421 String get name => AuthenticationServiceName; 779 String get name => AuthenticationServiceName;
422 780
423 void handleResponse(bindings.ServiceMessage message) { 781 void handleResponse(bindings.ServiceMessage message) {
424 switch (message.header.type) { 782 switch (message.header.type) {
425 case kAuthenticationService_selectAccount_name: 783 case kAuthenticationService_selectAccount_name:
426 var r = AuthenticationServiceSelectAccountResponseParams.deserialize( 784 var r = AuthenticationServiceSelectAccountResponseParams
427 message.payload); 785 .deserialize(message.payload);
428 if (!message.header.hasRequestId) { 786 if (!message.header.hasRequestId) {
429 proxyError("Expected a message with a valid request Id."); 787 proxyError("Expected a message with a valid request Id.");
430 return; 788 return;
431 } 789 }
432 Completer c = completerMap[message.header.requestId]; 790 Completer c = completerMap[message.header.requestId];
433 if (c == null) { 791 if (c == null) {
434 proxyError( 792 proxyError(
435 "Message had unknown request Id: ${message.header.requestId}"); 793 "Message had unknown request Id: ${message.header.requestId}");
436 return; 794 return;
437 } 795 }
438 completerMap.remove(message.header.requestId); 796 completerMap.remove(message.header.requestId);
439 if (c.isCompleted) { 797 if (c.isCompleted) {
440 proxyError("Response completer already completed"); 798 proxyError("Response completer already completed");
441 return; 799 return;
442 } 800 }
443 c.complete(r); 801 c.complete(r);
444 break; 802 break;
445 case kAuthenticationService_getOAuth2Token_name: 803 case kAuthenticationService_getOAuth2Token_name:
446 var r = AuthenticationServiceGetOAuth2TokenResponseParams.deserialize( 804 var r = AuthenticationServiceGetOAuth2TokenResponseParams
447 message.payload); 805 .deserialize(message.payload);
448 if (!message.header.hasRequestId) { 806 if (!message.header.hasRequestId) {
449 proxyError("Expected a message with a valid request Id."); 807 proxyError("Expected a message with a valid request Id.");
450 return; 808 return;
809 }
810 Completer c = completerMap[message.header.requestId];
811 if (c == null) {
812 proxyError(
813 "Message had unknown request Id: ${message.header.requestId}");
814 return;
815 }
816 completerMap.remove(message.header.requestId);
817 if (c.isCompleted) {
818 proxyError("Response completer already completed");
819 return;
820 }
821 c.complete(r);
822 break;
823 case kAuthenticationService_getOAuth2DeviceCode_name:
824 var r = AuthenticationServiceGetOAuth2DeviceCodeResponseParams
825 .deserialize(message.payload);
826 if (!message.header.hasRequestId) {
827 proxyError("Expected a message with a valid request Id.");
828 return;
829 }
830 Completer c = completerMap[message.header.requestId];
831 if (c == null) {
832 proxyError(
833 "Message had unknown request Id: ${message.header.requestId}");
834 return;
835 }
836 completerMap.remove(message.header.requestId);
837 if (c.isCompleted) {
838 proxyError("Response completer already completed");
839 return;
840 }
841 c.complete(r);
842 break;
843 case kAuthenticationService_addAccount_name:
844 var r = AuthenticationServiceAddAccountResponseParams
845 .deserialize(message.payload);
846 if (!message.header.hasRequestId) {
847 proxyError("Expected a message with a valid request Id.");
848 return;
451 } 849 }
452 Completer c = completerMap[message.header.requestId]; 850 Completer c = completerMap[message.header.requestId];
453 if (c == null) { 851 if (c == null) {
454 proxyError( 852 proxyError(
455 "Message had unknown request Id: ${message.header.requestId}"); 853 "Message had unknown request Id: ${message.header.requestId}");
456 return; 854 return;
457 } 855 }
458 completerMap.remove(message.header.requestId); 856 completerMap.remove(message.header.requestId);
459 if (c.isCompleted) { 857 if (c.isCompleted) {
460 proxyError("Response completer already completed"); 858 proxyError("Response completer already completed");
461 return; 859 return;
462 } 860 }
463 c.complete(r); 861 c.complete(r);
464 break; 862 break;
465 default: 863 default:
466 proxyError("Unexpected message type: ${message.header.type}"); 864 proxyError("Unexpected message type: ${message.header.type}");
467 close(immediate: true); 865 close(immediate: true);
468 break; 866 break;
469 } 867 }
470 } 868 }
471 869
472 String toString() { 870 String toString() {
473 var superString = super.toString(); 871 var superString = super.toString();
474 return "AuthenticationServiceProxyImpl($superString)"; 872 return "AuthenticationServiceProxyImpl($superString)";
475 } 873 }
476 } 874 }
477 875
478
479 class _AuthenticationServiceProxyCalls implements AuthenticationService { 876 class _AuthenticationServiceProxyCalls implements AuthenticationService {
480 AuthenticationServiceProxyImpl _proxyImpl; 877 AuthenticationServiceProxyImpl _proxyImpl;
481 878
482 _AuthenticationServiceProxyCalls(this._proxyImpl); 879 _AuthenticationServiceProxyCalls(this._proxyImpl);
483 dynamic selectAccount(bool returnLastSelected,[Function responseFactory = nu ll]) { 880 dynamic selectAccount(bool returnLastSelected,
484 var params = new AuthenticationServiceSelectAccountParams(); 881 [Function responseFactory = null]) {
485 params.returnLastSelected = returnLastSelected; 882 var params = new AuthenticationServiceSelectAccountParams();
486 return _proxyImpl.sendMessageWithRequestId( 883 params.returnLastSelected = returnLastSelected;
487 params, 884 return _proxyImpl.sendMessageWithRequestId(
488 kAuthenticationService_selectAccount_name, 885 params,
489 -1, 886 kAuthenticationService_selectAccount_name,
490 bindings.MessageHeader.kMessageExpectsResponse); 887 -1,
888 bindings.MessageHeader.kMessageExpectsResponse);
889 }
890
891 dynamic getOAuth2Token(String username, List<String> scopes,
892 [Function responseFactory = null]) {
893 var params = new AuthenticationServiceGetOAuth2TokenParams();
894 params.username = username;
895 params.scopes = scopes;
896 return _proxyImpl.sendMessageWithRequestId(
897 params,
898 kAuthenticationService_getOAuth2Token_name,
899 -1,
900 bindings.MessageHeader.kMessageExpectsResponse);
901 }
902
903 void clearOAuth2Token(String token) {
904 if (!_proxyImpl.isBound) {
905 _proxyImpl.proxyError("The Proxy is closed.");
906 return;
491 } 907 }
492 dynamic getOAuth2Token(String username,List<String> scopes,[Function respons eFactory = null]) { 908 var params = new AuthenticationServiceClearOAuth2TokenParams();
493 var params = new AuthenticationServiceGetOAuth2TokenParams(); 909 params.token = token;
494 params.username = username; 910 _proxyImpl.sendMessage(
495 params.scopes = scopes; 911 params, kAuthenticationService_clearOAuth2Token_name);
496 return _proxyImpl.sendMessageWithRequestId( 912 }
497 params, 913
498 kAuthenticationService_getOAuth2Token_name, 914 dynamic getOAuth2DeviceCode(List<String> scopes,
499 -1, 915 [Function responseFactory = null]) {
500 bindings.MessageHeader.kMessageExpectsResponse); 916 var params = new AuthenticationServiceGetOAuth2DeviceCodeParams();
501 } 917 params.scopes = scopes;
502 void clearOAuth2Token(String token) { 918 return _proxyImpl.sendMessageWithRequestId(
503 if (!_proxyImpl.isBound) { 919 params,
504 _proxyImpl.proxyError("The Proxy is closed."); 920 kAuthenticationService_getOAuth2DeviceCode_name,
505 return; 921 -1,
506 } 922 bindings.MessageHeader.kMessageExpectsResponse);
507 var params = new AuthenticationServiceClearOAuth2TokenParams(); 923 }
508 params.token = token; 924
509 _proxyImpl.sendMessage(params, kAuthenticationService_clearOAuth2Token_nam e); 925 dynamic addAccount(String deviceCode, [Function responseFactory = null]) {
510 } 926 var params = new AuthenticationServiceAddAccountParams();
511 927 params.deviceCode = deviceCode;
928 return _proxyImpl.sendMessageWithRequestId(
929 params,
930 kAuthenticationService_addAccount_name,
931 -1,
932 bindings.MessageHeader.kMessageExpectsResponse);
933 }
512 } 934 }
513 935
514
515 class AuthenticationServiceProxy implements bindings.ProxyBase { 936 class AuthenticationServiceProxy implements bindings.ProxyBase {
516 final bindings.Proxy impl; 937 final bindings.Proxy impl;
517 AuthenticationService ptr; 938 AuthenticationService ptr;
518 final String name = AuthenticationServiceName; 939 final String name = AuthenticationServiceName;
519 940
520 AuthenticationServiceProxy(AuthenticationServiceProxyImpl proxyImpl) : 941 AuthenticationServiceProxy(AuthenticationServiceProxyImpl proxyImpl)
521 impl = proxyImpl, 942 : impl = proxyImpl,
522 ptr = new _AuthenticationServiceProxyCalls(proxyImpl); 943 ptr = new _AuthenticationServiceProxyCalls(proxyImpl);
523 944
524 AuthenticationServiceProxy.fromEndpoint( 945 AuthenticationServiceProxy.fromEndpoint(core.MojoMessagePipeEndpoint endpoint)
525 core.MojoMessagePipeEndpoint endpoint) : 946 : impl = new AuthenticationServiceProxyImpl.fromEndpoint(endpoint) {
526 impl = new AuthenticationServiceProxyImpl.fromEndpoint(endpoint) {
527 ptr = new _AuthenticationServiceProxyCalls(impl); 947 ptr = new _AuthenticationServiceProxyCalls(impl);
528 } 948 }
529 949
530 AuthenticationServiceProxy.fromHandle(core.MojoHandle handle) : 950 AuthenticationServiceProxy.fromHandle(core.MojoHandle handle)
531 impl = new AuthenticationServiceProxyImpl.fromHandle(handle) { 951 : impl = new AuthenticationServiceProxyImpl.fromHandle(handle) {
532 ptr = new _AuthenticationServiceProxyCalls(impl); 952 ptr = new _AuthenticationServiceProxyCalls(impl);
533 } 953 }
534 954
535 AuthenticationServiceProxy.unbound() : 955 AuthenticationServiceProxy.unbound()
536 impl = new AuthenticationServiceProxyImpl.unbound() { 956 : impl = new AuthenticationServiceProxyImpl.unbound() {
537 ptr = new _AuthenticationServiceProxyCalls(impl); 957 ptr = new _AuthenticationServiceProxyCalls(impl);
538 } 958 }
539 959
540 factory AuthenticationServiceProxy.connectToService( 960 factory AuthenticationServiceProxy.connectToService(
541 bindings.ServiceConnector s, String url) { 961 bindings.ServiceConnector s, String url) {
542 AuthenticationServiceProxy p = new AuthenticationServiceProxy.unbound(); 962 AuthenticationServiceProxy p = new AuthenticationServiceProxy.unbound();
543 s.connectToService(url, p); 963 s.connectToService(url, p);
544 return p; 964 return p;
545 } 965 }
546 966
(...skipping 15 matching lines...) Expand all
562 982
563 void requireVersion(int requiredVersion) { 983 void requireVersion(int requiredVersion) {
564 impl.requireVersion(requiredVersion); 984 impl.requireVersion(requiredVersion);
565 } 985 }
566 986
567 String toString() { 987 String toString() {
568 return "AuthenticationServiceProxy($impl)"; 988 return "AuthenticationServiceProxy($impl)";
569 } 989 }
570 } 990 }
571 991
572
573 class AuthenticationServiceStub extends bindings.Stub { 992 class AuthenticationServiceStub extends bindings.Stub {
574 AuthenticationService _impl = null; 993 AuthenticationService _impl = null;
575 994
576 AuthenticationServiceStub.fromEndpoint( 995 AuthenticationServiceStub.fromEndpoint(core.MojoMessagePipeEndpoint endpoint,
577 core.MojoMessagePipeEndpoint endpoint, [this._impl]) 996 [this._impl])
578 : super.fromEndpoint(endpoint); 997 : super.fromEndpoint(endpoint);
579 998
580 AuthenticationServiceStub.fromHandle(core.MojoHandle handle, [this._impl]) 999 AuthenticationServiceStub.fromHandle(core.MojoHandle handle, [this._impl])
581 : super.fromHandle(handle); 1000 : super.fromHandle(handle);
582 1001
583 AuthenticationServiceStub.unbound() : super.unbound(); 1002 AuthenticationServiceStub.unbound() : super.unbound();
584 1003
585 static AuthenticationServiceStub newFromEndpoint( 1004 static AuthenticationServiceStub newFromEndpoint(
586 core.MojoMessagePipeEndpoint endpoint) { 1005 core.MojoMessagePipeEndpoint endpoint) {
587 assert(endpoint.setDescription("For AuthenticationServiceStub")); 1006 assert(endpoint.setDescription("For AuthenticationServiceStub"));
588 return new AuthenticationServiceStub.fromEndpoint(endpoint); 1007 return new AuthenticationServiceStub.fromEndpoint(endpoint);
589 } 1008 }
590 1009
591 static const String name = AuthenticationServiceName; 1010 static const String name = AuthenticationServiceName;
592 1011
593 1012 AuthenticationServiceSelectAccountResponseParams _AuthenticationServiceSelectA ccountResponseParamsFactory(
594 AuthenticationServiceSelectAccountResponseParams _AuthenticationServiceSelectA ccountResponseParamsFactory(String username, String error) { 1013 String username, String error) {
595 var mojo_factory_result = new AuthenticationServiceSelectAccountResponsePara ms(); 1014 var mojo_factory_result =
1015 new AuthenticationServiceSelectAccountResponseParams();
596 mojo_factory_result.username = username; 1016 mojo_factory_result.username = username;
597 mojo_factory_result.error = error; 1017 mojo_factory_result.error = error;
598 return mojo_factory_result; 1018 return mojo_factory_result;
599 } 1019 }
600 AuthenticationServiceGetOAuth2TokenResponseParams _AuthenticationServiceGetOAu th2TokenResponseParamsFactory(String token, String error) { 1020
601 var mojo_factory_result = new AuthenticationServiceGetOAuth2TokenResponsePar ams(); 1021 AuthenticationServiceGetOAuth2TokenResponseParams _AuthenticationServiceGetOAu th2TokenResponseParamsFactory(
1022 String token, String error) {
1023 var mojo_factory_result =
1024 new AuthenticationServiceGetOAuth2TokenResponseParams();
602 mojo_factory_result.token = token; 1025 mojo_factory_result.token = token;
603 mojo_factory_result.error = error; 1026 mojo_factory_result.error = error;
604 return mojo_factory_result; 1027 return mojo_factory_result;
605 } 1028 }
606 1029
1030 AuthenticationServiceGetOAuth2DeviceCodeResponseParams _AuthenticationServiceG etOAuth2DeviceCodeResponseParamsFactory(
1031 String verificationUrl,
1032 String deviceCode,
1033 String userCode,
1034 String error) {
1035 var mojo_factory_result =
1036 new AuthenticationServiceGetOAuth2DeviceCodeResponseParams();
1037 mojo_factory_result.verificationUrl = verificationUrl;
1038 mojo_factory_result.deviceCode = deviceCode;
1039 mojo_factory_result.userCode = userCode;
1040 mojo_factory_result.error = error;
1041 return mojo_factory_result;
1042 }
1043
1044 AuthenticationServiceAddAccountResponseParams _AuthenticationServiceAddAccount ResponseParamsFactory(
1045 String username, String error) {
1046 var mojo_factory_result =
1047 new AuthenticationServiceAddAccountResponseParams();
1048 mojo_factory_result.username = username;
1049 mojo_factory_result.error = error;
1050 return mojo_factory_result;
1051 }
1052
607 dynamic handleMessage(bindings.ServiceMessage message) { 1053 dynamic handleMessage(bindings.ServiceMessage message) {
608 if (bindings.ControlMessageHandler.isControlMessage(message)) { 1054 if (bindings.ControlMessageHandler.isControlMessage(message)) {
609 return bindings.ControlMessageHandler.handleMessage(this, 1055 return bindings.ControlMessageHandler.handleMessage(this, 0, message);
610 0,
611 message);
612 } 1056 }
613 assert(_impl != null); 1057 assert(_impl != null);
614 switch (message.header.type) { 1058 switch (message.header.type) {
615 case kAuthenticationService_selectAccount_name: 1059 case kAuthenticationService_selectAccount_name:
616 var params = AuthenticationServiceSelectAccountParams.deserialize( 1060 var params = AuthenticationServiceSelectAccountParams
617 message.payload); 1061 .deserialize(message.payload);
618 var response = _impl.selectAccount(params.returnLastSelected,_Authentica tionServiceSelectAccountResponseParamsFactory); 1062 var response = _impl.selectAccount(params.returnLastSelected,
1063 _AuthenticationServiceSelectAccountResponseParamsFactory);
619 if (response is Future) { 1064 if (response is Future) {
620 return response.then((response) { 1065 return response.then((response) {
621 if (response != null) { 1066 if (response != null) {
622 return buildResponseWithId( 1067 return buildResponseWithId(
623 response, 1068 response,
624 kAuthenticationService_selectAccount_name, 1069 kAuthenticationService_selectAccount_name,
625 message.header.requestId, 1070 message.header.requestId,
626 bindings.MessageHeader.kMessageIsResponse); 1071 bindings.MessageHeader.kMessageIsResponse);
627 } 1072 }
628 }); 1073 });
629 } else if (response != null) { 1074 } else if (response != null) {
630 return buildResponseWithId( 1075 return buildResponseWithId(
631 response, 1076 response,
632 kAuthenticationService_selectAccount_name, 1077 kAuthenticationService_selectAccount_name,
633 message.header.requestId, 1078 message.header.requestId,
634 bindings.MessageHeader.kMessageIsResponse); 1079 bindings.MessageHeader.kMessageIsResponse);
635 } 1080 }
636 break; 1081 break;
637 case kAuthenticationService_getOAuth2Token_name: 1082 case kAuthenticationService_getOAuth2Token_name:
638 var params = AuthenticationServiceGetOAuth2TokenParams.deserialize( 1083 var params = AuthenticationServiceGetOAuth2TokenParams
639 message.payload); 1084 .deserialize(message.payload);
640 var response = _impl.getOAuth2Token(params.username,params.scopes,_Authe nticationServiceGetOAuth2TokenResponseParamsFactory); 1085 var response = _impl.getOAuth2Token(params.username, params.scopes,
1086 _AuthenticationServiceGetOAuth2TokenResponseParamsFactory);
641 if (response is Future) { 1087 if (response is Future) {
642 return response.then((response) { 1088 return response.then((response) {
643 if (response != null) { 1089 if (response != null) {
644 return buildResponseWithId( 1090 return buildResponseWithId(
645 response, 1091 response,
646 kAuthenticationService_getOAuth2Token_name, 1092 kAuthenticationService_getOAuth2Token_name,
647 message.header.requestId, 1093 message.header.requestId,
648 bindings.MessageHeader.kMessageIsResponse); 1094 bindings.MessageHeader.kMessageIsResponse);
649 } 1095 }
650 }); 1096 });
651 } else if (response != null) { 1097 } else if (response != null) {
652 return buildResponseWithId( 1098 return buildResponseWithId(
653 response, 1099 response,
654 kAuthenticationService_getOAuth2Token_name, 1100 kAuthenticationService_getOAuth2Token_name,
655 message.header.requestId, 1101 message.header.requestId,
656 bindings.MessageHeader.kMessageIsResponse); 1102 bindings.MessageHeader.kMessageIsResponse);
657 } 1103 }
658 break; 1104 break;
659 case kAuthenticationService_clearOAuth2Token_name: 1105 case kAuthenticationService_clearOAuth2Token_name:
660 var params = AuthenticationServiceClearOAuth2TokenParams.deserialize( 1106 var params = AuthenticationServiceClearOAuth2TokenParams
661 message.payload); 1107 .deserialize(message.payload);
662 _impl.clearOAuth2Token(params.token); 1108 _impl.clearOAuth2Token(params.token);
663 break; 1109 break;
1110 case kAuthenticationService_getOAuth2DeviceCode_name:
1111 var params = AuthenticationServiceGetOAuth2DeviceCodeParams
1112 .deserialize(message.payload);
1113 var response = _impl.getOAuth2DeviceCode(params.scopes,
1114 _AuthenticationServiceGetOAuth2DeviceCodeResponseParamsFactory);
1115 if (response is Future) {
1116 return response.then((response) {
1117 if (response != null) {
1118 return buildResponseWithId(
1119 response,
1120 kAuthenticationService_getOAuth2DeviceCode_name,
1121 message.header.requestId,
1122 bindings.MessageHeader.kMessageIsResponse);
1123 }
1124 });
1125 } else if (response != null) {
1126 return buildResponseWithId(
1127 response,
1128 kAuthenticationService_getOAuth2DeviceCode_name,
1129 message.header.requestId,
1130 bindings.MessageHeader.kMessageIsResponse);
1131 }
1132 break;
1133 case kAuthenticationService_addAccount_name:
1134 var params =
1135 AuthenticationServiceAddAccountParams.deserialize(message.payload);
1136 var response = _impl.addAccount(params.deviceCode,
1137 _AuthenticationServiceAddAccountResponseParamsFactory);
1138 if (response is Future) {
1139 return response.then((response) {
1140 if (response != null) {
1141 return buildResponseWithId(
1142 response,
1143 kAuthenticationService_addAccount_name,
1144 message.header.requestId,
1145 bindings.MessageHeader.kMessageIsResponse);
1146 }
1147 });
1148 } else if (response != null) {
1149 return buildResponseWithId(
1150 response,
1151 kAuthenticationService_addAccount_name,
1152 message.header.requestId,
1153 bindings.MessageHeader.kMessageIsResponse);
1154 }
1155 break;
664 default: 1156 default:
665 throw new bindings.MojoCodecError("Unexpected message name"); 1157 throw new bindings.MojoCodecError("Unexpected message name");
666 break; 1158 break;
667 } 1159 }
668 return null; 1160 return null;
669 } 1161 }
670 1162
671 AuthenticationService get impl => _impl; 1163 AuthenticationService get impl => _impl;
672 set impl(AuthenticationService d) { 1164 set impl(AuthenticationService d) {
673 assert(_impl == null); 1165 assert(_impl == null);
674 _impl = d; 1166 _impl = d;
675 } 1167 }
676 1168
677 String toString() { 1169 String toString() {
678 var superString = super.toString(); 1170 var superString = super.toString();
679 return "AuthenticationServiceStub($superString)"; 1171 return "AuthenticationServiceStub($superString)";
680 } 1172 }
681 1173
682 int get version => 0; 1174 int get version => 0;
683 } 1175 }
684
685
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698