Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(37)

Side by Side Diff: chrome/browser/resources/pdf/main.js

Issue 1036943004: Use custom scrollbars for print preview on non-retina mac displays. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
45 var streamDetails = { 57 var streamDetails = {
46 streamUrl: url, 58 streamUrl: url,
47 originalUrl: url, 59 originalUrl: url,
48 responseHeaders: '', 60 responseHeaders: '',
49 embedded: window.parent != window, 61 embedded: window.parent != window,
50 tabId: -1 62 tabId: -1
51 }; 63 };
52 if (!chrome.tabs) { 64 if (!chrome.tabs) {
53 initViewer(streamDetails); 65 initViewer(streamDetails);
54 return; 66 return;
(...skipping 21 matching lines...) Expand all
76 88
77 // If the viewer is started from the browser plugin, getStreamInfo will 89 // If the viewer is started from the browser plugin, getStreamInfo will
78 // return the details of the stream. 90 // return the details of the stream.
79 chrome.mimeHandlerPrivate.getStreamInfo(function(streamDetails) { 91 chrome.mimeHandlerPrivate.getStreamInfo(function(streamDetails) {
80 initViewer(streamDetails); 92 initViewer(streamDetails);
81 }); 93 });
82 }; 94 };
83 95
84 main(); 96 main();
85 })(); 97 })();
OLDNEW
« no previous file with comments | « chrome/browser/resources/component_extension_resources.grd ('k') | chrome/browser/resources/pdf/pdf_scripting_api.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698