| 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 'use strict'; | 5 'use strict'; |
| 6 | 6 |
| 7 <include src="../../../../ui/webui/resources/js/util.js"> | 7 <include src="../../../../ui/webui/resources/js/util.js"> |
| 8 <include src="open_pdf_params_parser.js"> | 8 <include src="open_pdf_params_parser.js"> |
| 9 <include src="pdf.js"> | 9 <include src="pdf.js"> |
| 10 <include src="pdf_scripting_api.js"> | 10 <include src="pdf_scripting_api.js"> |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 | 39 |
| 40 // The viewer may be started directly by passing in the URL of the PDF to load | 40 // The viewer may be started directly by passing in the URL of the PDF to load |
| 41 // as the query string. This is used for print preview in particular. The URL | 41 // as the query string. This is used for print preview in particular. The URL |
| 42 // of this page will be of the form | 42 // of this page will be of the form |
| 43 // 'chrome-extension://<extension id>?<pdf url>'. We pull out the <pdf url> | 43 // 'chrome-extension://<extension id>?<pdf url>'. We pull out the <pdf url> |
| 44 // part here. | 44 // part here. |
| 45 var url = window.location.search.substring(1); | 45 var url = window.location.search.substring(1); |
| 46 var streamDetails = { | 46 var streamDetails = { |
| 47 streamUrl: url, | 47 streamUrl: url, |
| 48 originalUrl: url, | 48 originalUrl: url, |
| 49 responseHeaders: '' | 49 responseHeaders: '', |
| 50 embedded: window.parent != window, |
| 51 tabId: -1 |
| 50 }; | 52 }; |
| 51 viewer = new PDFViewer(streamDetails); | 53 if (!chrome.tabs) { |
| 54 viewer = new PDFViewer(streamDetails); |
| 55 return; |
| 56 } |
| 57 chrome.tabs.getCurrent(function(tab) { |
| 58 if (tab && tab.id != undefined) |
| 59 streamDetails.tabId = tab.id; |
| 60 viewer = new PDFViewer(streamDetails); |
| 61 }); |
| 52 })(); | 62 })(); |
| OLD | NEW |