summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorabodenha@google.com <abodenha@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2012-07-23 19:44:44 +0000
committerabodenha@google.com <abodenha@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2012-07-23 19:44:44 +0000
commit68f595a66a0bae7ed0e4af968f68fc9f2684a6fa (patch)
treebc15633f80cafadd4096abe853243e4a3b160430
parentbafbc3ef265d089837ddfd77430959674be3960c (diff)
downloadchromium_src-68f595a66a0bae7ed0e4af968f68fc9f2684a6fa.zip
chromium_src-68f595a66a0bae7ed0e4af968f68fc9f2684a6fa.tar.gz
chromium_src-68f595a66a0bae7ed0e4af968f68fc9f2684a6fa.tar.bz2
Merge 146438 - Sets print preview document title.
BUG=136924 TEST= Review URL: https://chromiumcodereview.appspot.com/10693159 TBR=rltoscano@google.com Review URL: https://chromiumcodereview.appspot.com/10802076 git-svn-id: svn://svn.chromium.org/chrome/branches/1180/src@147901 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/resources/print_preview/data/document_info.js6
-rw-r--r--chrome/browser/resources/print_preview/data/print_ticket_store.js3
-rw-r--r--chrome/browser/resources/print_preview/native_layer.js17
-rw-r--r--chrome/browser/resources/print_preview/print_preview.js2
-rw-r--r--chrome/test/data/webui/print_preview.js2
5 files changed, 29 insertions, 1 deletions
diff --git a/chrome/browser/resources/print_preview/data/document_info.js b/chrome/browser/resources/print_preview/data/document_info.js
index dd2fdcd..50f3b8f 100644
--- a/chrome/browser/resources/print_preview/data/document_info.js
+++ b/chrome/browser/resources/print_preview/data/document_info.js
@@ -46,6 +46,12 @@ cr.define('print_preview', function() {
* @type {print_preview.Margins}
*/
this.margins = null;
+
+ /**
+ * Title of document.
+ * @type {string}
+ */
+ this.title = '';
};
// Export
diff --git a/chrome/browser/resources/print_preview/data/print_ticket_store.js b/chrome/browser/resources/print_preview/data/print_ticket_store.js
index 7f3a917..b9e2e4a 100644
--- a/chrome/browser/resources/print_preview/data/print_ticket_store.js
+++ b/chrome/browser/resources/print_preview/data/print_ticket_store.js
@@ -250,6 +250,7 @@ cr.define('print_preview', function() {
* Initializes the print ticket store. Dispatches an INITIALIZE event.
* @param {boolean} isDocumentModifiable Whether the document to print is
* modifiable (i.e. can be re-flowed by Chromium).
+ * @param {string} documentTitle Title of the document to print.
* @param {?boolean} isDuplexEnabled Previous duplex setting.
* @param {?boolean} isHeaderFooterEnabled Previous header-footer setting.
* @param {print_preview.ticket_items.MarginsType.Value} marginsType
@@ -262,6 +263,7 @@ cr.define('print_preview', function() {
*/
initialize: function(
isDocumentModifiable,
+ documentTitle,
isDuplexEnabled,
isHeaderFooterEnabled,
marginsType,
@@ -271,6 +273,7 @@ cr.define('print_preview', function() {
unitType) {
this.documentInfo_.isModifiable = isDocumentModifiable;
+ this.documentInfo_.title = documentTitle;
this.measurementSystem_.setSystem(
thousandsDelimeter, decimalDelimeter, unitType);
diff --git a/chrome/browser/resources/print_preview/native_layer.js b/chrome/browser/resources/print_preview/native_layer.js
index 712bf42..eca7fb2 100644
--- a/chrome/browser/resources/print_preview/native_layer.js
+++ b/chrome/browser/resources/print_preview/native_layer.js
@@ -134,7 +134,7 @@ cr.define('print_preview', function() {
printTicketStore.getPageNumberSet().getPageRanges() : [];
var ticket = {
- 'pageRange': pageRanges, // pageRanges,
+ 'pageRange': pageRanges,
'landscape': printTicketStore.isLandscapeEnabled(),
'color': printTicketStore.isColorEnabled() ?
NativeLayer.ColorMode_.COLOR : NativeLayer.ColorMode_.GRAY,
@@ -354,6 +354,7 @@ cr.define('print_preview', function() {
numberFormatSymbols[1] || '.',
unitType,
initialSettings['previewModifiable'] || false,
+ initialSettings['initiatorTabTitle'] || '',
marginsType,
customMargins,
initialSettings['duplex'] || false,
@@ -570,6 +571,7 @@ cr.define('print_preview', function() {
* local machine's measurement system.
* @param {boolean} isDocumentModifiable Whether the document to print is
* modifiable.
+ * @param {string} documentTitle Title of the document.
* @param {print_preview.ticket_items.MarginsType.Value} marginsType Initial
* margins type.
* @param {print_preview.Margins} customMargins Initial custom margins.
@@ -586,6 +588,7 @@ cr.define('print_preview', function() {
decimalDelimeter,
unitType,
isDocumentModifiable,
+ documentTitle,
marginsType,
customMargins,
isDuplexEnabled,
@@ -628,6 +631,13 @@ cr.define('print_preview', function() {
this.isDocumentModifiable_ = isDocumentModifiable;
/**
+ * Title of the document.
+ * @type {string}
+ * @private
+ */
+ this.documentTitle_ = documentTitle;
+
+ /**
* Initial margins type.
* @type {print_preview.ticket_items.MarginsType.Value}
* @private
@@ -694,6 +704,11 @@ cr.define('print_preview', function() {
return this.isDocumentModifiable_;
},
+ /** @return {string} Document title. */
+ get documentTitle() {
+ return this.documentTitle_;
+ },
+
/**
* @return {print_preview.ticket_items.MarginsType.Value} Initial margins
* type or {@code null} if not initially set.
diff --git a/chrome/browser/resources/print_preview/print_preview.js b/chrome/browser/resources/print_preview/print_preview.js
index 8d847e5..58b8b8e 100644
--- a/chrome/browser/resources/print_preview/print_preview.js
+++ b/chrome/browser/resources/print_preview/print_preview.js
@@ -445,8 +445,10 @@ cr.define('print_preview', function() {
event.initialSettings.isInKioskAutoPrintMode;
this.destinationStore_.setInitialDestinationId(
event.initialSettings.initialDestinationId);
+ document.title = event.initialSettings.documentTitle;
this.printTicketStore_.initialize(
event.initialSettings.isDocumentModifiable,
+ event.initialSettings.documentTitle,
event.initialSettings.isDuplexEnabled,
event.initialSettings.isHeaderFooterEnabled,
event.initialSettings.marginsType,
diff --git a/chrome/test/data/webui/print_preview.js b/chrome/test/data/webui/print_preview.js
index f9cc287..e33c69c 100644
--- a/chrome/test/data/webui/print_preview.js
+++ b/chrome/test/data/webui/print_preview.js
@@ -106,6 +106,7 @@ PrintPreviewWebUITest.prototype = {
'.' /*decimalDelimeter*/,
1 /*unitType*/,
true /*isDocumentModifiable*/,
+ 'title' /*documentTitle*/,
0 /*marginsType*/,
null /*customMargins*/,
true /*isDuplexEnabled*/,
@@ -632,6 +633,7 @@ TEST_F('PrintPreviewWebUITest', 'TestDuplexSettings', function() {
'.' /*decimalDelimeter*/,
1 /*unitType*/,
true /*isDocumentModifiable*/,
+ 'title' /*documentTitle*/,
0 /*marginsType*/,
null /*customMargins*/,
null /*isDuplexEnabled*/,