| 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 PageListView implementation. | 6 * @fileoverview PageListView implementation. |
| 7 * PageListView manages page list, dot list, switcher buttons and handles apps | 7 * PageListView manages page list, dot list, switcher buttons and handles apps |
| 8 * pages callbacks from backend. | 8 * pages callbacks from backend. |
| 9 * | 9 * |
| 10 * Note that you need to have AppLauncherHandler in your WebUI to use this code. | 10 * Note that you need to have AppLauncherHandler in your WebUI to use this code. |
| (...skipping 714 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 725 * Handler for key events on the page. Ctrl-Arrow will switch the visible | 725 * Handler for key events on the page. Ctrl-Arrow will switch the visible |
| 726 * page. | 726 * page. |
| 727 * @param {Event} e The KeyboardEvent. | 727 * @param {Event} e The KeyboardEvent. |
| 728 * @private | 728 * @private |
| 729 */ | 729 */ |
| 730 onDocKeyDown_: function(e) { | 730 onDocKeyDown_: function(e) { |
| 731 if (!e.ctrlKey || e.altKey || e.metaKey || e.shiftKey) | 731 if (!e.ctrlKey || e.altKey || e.metaKey || e.shiftKey) |
| 732 return; | 732 return; |
| 733 | 733 |
| 734 var direction = 0; | 734 var direction = 0; |
| 735 if (e.keyIdentifier == 'Left') | 735 if (e.key == 'ArrowLeft') |
| 736 direction = -1; | 736 direction = -1; |
| 737 else if (e.keyIdentifier == 'Right') | 737 else if (e.key == 'ArrowRight') |
| 738 direction = 1; | 738 direction = 1; |
| 739 else | 739 else |
| 740 return; | 740 return; |
| 741 | 741 |
| 742 var cardIndex = | 742 var cardIndex = |
| 743 (this.cardSlider.currentCard + direction + | 743 (this.cardSlider.currentCard + direction + |
| 744 this.cardSlider.cardCount) % this.cardSlider.cardCount; | 744 this.cardSlider.cardCount) % this.cardSlider.cardCount; |
| 745 this.cardSlider.selectCard(cardIndex, true); | 745 this.cardSlider.selectCard(cardIndex, true); |
| 746 | 746 |
| 747 e.stopPropagation(); | 747 e.stopPropagation(); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 766 if (page.navigationDot) | 766 if (page.navigationDot) |
| 767 page.navigationDot.remove(opt_animate); | 767 page.navigationDot.remove(opt_animate); |
| 768 this.cardSlider.removeCard(page); | 768 this.cardSlider.removeCard(page); |
| 769 }, | 769 }, |
| 770 }; | 770 }; |
| 771 | 771 |
| 772 return { | 772 return { |
| 773 PageListView: PageListView | 773 PageListView: PageListView |
| 774 }; | 774 }; |
| 775 }); | 775 }); |
| OLD | NEW |