OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 cr.define('options.accounts', function() { | 5 cr.define('options.accounts', function() { |
6 /** @const */ var List = cr.ui.List; | 6 /** @const */ var List = cr.ui.List; |
7 /** @const */ var ListItem = cr.ui.ListItem; | 7 /** @const */ var ListItem = cr.ui.ListItem; |
8 /** @const */ var ArrayDataModel = cr.ui.ArrayDataModel; | 8 /** @const */ var ArrayDataModel = cr.ui.ArrayDataModel; |
9 | 9 |
10 /** | 10 /** |
(...skipping 12 matching lines...) Expand all Loading... |
23 /** @override */ | 23 /** @override */ |
24 decorate: function() { | 24 decorate: function() { |
25 List.prototype.decorate.call(this); | 25 List.prototype.decorate.call(this); |
26 | 26 |
27 // HACK(arv): http://crbug.com/40902 | 27 // HACK(arv): http://crbug.com/40902 |
28 window.addEventListener('resize', this.redraw.bind(this)); | 28 window.addEventListener('resize', this.redraw.bind(this)); |
29 | 29 |
30 var self = this; | 30 var self = this; |
31 | 31 |
32 // Listens to pref changes. | 32 // Listens to pref changes. |
33 Preferences.getInstance().addEventListener(this.pref, | 33 Preferences.getInstance().addEventListener(this.pref, function(event) { |
34 function(event) { | 34 self.load_(event.value.value); |
35 self.load_(event.value.value); | 35 }); |
36 }); | |
37 }, | 36 }, |
38 | 37 |
39 /** | 38 /** |
40 * @override | 39 * @override |
41 * @param {Object} user | 40 * @param {Object} user |
42 */ | 41 */ |
43 createItem: function(user) { | 42 createItem: function(user) { |
44 return new UserListItem(user); | 43 return new UserListItem(user); |
45 }, | 44 }, |
46 | 45 |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 // Handle left button click | 179 // Handle left button click |
181 if (e.button == 0) | 180 if (e.button == 0) |
182 this.parentNode.removeUser_(this.user); | 181 this.parentNode.removeUser_(this.user); |
183 }, | 182 }, |
184 | 183 |
185 /** | 184 /** |
186 * Reloads user picture. | 185 * Reloads user picture. |
187 */ | 186 */ |
188 updatePicture: function() { | 187 updatePicture: function() { |
189 this.icon_.src = 'chrome://userimage/' + this.user.username + | 188 this.icon_.src = 'chrome://userimage/' + this.user.username + |
190 '?id=' + (new Date()).getTime(); | 189 '?id=' + (new Date()).getTime(); |
191 } | 190 } |
192 }; | 191 }; |
193 | 192 |
194 return { | 193 return {UserList: UserList}; |
195 UserList: UserList | |
196 }; | |
197 }); | 194 }); |
OLD | NEW |