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 /** | 7 /** |
8 * Global PDFViewer object, accessible for testing. | 8 * Global PDFViewer object, accessible for testing. |
9 * @type Object | 9 * @type Object |
10 */ | 10 */ |
(...skipping 24 matching lines...) Expand all Loading... |
35 function initViewer(streamDetails) { | 35 function initViewer(streamDetails) { |
36 // PDFViewer will handle any messages after it is created. | 36 // PDFViewer will handle any messages after it is created. |
37 window.removeEventListener('message', handleScriptingMessage, false); | 37 window.removeEventListener('message', handleScriptingMessage, false); |
38 viewer = new PDFViewer(streamDetails); | 38 viewer = new PDFViewer(streamDetails); |
39 while (pendingMessages.length > 0) | 39 while (pendingMessages.length > 0) |
40 viewer.handleScriptingMessage(pendingMessages.shift()); | 40 viewer.handleScriptingMessage(pendingMessages.shift()); |
41 } | 41 } |
42 | 42 |
43 function generateStreamDetailsAndInitViewer() { | 43 function generateStreamDetailsAndInitViewer() { |
44 var url = window.location.search.substring(1); | 44 var url = window.location.search.substring(1); |
45 | |
46 // Hack to enable custom scrollbars for print preview on non-retina mac | |
47 // displays. Remove after crbug.com/466039 is fixed. | |
48 if (url.indexOf(IS_MAC_PARAM) === 0) { | |
49 url = url.substring(IS_MAC_PARAM.length); | |
50 var link = document.createElement('link'); | |
51 link.rel = 'stylesheet'; | |
52 link.type = 'text/css'; | |
53 link.href = 'scrollbars_mac.css'; | |
54 document.getElementsByTagName('head')[0].appendChild(link); | |
55 } | |
56 | |
57 var streamDetails = { | 45 var streamDetails = { |
58 streamUrl: url, | 46 streamUrl: url, |
59 originalUrl: url, | 47 originalUrl: url, |
60 responseHeaders: '', | 48 responseHeaders: '', |
61 embedded: window.parent != window, | 49 embedded: window.parent != window, |
62 tabId: -1 | 50 tabId: -1 |
63 }; | 51 }; |
64 if (!chrome.tabs) { | 52 if (!chrome.tabs) { |
65 initViewer(streamDetails); | 53 initViewer(streamDetails); |
66 return; | 54 return; |
(...skipping 21 matching lines...) Expand all Loading... |
88 | 76 |
89 // If the viewer is started from the browser plugin, getStreamInfo will | 77 // If the viewer is started from the browser plugin, getStreamInfo will |
90 // return the details of the stream. | 78 // return the details of the stream. |
91 chrome.mimeHandlerPrivate.getStreamInfo(function(streamDetails) { | 79 chrome.mimeHandlerPrivate.getStreamInfo(function(streamDetails) { |
92 initViewer(streamDetails); | 80 initViewer(streamDetails); |
93 }); | 81 }); |
94 }; | 82 }; |
95 | 83 |
96 main(); | 84 main(); |
97 })(); | 85 })(); |
OLD | NEW |