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

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

Issue 7818010: Print Preview: Populating print preview tab title as soon as it is known. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixing unused parameters style Created 9 years, 3 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
« no previous file with comments | « no previous file | chrome/browser/ui/webui/print_preview_handler.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/print_preview/print_preview.js
diff --git a/chrome/browser/resources/print_preview/print_preview.js b/chrome/browser/resources/print_preview/print_preview.js
index f1ce284e20a6ac9c8ef4e4b6513856c77f320500..b73f6b91197ddca018ddcbf220b551e5e3962d6f 100644
--- a/chrome/browser/resources/print_preview/print_preview.js
+++ b/chrome/browser/resources/print_preview/print_preview.js
@@ -137,6 +137,7 @@ function onLoad() {
$('printer-list').onchange = updateControlsWithSelectedPrinterCapabilities;
showLoadingAnimation();
+ chrome.send('getInitiatorTabTitle');
chrome.send('getDefaultPrinter');
}
@@ -896,15 +897,12 @@ function setPluginPreviewPageCount() {
* modified.
* @param {number} previewResponseId The preview request id that resulted in
* this response.
- * @param {string} jobTitle The print job title
*/
-function onDidGetPreviewPageCount(pageCount, isModifiable, previewResponseId,
- jobTitle) {
+function onDidGetPreviewPageCount(pageCount, isModifiable, previewResponseId) {
if (!isExpectedPreviewResponse(previewResponseId))
return;
pageSettings.updateState(pageCount);
previewModifiable = isModifiable;
- document.title = localStrings.getStringF('printPreviewTitleFormat', jobTitle);
if (!previewModifiable && pageSettings.requestPrintPreviewIfNeeded())
return;
@@ -1086,6 +1084,19 @@ PrintSettings.prototype.save = function() {
this.hasHeaderFooter = headerFooterSettings.hasHeaderFooter();
}
+/**
+ * Updates the title of the print preview tab according to |initiatorTabTitle|.
+ * Called from PrintPreviewUI::OnGetInitiatorTabTitle as a result of sending a
+ * 'getInitiatorTabTitle' message.
+ * @param {string} initiatorTabTitle The title of the initiator tab.
+ */
+function setInitiatorTabTitle(initiatorTabTitle) {
+ if (initiatorTabTitle == '')
+ return;
+ document.title = localStrings.getStringF(
+ 'printPreviewTitleFormat', initiatorTabTitle);
+}
+
/// Pull in all other scripts in a single shot.
<include src="print_preview_animations.js"/>
<include src="print_preview_cloud.js"/>
« no previous file with comments | « no previous file | chrome/browser/ui/webui/print_preview_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698