| 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 |
| 36 options.accounts.UserList.decorate($('userList')); | 43 options.accounts.UserList.decorate($('userList')); |
| 37 | 44 |
| 38 var userNameEdit = $('userNameEdit'); | 45 this.addEventListener('visibleChange', |
| 39 options.accounts.UserNameEdit.decorate(userNameEdit); | 46 cr.bind(this.handleVisibleChange_, this)); |
| 40 userNameEdit.addEventListener('add', this.handleAddUser_); | |
| 41 | 47 |
| 42 this.addEventListener('visibleChange', this.handleVisibleChange_); | 48 // Setup add user overlay page. |
| 49 OptionsPage.registerOverlay(AddUserOverlay.getInstance()); |
| 43 }, | 50 }, |
| 44 | 51 |
| 45 userListInitalized_: false, | 52 userListInitalized_: false, |
| 46 | 53 |
| 47 /** | 54 /** |
| 48 * Handler for OptionsPage's visible property change event. | 55 * Handler for OptionsPage's visible property change event. |
| 49 * @private | |
| 50 * @param {Event} e Property change event. | 56 * @param {Event} e Property change event. |
| 51 */ | 57 */ |
| 52 handleVisibleChange_: function(e) { | 58 handleVisibleChange_ : function(e) { |
| 53 if (!this.userListInitalized_ && this.visible) { | 59 if (!this.userListInitalized_ && this.visible) { |
| 54 this.userListInitalized_ = true; | 60 this.userListInitalized_ = true; |
| 55 userList.redraw(); | 61 userList.redraw(); |
| 56 } | 62 } |
| 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); | |
| 66 } | 63 } |
| 67 }; | 64 }; |
| OLD | NEW |