OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
464 this.resetTabOrder(); | 464 this.resetTabOrder(); |
465 }, | 465 }, |
466 | 466 |
467 /** | 467 /** |
468 * Handles a click event on action area button. | 468 * Handles a click event on action area button. |
469 * @param {Event} e Click event. | 469 * @param {Event} e Click event. |
470 */ | 470 */ |
471 handleActionAreaButtonClick_: function(e) { | 471 handleActionAreaButtonClick_: function(e) { |
472 if (this.parentNode.disabled) | 472 if (this.parentNode.disabled) |
473 return; | 473 return; |
474 console.error('Action area clicked: ' + !this.isActionBoxMenuActive + | |
475 ' at ' + e.x + ', ' + e.y); | |
476 this.isActionBoxMenuActive = !this.isActionBoxMenuActive; | 474 this.isActionBoxMenuActive = !this.isActionBoxMenuActive; |
477 }, | 475 }, |
478 | 476 |
479 /** | 477 /** |
480 * Handles a keydown event on action area button. | 478 * Handles a keydown event on action area button. |
481 * @param {Event} e KeyDown event. | 479 * @param {Event} e KeyDown event. |
482 */ | 480 */ |
483 handleActionAreaButtonKeyDown_: function(e) { | 481 handleActionAreaButtonKeyDown_: function(e) { |
484 if (this.disabled) | 482 if (this.disabled) |
485 return; | 483 return; |
486 switch (e.keyIdentifier) { | 484 switch (e.keyIdentifier) { |
487 case 'Enter': | 485 case 'Enter': |
488 case 'U+0020': // Space | 486 case 'U+0020': // Space |
489 if (this.parentNode.focusedPod_ && !this.isActionBoxMenuActive) { | 487 if (this.parentNode.focusedPod_ && !this.isActionBoxMenuActive) |
490 console.error('Action area keyed: ' + !this.isActionBoxMenuActive + | |
491 ' at ' + e.x + ', ' + e.y); | |
492 this.isActionBoxMenuActive = true; | 488 this.isActionBoxMenuActive = true; |
493 } | |
494 e.stopPropagation(); | 489 e.stopPropagation(); |
495 break; | 490 break; |
496 case 'Up': | 491 case 'Up': |
497 case 'Down': | 492 case 'Down': |
498 if (this.isActionBoxMenuActive) { | 493 if (this.isActionBoxMenuActive) { |
499 this.actionBoxMenuRemoveElement.tabIndex = | 494 this.actionBoxMenuRemoveElement.tabIndex = |
500 UserPodTabOrder.PAD_MENU_ITEM; | 495 UserPodTabOrder.PAD_MENU_ITEM; |
501 this.actionBoxMenuRemoveElement.focus(); | 496 this.actionBoxMenuRemoveElement.focus(); |
502 } | 497 } |
503 e.stopPropagation(); | 498 e.stopPropagation(); |
(...skipping 696 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1200 | 1195 |
1201 /** | 1196 /** |
1202 * Handler of click event. | 1197 * Handler of click event. |
1203 * @param {Event} e Click Event object. | 1198 * @param {Event} e Click Event object. |
1204 * @private | 1199 * @private |
1205 */ | 1200 */ |
1206 handleClick_: function(e) { | 1201 handleClick_: function(e) { |
1207 if (this.disabled) | 1202 if (this.disabled) |
1208 return; | 1203 return; |
1209 | 1204 |
1210 console.error('Document clicked at ' + e.x + ', ' + e.y + | |
1211 ', pod: ' + findAncestorByClass(e.target, 'pod')); | |
1212 | |
1213 // Clear all menus if the click is outside pod menu and its | 1205 // Clear all menus if the click is outside pod menu and its |
1214 // button area. | 1206 // button area. |
1215 if (!findAncestorByClass(e.target, 'action-box-menu') && | 1207 if (!findAncestorByClass(e.target, 'action-box-menu') && |
1216 !findAncestorByClass(e.target, 'action-box-area')) { | 1208 !findAncestorByClass(e.target, 'action-box-area')) { |
1217 for (var i = 0, pod; pod = this.pods[i]; ++i) | 1209 for (var i = 0, pod; pod = this.pods[i]; ++i) |
1218 pod.isActionBoxMenuActive = false; | 1210 pod.isActionBoxMenuActive = false; |
1219 } | 1211 } |
1220 | 1212 |
1221 // Clears focus if not clicked on a pod and if there's more than one pod. | 1213 // Clears focus if not clicked on a pod and if there's more than one pod. |
1222 var pod = findAncestorByClass(e.target, 'pod'); | 1214 var pod = findAncestorByClass(e.target, 'pod'); |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1408 this.classList.remove('images-loading'); | 1400 this.classList.remove('images-loading'); |
1409 chrome.send('userImagesLoaded'); | 1401 chrome.send('userImagesLoaded'); |
1410 } | 1402 } |
1411 } | 1403 } |
1412 }; | 1404 }; |
1413 | 1405 |
1414 return { | 1406 return { |
1415 PodRow: PodRow | 1407 PodRow: PodRow |
1416 }; | 1408 }; |
1417 }); | 1409 }); |
OLD | NEW |