OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 /////////////////////////////////////////////////////////////////////////////// | 5 /////////////////////////////////////////////////////////////////////////////// |
6 // AccountsOptions class: | 6 // AccountsOptions class: |
7 | 7 |
8 /** | 8 /** |
9 * Encapsulated handling of ChromeOS accounts options page. | 9 * Encapsulated handling of ChromeOS accounts options page. |
10 * @constructor | 10 * @constructor |
(...skipping 15 matching lines...) Expand all Loading... |
26 __proto__: OptionsPage.prototype, | 26 __proto__: OptionsPage.prototype, |
27 | 27 |
28 /** | 28 /** |
29 * Initializes AccountsOptions page. | 29 * Initializes AccountsOptions page. |
30 */ | 30 */ |
31 initializePage: function() { | 31 initializePage: function() { |
32 // Call base class implementation to starts preference initialization. | 32 // Call base class implementation to starts preference initialization. |
33 OptionsPage.prototype.initializePage.call(this); | 33 OptionsPage.prototype.initializePage.call(this); |
34 | 34 |
35 // Set up accounts page. | 35 // Set up accounts page. |
36 $('addUserButton').onclick = function(e) { | |
37 OptionsPage.showOverlay('addUserOverlay'); | |
38 }; | |
39 $('removeUserButton').onclick = function(e) { | |
40 $('userList').removeSelectedUser(); | |
41 }; | |
42 | |
43 options.accounts.UserList.decorate($('userList')); | 36 options.accounts.UserList.decorate($('userList')); |
44 | 37 |
45 this.addEventListener('visibleChange', | 38 var userNameEdit = $('userNameEdit'); |
46 cr.bind(this.handleVisibleChange_, this)); | 39 options.accounts.UserNameEdit.decorate(userNameEdit); |
| 40 userNameEdit.addEventListener('add', this.handleAddUser_); |
47 | 41 |
48 // Setup add user overlay page. | 42 this.addEventListener('visibleChange', this.handleVisibleChange_); |
49 OptionsPage.registerOverlay(AddUserOverlay.getInstance()); | |
50 }, | 43 }, |
51 | 44 |
52 userListInitalized_: false, | 45 userListInitalized_: false, |
53 | 46 |
54 /** | 47 /** |
55 * Handler for OptionsPage's visible property change event. | 48 * Handler for OptionsPage's visible property change event. |
| 49 * @private |
56 * @param {Event} e Property change event. | 50 * @param {Event} e Property change event. |
57 */ | 51 */ |
58 handleVisibleChange_ : function(e) { | 52 handleVisibleChange_: function(e) { |
59 if (!this.userListInitalized_ && this.visible) { | 53 if (!this.userListInitalized_ && this.visible) { |
60 this.userListInitalized_ = true; | 54 this.userListInitalized_ = true; |
61 userList.redraw(); | 55 userList.redraw(); |
62 } | 56 } |
| 57 }, |
| 58 |
| 59 /** |
| 60 * Handler for "add" event fired from userNameEdit. |
| 61 * @private |
| 62 * @param {Event} e Add event fired from userNameEdit. |
| 63 */ |
| 64 handleAddUser_: function(e) { |
| 65 $('userList').addUser(e.user); |
63 } | 66 } |
64 }; | 67 }; |
OLD | NEW |