| 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 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 303 | 303 |
| 304 // Insert items from the bindings into the menus. | 304 // Insert items from the bindings into the menus. |
| 305 sortedBindings.forEach(goog.bind(function(binding) { | 305 sortedBindings.forEach(goog.bind(function(binding) { |
| 306 var category = cvox.CommandStore.categoryForCommand(binding.command); | 306 var category = cvox.CommandStore.categoryForCommand(binding.command); |
| 307 var menu = category ? categoryToMenu[category] : null; | 307 var menu = category ? categoryToMenu[category] : null; |
| 308 if (binding.title && menu) { | 308 if (binding.title && menu) { |
| 309 menu.addMenuItem( | 309 menu.addMenuItem( |
| 310 binding.title, | 310 binding.title, |
| 311 binding.keySeq, | 311 binding.keySeq, |
| 312 function() { | 312 function() { |
| 313 var bkgnd = | 313 var CommandHandler = |
| 314 chrome.extension. | 314 chrome.extension.getBackgroundPage()['CommandHandler']; |
| 315 getBackgroundPage()['ChromeVoxState']['instance']; | 315 CommandHandler['onCommand'](binding.command); |
| 316 bkgnd['onGotCommand'](binding.command); | |
| 317 }); | 316 }); |
| 318 } | 317 } |
| 319 }, this)); | 318 }, this)); |
| 320 | 319 |
| 321 // Add all open tabs to the Tabs menu. | 320 // Add all open tabs to the Tabs menu. |
| 322 bkgnd.chrome.windows.getLastFocused(function(lastFocusedWindow) { | 321 bkgnd.chrome.windows.getLastFocused(function(lastFocusedWindow) { |
| 323 bkgnd.chrome.windows.getAll({'populate': true}, function(windows) { | 322 bkgnd.chrome.windows.getAll({'populate': true}, function(windows) { |
| 324 for (var i = 0; i < windows.length; i++) { | 323 for (var i = 0; i < windows.length; i++) { |
| 325 var tabs = windows[i].tabs; | 324 var tabs = windows[i].tabs; |
| 326 for (var j = 0; j < tabs.length; j++) { | 325 for (var j = 0; j < tabs.length; j++) { |
| (...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 649 }, false); | 648 }, false); |
| 650 | 649 |
| 651 window.addEventListener('hashchange', function() { | 650 window.addEventListener('hashchange', function() { |
| 652 if (location.hash == '#fullscreen' || location.hash == '#focus') { | 651 if (location.hash == '#fullscreen' || location.hash == '#focus') { |
| 653 this.originalStickyState_ = cvox.ChromeVox.isStickyPrefOn; | 652 this.originalStickyState_ = cvox.ChromeVox.isStickyPrefOn; |
| 654 cvox.ChromeVox.isStickyPrefOn = false; | 653 cvox.ChromeVox.isStickyPrefOn = false; |
| 655 } else { | 654 } else { |
| 656 cvox.ChromeVox.isStickyPrefOn = this.originalStickyState_; | 655 cvox.ChromeVox.isStickyPrefOn = this.originalStickyState_; |
| 657 } | 656 } |
| 658 }, false); | 657 }, false); |
| OLD | NEW |