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 * Turn a dictionary received from postMessage into a key event. | 6 * Turn a dictionary received from postMessage into a key event. |
7 * @param {Object} dict A dictionary representing the key event. | 7 * @param {Object} dict A dictionary representing the key event. |
8 * @return {Event} A key event. | 8 * @return {Event} A key event. |
9 */ | 9 */ |
10 function DeserializeKeyEvent(dict) { | 10 function DeserializeKeyEvent(dict) { |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 * interface which provides access to various features of the viewer for use | 256 * interface which provides access to various features of the viewer for use |
257 * by print preview and accessibility. | 257 * by print preview and accessibility. |
258 * @param {string} src the source URL of the PDF to load initially. | 258 * @param {string} src the source URL of the PDF to load initially. |
259 * @return {HTMLIFrameElement} the iframe element containing the PDF viewer. | 259 * @return {HTMLIFrameElement} the iframe element containing the PDF viewer. |
260 */ | 260 */ |
261 function PDFCreateOutOfProcessPlugin(src) { | 261 function PDFCreateOutOfProcessPlugin(src) { |
262 var iframe = window.document.createElement('iframe'); | 262 var iframe = window.document.createElement('iframe'); |
263 iframe.setAttribute( | 263 iframe.setAttribute( |
264 'src', | 264 'src', |
265 'chrome-extension://mhjfbmdgcfjbbpaeojofohoefgiehjai/index.html?' + src); | 265 'chrome-extension://mhjfbmdgcfjbbpaeojofohoefgiehjai/index.html?' + src); |
| 266 // Prevent the frame from being tab-focusable. |
| 267 iframe.setAttribute('tabindex', '-1'); |
266 var client = new PDFScriptingAPI(window); | 268 var client = new PDFScriptingAPI(window); |
267 iframe.onload = function() { | 269 iframe.onload = function() { |
268 client.setPlugin(iframe.contentWindow); | 270 client.setPlugin(iframe.contentWindow); |
269 }; | 271 }; |
270 // Add the functions to the iframe so that they can be called directly. | 272 // Add the functions to the iframe so that they can be called directly. |
271 iframe.setViewportChangedCallback = | 273 iframe.setViewportChangedCallback = |
272 client.setViewportChangedCallback.bind(client); | 274 client.setViewportChangedCallback.bind(client); |
273 iframe.setLoadCallback = client.setLoadCallback.bind(client); | 275 iframe.setLoadCallback = client.setLoadCallback.bind(client); |
274 iframe.setKeyEventCallback = client.setKeyEventCallback.bind(client); | 276 iframe.setKeyEventCallback = client.setKeyEventCallback.bind(client); |
275 iframe.resetPrintPreviewMode = client.resetPrintPreviewMode.bind(client); | 277 iframe.resetPrintPreviewMode = client.resetPrintPreviewMode.bind(client); |
276 iframe.loadPreviewPage = client.loadPreviewPage.bind(client); | 278 iframe.loadPreviewPage = client.loadPreviewPage.bind(client); |
277 iframe.sendKeyEvent = client.sendKeyEvent.bind(client); | 279 iframe.sendKeyEvent = client.sendKeyEvent.bind(client); |
278 return iframe; | 280 return iframe; |
279 } | 281 } |
OLD | NEW |