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

Unified Diff: chrome/browser/resources/pdf/pdf.js

Issue 766083002: OOP PDF: Use an object element for print preview instead of an embed. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/pdf/pdf.js
diff --git a/chrome/browser/resources/pdf/pdf.js b/chrome/browser/resources/pdf/pdf.js
index 18317eb2fc8f2ba07326967b62460a171b5f50cf..57b80c35179b1f14b2f566f7ef64464aaa848faf 100644
--- a/chrome/browser/resources/pdf/pdf.js
+++ b/chrome/browser/resources/pdf/pdf.js
@@ -55,12 +55,18 @@ function PDFViewer(streamDetails) {
this.beforeZoom_.bind(this),
this.afterZoom_.bind(this),
getScrollbarWidth());
-
+ var isPrintPreview =
+ this.streamDetails.originalUrl.indexOf('chrome://print') == 0;
// Create the plugin object dynamically so we can set its src. The plugin
// element is sized to fill the entire window and is set to be fixed
// positioning, acting as a viewport. The plugin renders into this viewport
// according to the scroll position of the window.
- this.plugin_ = document.createElement('embed');
+ //
+ // TODO(sammc): Remove special casing for print preview. This is currently
+ // necessary because setting the src for an embed element triggers origin
+ // checking and the PDF extension is not allowed to embed URLs with a scheme
+ // of "chrome", which is used by print preview.
+ this.plugin_ = document.createElement(isPrintPreview ? 'object' : 'embed');
// NOTE: The plugin's 'id' field must be set to 'plugin' since
// chrome/renderer/printing/print_web_view_helper.cc actually references it.
this.plugin_.id = 'plugin';
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698