| 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.accounts', function() { | 5 cr.define('options.accounts', function() { |
| 6 const List = cr.ui.List; | 6 const List = cr.ui.List; |
| 7 const ListItem = cr.ui.ListItem; | 7 const ListItem = cr.ui.ListItem; |
| 8 const ArrayDataModel = cr.ui.ArrayDataModel; | 8 const ArrayDataModel = cr.ui.ArrayDataModel; |
| 9 | 9 |
| 10 /** | 10 /** |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 /** | 96 /** |
| 97 * Handles the clicks on the list and triggers user removal if the click | 97 * Handles the clicks on the list and triggers user removal if the click |
| 98 * is on the remove user button. | 98 * is on the remove user button. |
| 99 * @private | 99 * @private |
| 100 * @param {!Event} e The click event object. | 100 * @param {!Event} e The click event object. |
| 101 */ | 101 */ |
| 102 handleClick_: function(e) { | 102 handleClick_: function(e) { |
| 103 // Handle left button click | 103 // Handle left button click |
| 104 if (e.button == 0) { | 104 if (e.button == 0) { |
| 105 var el = e.target; | 105 var el = e.target; |
| 106 if (el.className == 'remove-user-button') { | 106 if (el.classList.contains('remove-user-button')) { |
| 107 this.removeUser(el.parentNode.user); | 107 this.removeUser(el.parentNode.user); |
| 108 } | 108 } |
| 109 } | 109 } |
| 110 }, | 110 }, |
| 111 | 111 |
| 112 /** | 112 /** |
| 113 * Loads given user list. | 113 * Loads given user list. |
| 114 * @param {Array} users An array of user object. | 114 * @param {Array} users An array of user object. |
| 115 */ | 115 */ |
| 116 load_: function(users) { | 116 load_: function(users) { |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 var labelEmail = this.ownerDocument.createElement('span'); | 166 var labelEmail = this.ownerDocument.createElement('span'); |
| 167 labelEmail.className = 'user-email-label'; | 167 labelEmail.className = 'user-email-label'; |
| 168 labelEmail.textContent = this.user.email; | 168 labelEmail.textContent = this.user.email; |
| 169 | 169 |
| 170 var labelName = this.ownerDocument.createElement('span'); | 170 var labelName = this.ownerDocument.createElement('span'); |
| 171 labelName.className = 'user-name-label'; | 171 labelName.className = 'user-name-label'; |
| 172 labelName.textContent = this.user.owner ? | 172 labelName.textContent = this.user.owner ? |
| 173 localStrings.getStringF('username_format', this.user.name) : | 173 localStrings.getStringF('username_format', this.user.name) : |
| 174 this.user.name; | 174 this.user.name; |
| 175 | 175 |
| 176 var emailNameBlock = this.ownerDocument.createElement('div'); |
| 177 emailNameBlock.className = 'user-email-name-block'; |
| 178 emailNameBlock.appendChild(labelEmail); |
| 179 emailNameBlock.appendChild(labelName); |
| 180 emailNameBlock.title = this.user.owner ? |
| 181 localStrings.getStringF('username_format', this.user.email) : |
| 182 this.user.email; |
| 183 |
| 176 this.appendChild(icon); | 184 this.appendChild(icon); |
| 177 this.appendChild(labelEmail); | 185 this.appendChild(emailNameBlock); |
| 178 this.appendChild(labelName); | |
| 179 | 186 |
| 180 if (!this.user.owner) { | 187 if (!this.user.owner) { |
| 181 var removeButton = this.ownerDocument.createElement('button'); | 188 var removeButton = this.ownerDocument.createElement('button'); |
| 182 removeButton.className = 'remove-user-button'; | 189 removeButton.classList.add('raw-button'); |
| 190 removeButton.classList.add('remove-user-button'); |
| 183 this.appendChild(removeButton); | 191 this.appendChild(removeButton); |
| 184 } | 192 } |
| 185 } | 193 } |
| 186 }; | 194 }; |
| 187 | 195 |
| 188 return { | 196 return { |
| 189 UserList: UserList | 197 UserList: UserList |
| 190 }; | 198 }; |
| 191 }); | 199 }); |
| OLD | NEW |