OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 library authentication_impl_db_mojom; | 5 library authentication_impl_db_mojom; |
6 import 'package:mojo/bindings.dart' as bindings; | 6 import 'package:mojo/bindings.dart' as bindings; |
7 | 7 |
8 | 8 |
9 | 9 |
10 | 10 |
11 class Db extends bindings.Struct { | 11 class Db extends bindings.Struct { |
12 static const List<bindings.StructDataHeader> kVersions = const [ | 12 static const List<bindings.StructDataHeader> kVersions = const [ |
13 const bindings.StructDataHeader(24, 0) | 13 const bindings.StructDataHeader(24, 0) |
14 ]; | 14 ]; |
15 int version = 0; | 15 int version = 0; |
16 Map<String, String> lastSelectedAccounts = null; | 16 Map<String, String> lastSelectedAccounts = null; |
17 | 17 |
18 Db() : super(kVersions.last.size); | 18 Db() : super(kVersions.last.size); |
19 | 19 |
| 20 Db.init( |
| 21 int this.version, |
| 22 Map<String, String> this.lastSelectedAccounts |
| 23 ) : super(kVersions.last.size); |
| 24 |
20 static Db deserialize(bindings.Message message) { | 25 static Db deserialize(bindings.Message message) { |
21 var decoder = new bindings.Decoder(message); | 26 var decoder = new bindings.Decoder(message); |
22 var result = decode(decoder); | 27 var result = decode(decoder); |
23 if (decoder.excessHandles != null) { | 28 if (decoder.excessHandles != null) { |
24 decoder.excessHandles.forEach((h) => h.close()); | 29 decoder.excessHandles.forEach((h) => h.close()); |
25 } | 30 } |
26 return result; | 31 return result; |
27 } | 32 } |
28 | 33 |
29 static Db decode(bindings.Decoder decoder0) { | 34 static Db decode(bindings.Decoder decoder0) { |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 Map toJson() { | 144 Map toJson() { |
140 Map map = new Map(); | 145 Map map = new Map(); |
141 map["version"] = version; | 146 map["version"] = version; |
142 map["lastSelectedAccounts"] = lastSelectedAccounts; | 147 map["lastSelectedAccounts"] = lastSelectedAccounts; |
143 return map; | 148 return map; |
144 } | 149 } |
145 } | 150 } |
146 | 151 |
147 | 152 |
148 | 153 |
OLD | NEW |