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

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

Issue 7063030: PrintPreview: Print Preview is not staying associated with initiator renderer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix win compile error Created 9 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources/print_preview.js
diff --git a/chrome/browser/resources/print_preview.js b/chrome/browser/resources/print_preview.js
index b91cf2e83b1855592814a620d870ae49ac66f36a..a2aa9d2f763254807977b30af4c4ea271ffdc052 100644
--- a/chrome/browser/resources/print_preview.js
+++ b/chrome/browser/resources/print_preview.js
@@ -30,6 +30,9 @@ const MANAGE_PRINTERS = 'Manage Printers';
// State of the print preview settings.
var printSettings = new PrintSettings();
+// Preview UI identifier.
+var previewUIIdentifier = null;
Lei Zhang 2011/05/26 01:48:31 This doesn't need to be a global variable. Just pa
kmadhusu 2011/05/26 15:51:22 Done.
+
/**
* Window onload handler, sets up the page and starts print preview by getting
* the printer list.
@@ -493,12 +496,11 @@ function onPDFLoad() {
* @param {number} pageCount The expected total pages count.
* @param {string} jobTitle The print job title.
* @param {boolean} modifiable If the preview is modifiable.
- *
+ * @param {string} previewUIId Preview UI identifier.
*/
-function updatePrintPreview(pageCount, jobTitle, modifiable) {
+function updatePrintPreview(pageCount, jobTitle, modifiable, previewUIId) {
var tempPrintSettings = new PrintSettings();
tempPrintSettings.save();
-
previewModifiable = modifiable;
if (totalPageCount == -1)
@@ -529,6 +531,9 @@ function updatePrintPreview(pageCount, jobTitle, modifiable) {
// Update the current tab title.
document.title = localStrings.getStringF('printPreviewTitleFormat', jobTitle);
+ // Store the preview tab identifier.
+ previewUIIdentifier = previewUIId;
+
createPDFPlugin();
updatePrintSummary();
updatePrintButtonState();
@@ -561,7 +566,8 @@ function createPDFPlugin() {
var pdfPlugin = document.createElement('embed');
pdfPlugin.setAttribute('id', 'pdf-viewer');
pdfPlugin.setAttribute('type', 'application/pdf');
- pdfPlugin.setAttribute('src', 'chrome://print/print.pdf');
+ pdfPlugin.setAttribute('src',
+ 'chrome://print/print.pdf/' + previewUIIdentifier);
var mainView = $('mainview');
mainView.appendChild(pdfPlugin);
pdfPlugin.onload('onPDFLoad()');

Powered by Google App Engine
This is Rietveld 408576698