| 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 cr.define('options', function() { | 5 cr.define('options', function() { |
| 6 | 6 |
| 7 var OptionsPage = options.OptionsPage; | 7 var OptionsPage = options.OptionsPage; |
| 8 | 8 |
| 9 ///////////////////////////////////////////////////////////////////////////// | 9 ///////////////////////////////////////////////////////////////////////////// |
| 10 // AccountsOptions class: | 10 // AccountsOptions class: |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 | 26 |
| 27 /** | 27 /** |
| 28 * Initializes AccountsOptions page. | 28 * Initializes AccountsOptions page. |
| 29 */ | 29 */ |
| 30 initializePage: function() { | 30 initializePage: function() { |
| 31 // Call base class implementation to starts preference initialization. | 31 // Call base class implementation to starts preference initialization. |
| 32 OptionsPage.prototype.initializePage.call(this); | 32 OptionsPage.prototype.initializePage.call(this); |
| 33 | 33 |
| 34 // Set up accounts page. | 34 // Set up accounts page. |
| 35 var userList = $('userList'); | 35 var userList = $('userList'); |
| 36 options.accounts.UserList.decorate(userList); | |
| 37 | 36 |
| 38 var userNameEdit = $('userNameEdit'); | 37 var userNameEdit = $('userNameEdit'); |
| 39 options.accounts.UserNameEdit.decorate(userNameEdit); | 38 options.accounts.UserNameEdit.decorate(userNameEdit); |
| 40 userNameEdit.addEventListener('add', this.handleAddUser_); | 39 userNameEdit.addEventListener('add', this.handleAddUser_); |
| 41 | 40 |
| 42 userList.disabled = | 41 userList.disabled = |
| 43 userNameEdit.disabled = !AccountsOptions.currentUserIsOwner(); | 42 userNameEdit.disabled = !AccountsOptions.currentUserIsOwner(); |
| 44 // If the current user is not the owner, show some warning. | 43 // If the current user is not the owner, show some warning, |
| 45 if (!AccountsOptions.currentUserIsOwner()) { | 44 // and do not show the user list. |
| 45 if (AccountsOptions.currentUserIsOwner()) { |
| 46 options.accounts.UserList.decorate(userList); |
| 47 } else { |
| 46 $('ownerOnlyWarning').classList.remove('hidden'); | 48 $('ownerOnlyWarning').classList.remove('hidden'); |
| 47 } | 49 } |
| 48 | 50 |
| 49 this.addEventListener('visibleChange', this.handleVisibleChange_); | 51 this.addEventListener('visibleChange', this.handleVisibleChange_); |
| 50 | 52 |
| 51 $('useWhitelistCheck').addEventListener('click', | 53 $('useWhitelistCheck').addEventListener('click', |
| 52 this.handleUseWhitelistCheckClick_); | 54 this.handleUseWhitelistCheckClick_); |
| 53 }, | 55 }, |
| 54 | 56 |
| 55 /** | 57 /** |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 userList.addUser(users[i]); | 111 userList.addUser(users[i]); |
| 110 } | 112 } |
| 111 }; | 113 }; |
| 112 | 114 |
| 113 // Export | 115 // Export |
| 114 return { | 116 return { |
| 115 AccountsOptions: AccountsOptions | 117 AccountsOptions: AccountsOptions |
| 116 }; | 118 }; |
| 117 | 119 |
| 118 }); | 120 }); |
| OLD | NEW |