OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 The ChromeVox panel and menus. | 6 * @fileoverview The ChromeVox panel and menus. |
7 */ | 7 */ |
8 | 8 |
9 goog.provide('Panel'); | 9 goog.provide('Panel'); |
10 | 10 |
(...skipping 776 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
787 return null; | 787 return null; |
788 }; | 788 }; |
789 | 789 |
790 /** | 790 /** |
791 * Close the menus and restore focus to the page. If a menu item's callback | 791 * Close the menus and restore focus to the page. If a menu item's callback |
792 * was queued, execute it once focus is restored. | 792 * was queued, execute it once focus is restored. |
793 */ | 793 */ |
794 Panel.closeMenusAndRestoreFocus = function() { | 794 Panel.closeMenusAndRestoreFocus = function() { |
795 // Watch for the next focus event. | 795 // Watch for the next focus event. |
796 var onFocus = function(desktop, evt) { | 796 var onFocus = function(desktop, evt) { |
797 desktop.removeEventListener(chrome.automation.EventType.focus, onFocus); | 797 desktop.removeEventListener(chrome.automation.EventType.FOCUS, onFocus); |
798 if (Panel.pendingCallback_) { | 798 if (Panel.pendingCallback_) { |
799 // Clear it before calling it, in case the callback itself triggers | 799 // Clear it before calling it, in case the callback itself triggers |
800 // another pending callback. | 800 // another pending callback. |
801 var pendingCallback = Panel.pendingCallback_; | 801 var pendingCallback = Panel.pendingCallback_; |
802 Panel.pendingCallback_ = null; | 802 Panel.pendingCallback_ = null; |
803 pendingCallback(); | 803 pendingCallback(); |
804 } | 804 } |
805 }.bind(this); | 805 }.bind(this); |
806 | 806 |
807 chrome.automation.getDesktop(function(desktop) { | 807 chrome.automation.getDesktop(function(desktop) { |
808 onFocus = /** @type {function(chrome.automation.AutomationEvent)} */( | 808 onFocus = /** @type {function(chrome.automation.AutomationEvent)} */( |
809 onFocus.bind(this, desktop)); | 809 onFocus.bind(this, desktop)); |
810 desktop.addEventListener(chrome.automation.EventType.focus, | 810 desktop.addEventListener(chrome.automation.EventType.FOCUS, |
811 onFocus, | 811 onFocus, |
812 true); | 812 true); |
813 | 813 |
814 // Make sure all menus are cleared to avoid bogous output when we re-open. | 814 // Make sure all menus are cleared to avoid bogous output when we re-open. |
815 Panel.clearMenus(); | 815 Panel.clearMenus(); |
816 | 816 |
817 // Make sure we're not in full-screen mode. | 817 // Make sure we're not in full-screen mode. |
818 Panel.setMode(Panel.Mode.COLLAPSED); | 818 Panel.setMode(Panel.Mode.COLLAPSED); |
819 | 819 |
820 this.activeMenu_ = null; | 820 this.activeMenu_ = null; |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
870 }, false); | 870 }, false); |
871 | 871 |
872 window.addEventListener('hashchange', function() { | 872 window.addEventListener('hashchange', function() { |
873 if (location.hash == '#fullscreen' || location.hash == '#focus') { | 873 if (location.hash == '#fullscreen' || location.hash == '#focus') { |
874 this.originalStickyState_ = cvox.ChromeVox.isStickyPrefOn; | 874 this.originalStickyState_ = cvox.ChromeVox.isStickyPrefOn; |
875 cvox.ChromeVox.isStickyPrefOn = false; | 875 cvox.ChromeVox.isStickyPrefOn = false; |
876 } else { | 876 } else { |
877 cvox.ChromeVox.isStickyPrefOn = this.originalStickyState_; | 877 cvox.ChromeVox.isStickyPrefOn = this.originalStickyState_; |
878 } | 878 } |
879 }, false); | 879 }, false); |
OLD | NEW |