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 784 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
795 return null; | 795 return null; |
796 }; | 796 }; |
797 | 797 |
798 /** | 798 /** |
799 * Close the menus and restore focus to the page. If a menu item's callback | 799 * Close the menus and restore focus to the page. If a menu item's callback |
800 * was queued, execute it once focus is restored. | 800 * was queued, execute it once focus is restored. |
801 */ | 801 */ |
802 Panel.closeMenusAndRestoreFocus = function() { | 802 Panel.closeMenusAndRestoreFocus = function() { |
803 // Watch for the next focus event. | 803 // Watch for the next focus event. |
804 var onFocus = function(desktop, evt) { | 804 var onFocus = function(desktop, evt) { |
805 desktop.removeEventListener(chrome.automation.EventType.focus, onFocus); | 805 desktop.removeEventListener(chrome.automation.EventType.FOCUS, onFocus); |
806 if (Panel.pendingCallback_) { | 806 if (Panel.pendingCallback_) { |
807 // Clear it before calling it, in case the callback itself triggers | 807 // Clear it before calling it, in case the callback itself triggers |
808 // another pending callback. | 808 // another pending callback. |
809 var pendingCallback = Panel.pendingCallback_; | 809 var pendingCallback = Panel.pendingCallback_; |
810 Panel.pendingCallback_ = null; | 810 Panel.pendingCallback_ = null; |
811 pendingCallback(); | 811 pendingCallback(); |
812 } | 812 } |
813 }.bind(this); | 813 }.bind(this); |
814 | 814 |
815 chrome.automation.getDesktop(function(desktop) { | 815 chrome.automation.getDesktop(function(desktop) { |
816 onFocus = /** @type {function(chrome.automation.AutomationEvent)} */( | 816 onFocus = /** @type {function(chrome.automation.AutomationEvent)} */( |
817 onFocus.bind(this, desktop)); | 817 onFocus.bind(this, desktop)); |
818 desktop.addEventListener(chrome.automation.EventType.focus, | 818 desktop.addEventListener(chrome.automation.EventType.FOCUS, |
819 onFocus, | 819 onFocus, |
820 true); | 820 true); |
821 | 821 |
822 // Make sure all menus are cleared to avoid bogous output when we re-open. | 822 // Make sure all menus are cleared to avoid bogous output when we re-open. |
823 Panel.clearMenus(); | 823 Panel.clearMenus(); |
824 | 824 |
825 // Make sure we're not in full-screen mode. | 825 // Make sure we're not in full-screen mode. |
826 Panel.setMode(Panel.Mode.COLLAPSED); | 826 Panel.setMode(Panel.Mode.COLLAPSED); |
827 | 827 |
828 this.activeMenu_ = null; | 828 this.activeMenu_ = null; |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
878 }, false); | 878 }, false); |
879 | 879 |
880 window.addEventListener('hashchange', function() { | 880 window.addEventListener('hashchange', function() { |
881 if (location.hash == '#fullscreen' || location.hash == '#focus') { | 881 if (location.hash == '#fullscreen' || location.hash == '#focus') { |
882 this.originalStickyState_ = cvox.ChromeVox.isStickyPrefOn; | 882 this.originalStickyState_ = cvox.ChromeVox.isStickyPrefOn; |
883 cvox.ChromeVox.isStickyPrefOn = false; | 883 cvox.ChromeVox.isStickyPrefOn = false; |
884 } else { | 884 } else { |
885 cvox.ChromeVox.isStickyPrefOn = this.originalStickyState_; | 885 cvox.ChromeVox.isStickyPrefOn = this.originalStickyState_; |
886 } | 886 } |
887 }, false); | 887 }, false); |
OLD | NEW |