Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 * @fileoverview User pod row implementation. | 6 * @fileoverview User pod row implementation. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 cr.define('login', function() { | 9 cr.define('login', function() { |
| 10 /** | 10 /** |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 180 this.actionBoxMenuRemoveElement.addEventListener('keydown', | 180 this.actionBoxMenuRemoveElement.addEventListener('keydown', |
| 181 this.handleRemoveCommandKeyDown_.bind(this)); | 181 this.handleRemoveCommandKeyDown_.bind(this)); |
| 182 this.actionBoxMenuRemoveElement.addEventListener('blur', | 182 this.actionBoxMenuRemoveElement.addEventListener('blur', |
| 183 this.handleRemoveCommandBlur_.bind(this)); | 183 this.handleRemoveCommandBlur_.bind(this)); |
| 184 | 184 |
| 185 if (this.actionBoxRemoveUserWarningButtonElement) { | 185 if (this.actionBoxRemoveUserWarningButtonElement) { |
| 186 this.actionBoxRemoveUserWarningButtonElement.addEventListener( | 186 this.actionBoxRemoveUserWarningButtonElement.addEventListener( |
| 187 'click', | 187 'click', |
| 188 this.handleRemoveUserConfirmationClick_.bind(this)); | 188 this.handleRemoveUserConfirmationClick_.bind(this)); |
| 189 } | 189 } |
| 190 | |
| 191 this.customButtonElement.addEventListener('click', | |
|
Tim Song
2014/05/16 18:38:47
It's also worth changing the HTML and CSS, so this
xiyuan
2014/05/16 23:00:56
CustomButton -> CustomIcon
<button> -> <div>
<img>
| |
| 192 this.handleCustomButtonClick_.bind(this)); | |
| 193 }, | 190 }, |
| 194 | 191 |
| 195 /** | 192 /** |
| 196 * Initializes the pod after its properties set and added to a pod row. | 193 * Initializes the pod after its properties set and added to a pod row. |
| 197 */ | 194 */ |
| 198 initialize: function() { | 195 initialize: function() { |
| 199 this.passwordElement.addEventListener('keydown', | 196 this.passwordElement.addEventListener('keydown', |
| 200 this.parentNode.handleKeyDown.bind(this.parentNode)); | 197 this.parentNode.handleKeyDown.bind(this.parentNode)); |
| 201 this.passwordElement.addEventListener('keypress', | 198 this.passwordElement.addEventListener('keypress', |
| 202 this.handlePasswordKeyPress_.bind(this)); | 199 this.handlePasswordKeyPress_.bind(this)); |
| (...skipping 671 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 874 handlePodKeyDown_: function(e) { | 871 handlePodKeyDown_: function(e) { |
| 875 if (!this.isAuthTypeUserClick || this.disabled) | 872 if (!this.isAuthTypeUserClick || this.disabled) |
| 876 return; | 873 return; |
| 877 switch (e.keyIdentifier) { | 874 switch (e.keyIdentifier) { |
| 878 case 'Enter': | 875 case 'Enter': |
| 879 case 'U+0020': // Space | 876 case 'U+0020': // Space |
| 880 if (this.parentNode.isFocused(this)) | 877 if (this.parentNode.isFocused(this)) |
| 881 this.parentNode.setActivatedPod(this); | 878 this.parentNode.setActivatedPod(this); |
| 882 break; | 879 break; |
| 883 } | 880 } |
| 884 }, | |
| 885 | |
| 886 /** | |
| 887 * Called when the custom button is clicked. | |
| 888 */ | |
| 889 handleCustomButtonClick_: function() { | |
| 890 chrome.send('customButtonClicked', [this.user.username]); | |
| 891 } | 881 } |
| 892 }; | 882 }; |
| 893 | 883 |
| 894 /** | 884 /** |
| 895 * Creates a public account user pod. | 885 * Creates a public account user pod. |
| 896 * @constructor | 886 * @constructor |
| 897 * @extends {UserPod} | 887 * @extends {UserPod} |
| 898 */ | 888 */ |
| 899 var PublicAccountUserPod = cr.ui.define(function() { | 889 var PublicAccountUserPod = cr.ui.define(function() { |
| 900 var node = UserPod(); | 890 var node = UserPod(); |
| (...skipping 1348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2249 if (this.podsWithPendingImages_.length == 0) { | 2239 if (this.podsWithPendingImages_.length == 0) { |
| 2250 this.classList.remove('images-loading'); | 2240 this.classList.remove('images-loading'); |
| 2251 } | 2241 } |
| 2252 } | 2242 } |
| 2253 }; | 2243 }; |
| 2254 | 2244 |
| 2255 return { | 2245 return { |
| 2256 PodRow: PodRow | 2246 PodRow: PodRow |
| 2257 }; | 2247 }; |
| 2258 }); | 2248 }); |
| OLD | NEW |