| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 /////////////////////////////////////////////////////////////////////////////// |
| 6 // AccountsOptions class: |
| 7 |
| 8 /** |
| 9 * Encapsulated handling of ChromeOS accounts options page. |
| 10 * @constructor |
| 11 */ |
| 12 function AccountsOptions(model) { |
| 13 OptionsPage.call(this, 'accounts', localStrings.getString('accountsPage'), |
| 14 'accountsPage'); |
| 15 } |
| 16 |
| 17 AccountsOptions.getInstance = function() { |
| 18 if (!AccountsOptions.instance_) { |
| 19 AccountsOptions.instance_ = new AccountsOptions(null); |
| 20 } |
| 21 return AccountsOptions.instance_; |
| 22 }; |
| 23 |
| 24 AccountsOptions.prototype = { |
| 25 // Inherit AccountsOptions from OptionsPage. |
| 26 __proto__: OptionsPage.prototype, |
| 27 |
| 28 /** |
| 29 * Initializes AccountsOptions page. |
| 30 */ |
| 31 initializePage: function() { |
| 32 // Call base class implementation to starts preference initialization. |
| 33 OptionsPage.prototype.initializePage.call(this); |
| 34 |
| 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')); |
| 44 |
| 45 this.addEventListener('visibleChange', |
| 46 cr.bind(this.handleVisibleChange_, this)); |
| 47 |
| 48 // Setup add user overlay page. |
| 49 OptionsPage.registerOverlay(AddUserOverlay.getInstance()); |
| 50 }, |
| 51 |
| 52 userListInitalized_: false, |
| 53 |
| 54 /** |
| 55 * Handler for OptionsPage's visible property change event. |
| 56 * @param {Event} e Property change event. |
| 57 */ |
| 58 handleVisibleChange_ : function(e) { |
| 59 if (!this.userListInitalized_ && this.visible) { |
| 60 this.userListInitalized_ = true; |
| 61 userList.redraw(); |
| 62 } |
| 63 } |
| 64 }; |
| OLD | NEW |