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

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: Refactored google_auth_service into sub components 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;
394 const String AuthenticationServiceName = "authentication::AuthenticationService" ; 746 const int kAuthenticationService_getOAuth2DeviceCode_name = 3;
747 const int kAuthenticationService_addAccount_name = 4;
748
749 const String AuthenticationServiceName =
750 'authentication::AuthenticationService';
395 751
396 abstract class AuthenticationService { 752 abstract class AuthenticationService {
397 dynamic selectAccount(bool returnLastSelected,[Function responseFactory = null ]); 753 dynamic selectAccount(bool returnLastSelected,
398 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]);
399 void clearOAuth2Token(String token); 757 void clearOAuth2Token(String token);
400 758 dynamic getOAuth2DeviceCode(List<String> scopes,
401 } 759 [Function responseFactory = null]);
402 760 dynamic addAccount(String deviceCode, [Function responseFactory = null]);
761 }
403 762
404 class AuthenticationServiceProxyImpl extends bindings.Proxy { 763 class AuthenticationServiceProxyImpl extends bindings.Proxy {
405 AuthenticationServiceProxyImpl.fromEndpoint( 764 AuthenticationServiceProxyImpl.fromEndpoint(
406 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); 765 core.MojoMessagePipeEndpoint endpoint)
407 766 : super.fromEndpoint(endpoint);
408 AuthenticationServiceProxyImpl.fromHandle(core.MojoHandle handle) : 767
409 super.fromHandle(handle); 768 AuthenticationServiceProxyImpl.fromHandle(core.MojoHandle handle)
769 : super.fromHandle(handle);
410 770
411 AuthenticationServiceProxyImpl.unbound() : super.unbound(); 771 AuthenticationServiceProxyImpl.unbound() : super.unbound();
412 772
413 static AuthenticationServiceProxyImpl newFromEndpoint( 773 static AuthenticationServiceProxyImpl newFromEndpoint(
414 core.MojoMessagePipeEndpoint endpoint) { 774 core.MojoMessagePipeEndpoint endpoint) {
415 assert(endpoint.setDescription("For AuthenticationServiceProxyImpl")); 775 assert(endpoint.setDescription("For AuthenticationServiceProxyImpl"));
416 return new AuthenticationServiceProxyImpl.fromEndpoint(endpoint); 776 return new AuthenticationServiceProxyImpl.fromEndpoint(endpoint);
417 } 777 }
418 778
419 String get name => AuthenticationServiceName; 779 String get name => AuthenticationServiceName;
420 780
421 void handleResponse(bindings.ServiceMessage message) { 781 void handleResponse(bindings.ServiceMessage message) {
422 switch (message.header.type) { 782 switch (message.header.type) {
423 case kAuthenticationService_selectAccount_name: 783 case kAuthenticationService_selectAccount_name:
424 var r = AuthenticationServiceSelectAccountResponseParams.deserialize( 784 var r = AuthenticationServiceSelectAccountResponseParams
425 message.payload); 785 .deserialize(message.payload);
426 if (!message.header.hasRequestId) { 786 if (!message.header.hasRequestId) {
427 proxyError("Expected a message with a valid request Id."); 787 proxyError("Expected a message with a valid request Id.");
428 return; 788 return;
429 } 789 }
430 Completer c = completerMap[message.header.requestId]; 790 Completer c = completerMap[message.header.requestId];
431 if (c == null) { 791 if (c == null) {
432 proxyError( 792 proxyError(
433 "Message had unknown request Id: ${message.header.requestId}"); 793 "Message had unknown request Id: ${message.header.requestId}");
434 return; 794 return;
435 } 795 }
436 completerMap.remove(message.header.requestId); 796 completerMap.remove(message.header.requestId);
437 if (c.isCompleted) { 797 if (c.isCompleted) {
438 proxyError("Response completer already completed"); 798 proxyError("Response completer already completed");
439 return; 799 return;
440 } 800 }
441 c.complete(r); 801 c.complete(r);
442 break; 802 break;
443 case kAuthenticationService_getOAuth2Token_name: 803 case kAuthenticationService_getOAuth2Token_name:
444 var r = AuthenticationServiceGetOAuth2TokenResponseParams.deserialize( 804 var r = AuthenticationServiceGetOAuth2TokenResponseParams
445 message.payload); 805 .deserialize(message.payload);
446 if (!message.header.hasRequestId) { 806 if (!message.header.hasRequestId) {
447 proxyError("Expected a message with a valid request Id."); 807 proxyError("Expected a message with a valid request Id.");
448 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;
449 } 849 }
450 Completer c = completerMap[message.header.requestId]; 850 Completer c = completerMap[message.header.requestId];
451 if (c == null) { 851 if (c == null) {
452 proxyError( 852 proxyError(
453 "Message had unknown request Id: ${message.header.requestId}"); 853 "Message had unknown request Id: ${message.header.requestId}");
454 return; 854 return;
455 } 855 }
456 completerMap.remove(message.header.requestId); 856 completerMap.remove(message.header.requestId);
457 if (c.isCompleted) { 857 if (c.isCompleted) {
458 proxyError("Response completer already completed"); 858 proxyError("Response completer already completed");
459 return; 859 return;
460 } 860 }
461 c.complete(r); 861 c.complete(r);
462 break; 862 break;
463 default: 863 default:
464 proxyError("Unexpected message type: ${message.header.type}"); 864 proxyError("Unexpected message type: ${message.header.type}");
465 close(immediate: true); 865 close(immediate: true);
466 break; 866 break;
467 } 867 }
468 } 868 }
469 869
470 String toString() { 870 String toString() {
471 var superString = super.toString(); 871 var superString = super.toString();
472 return "AuthenticationServiceProxyImpl($superString)"; 872 return "AuthenticationServiceProxyImpl($superString)";
473 } 873 }
474 } 874 }
475 875
476
477 class _AuthenticationServiceProxyCalls implements AuthenticationService { 876 class _AuthenticationServiceProxyCalls implements AuthenticationService {
478 AuthenticationServiceProxyImpl _proxyImpl; 877 AuthenticationServiceProxyImpl _proxyImpl;
479 878
480 _AuthenticationServiceProxyCalls(this._proxyImpl); 879 _AuthenticationServiceProxyCalls(this._proxyImpl);
481 dynamic selectAccount(bool returnLastSelected,[Function responseFactory = nu ll]) { 880 dynamic selectAccount(bool returnLastSelected,
482 var params = new AuthenticationServiceSelectAccountParams(); 881 [Function responseFactory = null]) {
483 params.returnLastSelected = returnLastSelected; 882 var params = new AuthenticationServiceSelectAccountParams();
484 return _proxyImpl.sendMessageWithRequestId( 883 params.returnLastSelected = returnLastSelected;
485 params, 884 return _proxyImpl.sendMessageWithRequestId(
486 kAuthenticationService_selectAccount_name, 885 params,
487 -1, 886 kAuthenticationService_selectAccount_name,
488 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;
489 } 907 }
490 dynamic getOAuth2Token(String username,List<String> scopes,[Function respons eFactory = null]) { 908 var params = new AuthenticationServiceClearOAuth2TokenParams();
491 var params = new AuthenticationServiceGetOAuth2TokenParams(); 909 params.token = token;
492 params.username = username; 910 _proxyImpl.sendMessage(
493 params.scopes = scopes; 911 params, kAuthenticationService_clearOAuth2Token_name);
494 return _proxyImpl.sendMessageWithRequestId( 912 }
495 params, 913
496 kAuthenticationService_getOAuth2Token_name, 914 dynamic getOAuth2DeviceCode(List<String> scopes,
497 -1, 915 [Function responseFactory = null]) {
498 bindings.MessageHeader.kMessageExpectsResponse); 916 var params = new AuthenticationServiceGetOAuth2DeviceCodeParams();
499 } 917 params.scopes = scopes;
500 void clearOAuth2Token(String token) { 918 return _proxyImpl.sendMessageWithRequestId(
501 if (!_proxyImpl.isBound) { 919 params,
502 _proxyImpl.proxyError("The Proxy is closed."); 920 kAuthenticationService_getOAuth2DeviceCode_name,
503 return; 921 -1,
504 } 922 bindings.MessageHeader.kMessageExpectsResponse);
505 var params = new AuthenticationServiceClearOAuth2TokenParams(); 923 }
506 params.token = token; 924
507 _proxyImpl.sendMessage(params, kAuthenticationService_clearOAuth2Token_nam e); 925 dynamic addAccount(String deviceCode, [Function responseFactory = null]) {
508 } 926 var params = new AuthenticationServiceAddAccountParams();
509 927 params.deviceCode = deviceCode;
928 return _proxyImpl.sendMessageWithRequestId(
929 params,
930 kAuthenticationService_addAccount_name,
931 -1,
932 bindings.MessageHeader.kMessageExpectsResponse);
933 }
510 } 934 }
511 935
512
513 class AuthenticationServiceProxy implements bindings.ProxyBase { 936 class AuthenticationServiceProxy implements bindings.ProxyBase {
514 final bindings.Proxy impl; 937 final bindings.Proxy impl;
515 AuthenticationService ptr; 938 AuthenticationService ptr;
516 final String name = AuthenticationServiceName; 939 final String name = AuthenticationServiceName;
517 940
518 AuthenticationServiceProxy(AuthenticationServiceProxyImpl proxyImpl) : 941 AuthenticationServiceProxy(AuthenticationServiceProxyImpl proxyImpl)
519 impl = proxyImpl, 942 : impl = proxyImpl,
520 ptr = new _AuthenticationServiceProxyCalls(proxyImpl); 943 ptr = new _AuthenticationServiceProxyCalls(proxyImpl);
521 944
522 AuthenticationServiceProxy.fromEndpoint( 945 AuthenticationServiceProxy.fromEndpoint(core.MojoMessagePipeEndpoint endpoint)
523 core.MojoMessagePipeEndpoint endpoint) : 946 : impl = new AuthenticationServiceProxyImpl.fromEndpoint(endpoint) {
524 impl = new AuthenticationServiceProxyImpl.fromEndpoint(endpoint) {
525 ptr = new _AuthenticationServiceProxyCalls(impl); 947 ptr = new _AuthenticationServiceProxyCalls(impl);
526 } 948 }
527 949
528 AuthenticationServiceProxy.fromHandle(core.MojoHandle handle) : 950 AuthenticationServiceProxy.fromHandle(core.MojoHandle handle)
529 impl = new AuthenticationServiceProxyImpl.fromHandle(handle) { 951 : impl = new AuthenticationServiceProxyImpl.fromHandle(handle) {
530 ptr = new _AuthenticationServiceProxyCalls(impl); 952 ptr = new _AuthenticationServiceProxyCalls(impl);
531 } 953 }
532 954
533 AuthenticationServiceProxy.unbound() : 955 AuthenticationServiceProxy.unbound()
534 impl = new AuthenticationServiceProxyImpl.unbound() { 956 : impl = new AuthenticationServiceProxyImpl.unbound() {
535 ptr = new _AuthenticationServiceProxyCalls(impl); 957 ptr = new _AuthenticationServiceProxyCalls(impl);
536 } 958 }
537 959
538 factory AuthenticationServiceProxy.connectToService( 960 factory AuthenticationServiceProxy.connectToService(
539 bindings.ServiceConnector s, String url, [String serviceName]) { 961 bindings.ServiceConnector s, String url,
962 [String serviceName]) {
540 AuthenticationServiceProxy p = new AuthenticationServiceProxy.unbound(); 963 AuthenticationServiceProxy p = new AuthenticationServiceProxy.unbound();
541 s.connectToService(url, p, serviceName); 964 s.connectToService(url, p, serviceName);
542 return p; 965 return p;
543 } 966 }
544 967
545 static AuthenticationServiceProxy newFromEndpoint( 968 static AuthenticationServiceProxy newFromEndpoint(
546 core.MojoMessagePipeEndpoint endpoint) { 969 core.MojoMessagePipeEndpoint endpoint) {
547 assert(endpoint.setDescription("For AuthenticationServiceProxy")); 970 assert(endpoint.setDescription("For AuthenticationServiceProxy"));
548 return new AuthenticationServiceProxy.fromEndpoint(endpoint); 971 return new AuthenticationServiceProxy.fromEndpoint(endpoint);
549 } 972 }
(...skipping 10 matching lines...) Expand all
560 983
561 void requireVersion(int requiredVersion) { 984 void requireVersion(int requiredVersion) {
562 impl.requireVersion(requiredVersion); 985 impl.requireVersion(requiredVersion);
563 } 986 }
564 987
565 String toString() { 988 String toString() {
566 return "AuthenticationServiceProxy($impl)"; 989 return "AuthenticationServiceProxy($impl)";
567 } 990 }
568 } 991 }
569 992
570
571 class AuthenticationServiceStub extends bindings.Stub { 993 class AuthenticationServiceStub extends bindings.Stub {
572 AuthenticationService _impl = null; 994 AuthenticationService _impl = null;
573 995
574 AuthenticationServiceStub.fromEndpoint( 996 AuthenticationServiceStub.fromEndpoint(core.MojoMessagePipeEndpoint endpoint,
575 core.MojoMessagePipeEndpoint endpoint, [this._impl]) 997 [this._impl])
576 : super.fromEndpoint(endpoint); 998 : super.fromEndpoint(endpoint);
577 999
578 AuthenticationServiceStub.fromHandle(core.MojoHandle handle, [this._impl]) 1000 AuthenticationServiceStub.fromHandle(core.MojoHandle handle, [this._impl])
579 : super.fromHandle(handle); 1001 : super.fromHandle(handle);
580 1002
581 AuthenticationServiceStub.unbound() : super.unbound(); 1003 AuthenticationServiceStub.unbound() : super.unbound();
582 1004
583 static AuthenticationServiceStub newFromEndpoint( 1005 static AuthenticationServiceStub newFromEndpoint(
584 core.MojoMessagePipeEndpoint endpoint) { 1006 core.MojoMessagePipeEndpoint endpoint) {
585 assert(endpoint.setDescription("For AuthenticationServiceStub")); 1007 assert(endpoint.setDescription("For AuthenticationServiceStub"));
586 return new AuthenticationServiceStub.fromEndpoint(endpoint); 1008 return new AuthenticationServiceStub.fromEndpoint(endpoint);
587 } 1009 }
588 1010
589 static const String name = AuthenticationServiceName; 1011 static const String name = AuthenticationServiceName;
590 1012
591 1013 AuthenticationServiceSelectAccountResponseParams _AuthenticationServiceSelectA ccountResponseParamsFactory(
592 AuthenticationServiceSelectAccountResponseParams _AuthenticationServiceSelectA ccountResponseParamsFactory(String username, String error) { 1014 String username, String error) {
593 var mojo_factory_result = new AuthenticationServiceSelectAccountResponsePara ms(); 1015 var mojo_factory_result =
1016 new AuthenticationServiceSelectAccountResponseParams();
594 mojo_factory_result.username = username; 1017 mojo_factory_result.username = username;
595 mojo_factory_result.error = error; 1018 mojo_factory_result.error = error;
596 return mojo_factory_result; 1019 return mojo_factory_result;
597 } 1020 }
598 AuthenticationServiceGetOAuth2TokenResponseParams _AuthenticationServiceGetOAu th2TokenResponseParamsFactory(String token, String error) { 1021
599 var mojo_factory_result = new AuthenticationServiceGetOAuth2TokenResponsePar ams(); 1022 AuthenticationServiceGetOAuth2TokenResponseParams _AuthenticationServiceGetOAu th2TokenResponseParamsFactory(
1023 String token, String error) {
1024 var mojo_factory_result =
1025 new AuthenticationServiceGetOAuth2TokenResponseParams();
600 mojo_factory_result.token = token; 1026 mojo_factory_result.token = token;
601 mojo_factory_result.error = error; 1027 mojo_factory_result.error = error;
602 return mojo_factory_result; 1028 return mojo_factory_result;
603 } 1029 }
604 1030
1031 AuthenticationServiceGetOAuth2DeviceCodeResponseParams _AuthenticationServiceG etOAuth2DeviceCodeResponseParamsFactory(
1032 String verificationUrl,
1033 String deviceCode,
1034 String userCode,
1035 String error) {
1036 var mojo_factory_result =
1037 new AuthenticationServiceGetOAuth2DeviceCodeResponseParams();
1038 mojo_factory_result.verificationUrl = verificationUrl;
1039 mojo_factory_result.deviceCode = deviceCode;
1040 mojo_factory_result.userCode = userCode;
1041 mojo_factory_result.error = error;
1042 return mojo_factory_result;
1043 }
1044
1045 AuthenticationServiceAddAccountResponseParams _AuthenticationServiceAddAccount ResponseParamsFactory(
1046 String username, String error) {
1047 var mojo_factory_result =
1048 new AuthenticationServiceAddAccountResponseParams();
1049 mojo_factory_result.username = username;
1050 mojo_factory_result.error = error;
1051 return mojo_factory_result;
1052 }
1053
605 dynamic handleMessage(bindings.ServiceMessage message) { 1054 dynamic handleMessage(bindings.ServiceMessage message) {
606 if (bindings.ControlMessageHandler.isControlMessage(message)) { 1055 if (bindings.ControlMessageHandler.isControlMessage(message)) {
607 return bindings.ControlMessageHandler.handleMessage(this, 1056 return bindings.ControlMessageHandler.handleMessage(this, 0, message);
608 0,
609 message);
610 } 1057 }
611 assert(_impl != null); 1058 assert(_impl != null);
612 switch (message.header.type) { 1059 switch (message.header.type) {
613 case kAuthenticationService_selectAccount_name: 1060 case kAuthenticationService_selectAccount_name:
614 var params = AuthenticationServiceSelectAccountParams.deserialize( 1061 var params = AuthenticationServiceSelectAccountParams
615 message.payload); 1062 .deserialize(message.payload);
616 var response = _impl.selectAccount(params.returnLastSelected,_Authentica tionServiceSelectAccountResponseParamsFactory); 1063 var response = _impl.selectAccount(params.returnLastSelected,
1064 _AuthenticationServiceSelectAccountResponseParamsFactory);
617 if (response is Future) { 1065 if (response is Future) {
618 return response.then((response) { 1066 return response.then((response) {
619 if (response != null) { 1067 if (response != null) {
620 return buildResponseWithId( 1068 return buildResponseWithId(
621 response, 1069 response,
622 kAuthenticationService_selectAccount_name, 1070 kAuthenticationService_selectAccount_name,
623 message.header.requestId, 1071 message.header.requestId,
624 bindings.MessageHeader.kMessageIsResponse); 1072 bindings.MessageHeader.kMessageIsResponse);
625 } 1073 }
626 }); 1074 });
627 } else if (response != null) { 1075 } else if (response != null) {
628 return buildResponseWithId( 1076 return buildResponseWithId(
629 response, 1077 response,
630 kAuthenticationService_selectAccount_name, 1078 kAuthenticationService_selectAccount_name,
631 message.header.requestId, 1079 message.header.requestId,
632 bindings.MessageHeader.kMessageIsResponse); 1080 bindings.MessageHeader.kMessageIsResponse);
633 } 1081 }
634 break; 1082 break;
635 case kAuthenticationService_getOAuth2Token_name: 1083 case kAuthenticationService_getOAuth2Token_name:
636 var params = AuthenticationServiceGetOAuth2TokenParams.deserialize( 1084 var params = AuthenticationServiceGetOAuth2TokenParams
637 message.payload); 1085 .deserialize(message.payload);
638 var response = _impl.getOAuth2Token(params.username,params.scopes,_Authe nticationServiceGetOAuth2TokenResponseParamsFactory); 1086 var response = _impl.getOAuth2Token(params.username, params.scopes,
1087 _AuthenticationServiceGetOAuth2TokenResponseParamsFactory);
639 if (response is Future) { 1088 if (response is Future) {
640 return response.then((response) { 1089 return response.then((response) {
641 if (response != null) { 1090 if (response != null) {
642 return buildResponseWithId( 1091 return buildResponseWithId(
643 response, 1092 response,
644 kAuthenticationService_getOAuth2Token_name, 1093 kAuthenticationService_getOAuth2Token_name,
645 message.header.requestId, 1094 message.header.requestId,
646 bindings.MessageHeader.kMessageIsResponse); 1095 bindings.MessageHeader.kMessageIsResponse);
647 } 1096 }
648 }); 1097 });
649 } else if (response != null) { 1098 } else if (response != null) {
650 return buildResponseWithId( 1099 return buildResponseWithId(
651 response, 1100 response,
652 kAuthenticationService_getOAuth2Token_name, 1101 kAuthenticationService_getOAuth2Token_name,
653 message.header.requestId, 1102 message.header.requestId,
654 bindings.MessageHeader.kMessageIsResponse); 1103 bindings.MessageHeader.kMessageIsResponse);
655 } 1104 }
656 break; 1105 break;
657 case kAuthenticationService_clearOAuth2Token_name: 1106 case kAuthenticationService_clearOAuth2Token_name:
658 var params = AuthenticationServiceClearOAuth2TokenParams.deserialize( 1107 var params = AuthenticationServiceClearOAuth2TokenParams
659 message.payload); 1108 .deserialize(message.payload);
660 _impl.clearOAuth2Token(params.token); 1109 _impl.clearOAuth2Token(params.token);
661 break; 1110 break;
1111 case kAuthenticationService_getOAuth2DeviceCode_name:
1112 var params = AuthenticationServiceGetOAuth2DeviceCodeParams
1113 .deserialize(message.payload);
1114 var response = _impl.getOAuth2DeviceCode(params.scopes,
1115 _AuthenticationServiceGetOAuth2DeviceCodeResponseParamsFactory);
1116 if (response is Future) {
1117 return response.then((response) {
1118 if (response != null) {
1119 return buildResponseWithId(
1120 response,
1121 kAuthenticationService_getOAuth2DeviceCode_name,
1122 message.header.requestId,
1123 bindings.MessageHeader.kMessageIsResponse);
1124 }
1125 });
1126 } else if (response != null) {
1127 return buildResponseWithId(
1128 response,
1129 kAuthenticationService_getOAuth2DeviceCode_name,
1130 message.header.requestId,
1131 bindings.MessageHeader.kMessageIsResponse);
1132 }
1133 break;
1134 case kAuthenticationService_addAccount_name:
1135 var params =
1136 AuthenticationServiceAddAccountParams.deserialize(message.payload);
1137 var response = _impl.addAccount(params.deviceCode,
1138 _AuthenticationServiceAddAccountResponseParamsFactory);
1139 if (response is Future) {
1140 return response.then((response) {
1141 if (response != null) {
1142 return buildResponseWithId(
1143 response,
1144 kAuthenticationService_addAccount_name,
1145 message.header.requestId,
1146 bindings.MessageHeader.kMessageIsResponse);
1147 }
1148 });
1149 } else if (response != null) {
1150 return buildResponseWithId(
1151 response,
1152 kAuthenticationService_addAccount_name,
1153 message.header.requestId,
1154 bindings.MessageHeader.kMessageIsResponse);
1155 }
1156 break;
662 default: 1157 default:
663 throw new bindings.MojoCodecError("Unexpected message name"); 1158 throw new bindings.MojoCodecError("Unexpected message name");
664 break; 1159 break;
665 } 1160 }
666 return null; 1161 return null;
667 } 1162 }
668 1163
669 AuthenticationService get impl => _impl; 1164 AuthenticationService get impl => _impl;
670 set impl(AuthenticationService d) { 1165 set impl(AuthenticationService d) {
671 assert(_impl == null); 1166 assert(_impl == null);
672 _impl = d; 1167 _impl = d;
673 } 1168 }
674 1169
675 String toString() { 1170 String toString() {
676 var superString = super.toString(); 1171 var superString = super.toString();
677 return "AuthenticationServiceStub($superString)"; 1172 return "AuthenticationServiceStub($superString)";
678 } 1173 }
679 1174
680 int get version => 0; 1175 int get version => 0;
681 } 1176 }
682
683
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698