OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 Defines a global object. The initialization of this | 6 * @fileoverview Defines a global object. The initialization of this |
7 * object happens in init.js. | 7 * object happens in init.js. |
8 * | 8 * |
9 */ | 9 */ |
10 | 10 |
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 * @return {HTMLElement} with the id. | 268 * @return {HTMLElement} with the id. |
269 */ | 269 */ |
270 function $(id) { | 270 function $(id) { |
271 return document.getElementById(id); | 271 return document.getElementById(id); |
272 } | 272 } |
273 | 273 |
274 /** | 274 /** |
275 * @param {Array} tabs | 275 * @param {Array} tabs |
276 */ | 276 */ |
277 cvox.ChromeVox.injectChromeVoxIntoTabs = function(tabs) {}; | 277 cvox.ChromeVox.injectChromeVoxIntoTabs = function(tabs) {}; |
| 278 |
| 279 /** |
| 280 * Returns whether the document has focus, taking into account whether |
| 281 * it's hidden and also that if an iframe or webview element has focus, |
| 282 * the focus is really inside that frame and not in this document. |
| 283 * @return {boolean} True if the document has focus. |
| 284 */ |
| 285 cvox.ChromeVox.documentHasFocus = function() { |
| 286 if (!document.hasFocus() || document.hidden) { |
| 287 return false; |
| 288 } |
| 289 if (document.activeElement.tagName == 'IFRAME' || |
| 290 document.activeElement.tagName == 'WEBVIEW') { |
| 291 return false; |
| 292 } |
| 293 return true; |
| 294 }; |
OLD | NEW |