Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1786)

Side by Side Diff: chrome/browser/resources/chromeos/chromevox/cvox2/background/panel.js

Issue 2412433004: Recovery: Implement focus recovery across root AutomationNodes (Closed)
Patch Set: Address feedback. Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/resources/chromeos/chromevox/cvox2/background/i_search.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 599 matching lines...) Expand 10 before | Expand all | Expand 10 after
610 if (this.activeMenu_) 610 if (this.activeMenu_)
611 return this.activeMenu_.getCallbackForCurrentItem(); 611 return this.activeMenu_.getCallbackForCurrentItem();
612 return null; 612 return null;
613 }; 613 };
614 614
615 /** 615 /**
616 * Close the menus and restore focus to the page. If a menu item's callback 616 * Close the menus and restore focus to the page. If a menu item's callback
617 * was queued, execute it once focus is restored. 617 * was queued, execute it once focus is restored.
618 */ 618 */
619 Panel.closeMenusAndRestoreFocus = function() { 619 Panel.closeMenusAndRestoreFocus = function() {
620 // Make sure we're not in full-screen mode. 620 // Watch for the next focus event.
621 window.location = '#'; 621 var onFocus = function(desktop, evt) {
622 desktop.removeEventListener(chrome.automation.EventType.focus, onFocus);
623 Panel.pendingCallback_ && Panel.pendingCallback_();
624 }.bind(this);
622 625
623 this.activeMenu_ = null; 626 chrome.automation.getDesktop(function(desktop) {
627 onFocus = /** @type {function(chrome.automation.AutomationEvent)} */(
628 onFocus.bind(this, desktop));
629 desktop.addEventListener(chrome.automation.EventType.focus,
630 onFocus,
631 true);
624 632
625 var bkgnd = 633 // Make sure all menus are cleared to avoid bogous output when we re-open.
626 chrome.extension.getBackgroundPage()['ChromeVoxState']['instance']; 634 Panel.clearMenus();
627 bkgnd['endExcursion'](Panel.pendingCallback_); 635
636 // Make sure we're not in full-screen mode.
637 window.location = '#';
638
639 this.activeMenu_ = null;
640 });
628 }; 641 };
629 642
630 /** 643 /**
631 * Open the tutorial. 644 * Open the tutorial.
632 */ 645 */
633 Panel.onTutorial = function() { 646 Panel.onTutorial = function() {
634 var bkgnd =
635 chrome.extension.getBackgroundPage()['ChromeVoxState']['instance'];
636 bkgnd['startExcursion']();
637
638 // Change the url fragment to 'fullscreen', which signals the native 647 // Change the url fragment to 'fullscreen', which signals the native
639 // host code to make the window fullscreen, revealing the menus. 648 // host code to make the window fullscreen, revealing the menus.
640 window.location = '#fullscreen'; 649 window.location = '#fullscreen';
641 650
642 $('main').style.display = 'none'; 651 $('main').style.display = 'none';
643 $('menus_background').style.display = 'none'; 652 $('menus_background').style.display = 'none';
644 $('tutorial').style.display = 'block'; 653 $('tutorial').style.display = 'block';
645 654
646 Panel.tutorial_.firstPage(); 655 Panel.tutorial_.firstPage();
647 }; 656 };
(...skipping 26 matching lines...) Expand all
674 }, false); 683 }, false);
675 684
676 window.addEventListener('hashchange', function() { 685 window.addEventListener('hashchange', function() {
677 if (location.hash == '#fullscreen' || location.hash == '#focus') { 686 if (location.hash == '#fullscreen' || location.hash == '#focus') {
678 this.originalStickyState_ = cvox.ChromeVox.isStickyPrefOn; 687 this.originalStickyState_ = cvox.ChromeVox.isStickyPrefOn;
679 cvox.ChromeVox.isStickyPrefOn = false; 688 cvox.ChromeVox.isStickyPrefOn = false;
680 } else { 689 } else {
681 cvox.ChromeVox.isStickyPrefOn = this.originalStickyState_; 690 cvox.ChromeVox.isStickyPrefOn = this.originalStickyState_;
682 } 691 }
683 }, false); 692 }, false);
OLDNEW
« no previous file with comments | « chrome/browser/resources/chromeos/chromevox/cvox2/background/i_search.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698