| 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 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 // Insert items from the bindings into the menus. | 289 // Insert items from the bindings into the menus. |
| 290 sortedBindings.forEach(goog.bind(function(binding) { | 290 sortedBindings.forEach(goog.bind(function(binding) { |
| 291 var category = cvox.CommandStore.categoryForCommand(binding.command); | 291 var category = cvox.CommandStore.categoryForCommand(binding.command); |
| 292 var menu = category ? categoryToMenu[category] : null; | 292 var menu = category ? categoryToMenu[category] : null; |
| 293 if (binding.title && menu) { | 293 if (binding.title && menu) { |
| 294 menu.addMenuItem( | 294 menu.addMenuItem( |
| 295 binding.title, | 295 binding.title, |
| 296 binding.keySeq, | 296 binding.keySeq, |
| 297 function() { | 297 function() { |
| 298 var bkgnd = | 298 var bkgnd = |
| 299 chrome.extension. | 299 chrome.extension.getBackgroundPage()['global']['backgroundObj']; |
| 300 getBackgroundPage()['ChromeVoxState']['instance']; | |
| 301 bkgnd['onGotCommand'](binding.command); | 300 bkgnd['onGotCommand'](binding.command); |
| 302 }); | 301 }); |
| 303 } | 302 } |
| 304 }, this)); | 303 }, this)); |
| 305 | 304 |
| 306 // Add all open tabs to the Tabs menu. | 305 // Add all open tabs to the Tabs menu. |
| 307 bkgnd.chrome.windows.getLastFocused(function(lastFocusedWindow) { | 306 bkgnd.chrome.windows.getLastFocused(function(lastFocusedWindow) { |
| 308 bkgnd.chrome.windows.getAll({'populate': true}, function(windows) { | 307 bkgnd.chrome.windows.getAll({'populate': true}, function(windows) { |
| 309 for (var i = 0; i < windows.length; i++) { | 308 for (var i = 0; i < windows.length; i++) { |
| 310 var tabs = windows[i].tabs; | 309 var tabs = windows[i].tabs; |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 538 Panel.searchInput_.value = ''; | 537 Panel.searchInput_.value = ''; |
| 539 } | 538 } |
| 540 } | 539 } |
| 541 }; | 540 }; |
| 542 | 541 |
| 543 /** | 542 /** |
| 544 * Open the ChromeVox Options. | 543 * Open the ChromeVox Options. |
| 545 */ | 544 */ |
| 546 Panel.onOptions = function() { | 545 Panel.onOptions = function() { |
| 547 var bkgnd = | 546 var bkgnd = |
| 548 chrome.extension.getBackgroundPage()['ChromeVoxState']['instance']; | 547 chrome.extension.getBackgroundPage()['global']['backgroundObj']; |
| 549 bkgnd['showOptionsPage'](); | 548 bkgnd['showOptionsPage'](); |
| 550 window.location = '#'; | 549 window.location = '#'; |
| 551 }; | 550 }; |
| 552 | 551 |
| 553 /** | 552 /** |
| 554 * Exit ChromeVox. | 553 * Exit ChromeVox. |
| 555 */ | 554 */ |
| 556 Panel.onClose = function() { | 555 Panel.onClose = function() { |
| 557 window.location = '#close'; | 556 window.location = '#close'; |
| 558 }; | 557 }; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 569 | 568 |
| 570 /** | 569 /** |
| 571 * Close the menus and restore focus to the page. If a menu item's callback | 570 * Close the menus and restore focus to the page. If a menu item's callback |
| 572 * was queued, execute it once focus is restored. | 571 * was queued, execute it once focus is restored. |
| 573 */ | 572 */ |
| 574 Panel.closeMenusAndRestoreFocus = function() { | 573 Panel.closeMenusAndRestoreFocus = function() { |
| 575 // Make sure we're not in full-screen mode. | 574 // Make sure we're not in full-screen mode. |
| 576 window.location = '#'; | 575 window.location = '#'; |
| 577 | 576 |
| 578 var bkgnd = | 577 var bkgnd = |
| 579 chrome.extension.getBackgroundPage()['ChromeVoxState']['instance']; | 578 chrome.extension.getBackgroundPage()['global']['backgroundObj']; |
| 580 bkgnd['endExcursion'](Panel.pendingCallback_); | 579 bkgnd['endExcursion'](Panel.pendingCallback_); |
| 581 }; | 580 }; |
| 582 | 581 |
| 583 window.addEventListener('load', function() { | 582 window.addEventListener('load', function() { |
| 584 Panel.init(); | 583 Panel.init(); |
| 585 }, false); | 584 }, false); |
| 586 | 585 |
| 587 window.addEventListener('hashchange', function() { | 586 window.addEventListener('hashchange', function() { |
| 588 if (location.hash == '#fullscreen' || location.hash == '#focus') { | 587 if (location.hash == '#fullscreen' || location.hash == '#focus') { |
| 589 this.originalStickyState_ = cvox.ChromeVox.isStickyPrefOn; | 588 this.originalStickyState_ = cvox.ChromeVox.isStickyPrefOn; |
| 590 cvox.ChromeVox.isStickyPrefOn = false; | 589 cvox.ChromeVox.isStickyPrefOn = false; |
| 591 } else { | 590 } else { |
| 592 cvox.ChromeVox.isStickyPrefOn = this.originalStickyState_; | 591 cvox.ChromeVox.isStickyPrefOn = this.originalStickyState_; |
| 593 } | 592 } |
| 594 }, false); | 593 }, false); |
| OLD | NEW |