Index: chrome/browser/resources/print_preview/data/print_ticket_store.js |
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 efb689e1ec9cd714c17bd06ab02e597214ff78ae..6a5aabf29f9070fff9cce153ed41e6ec6814e6cd 100644 |
--- a/chrome/browser/resources/print_preview/data/print_ticket_store.js |
+++ b/chrome/browser/resources/print_preview/data/print_ticket_store.js |
@@ -152,6 +152,14 @@ cr.define('print_preview', function() { |
this.documentInfo_, this.destinationStore_); |
/** |
+ * Print CSS backgrounds ticket item. |
+ * @type {!print_preview.ticket_items.CssBackground} |
+ * @private |
+ */ |
+ this.cssBackground_ = |
+ new print_preview.ticket_items.CssBackground(this.documentInfo_); |
+ |
+ /** |
* Keeps track of event listeners for the print ticket store. |
* @type {!EventTracker} |
* @private |
@@ -289,6 +297,8 @@ cr.define('print_preview', function() { |
this.headerFooter_.updateValue(this.appState_.isHeaderFooterEnabled); |
this.landscape_.updateValue(this.appState_.isLandscapeEnabled); |
this.collate_.updateValue(this.appState_.isCollateEnabled); |
+ this.cssBackground_.updateValue( |
+ this.appState_.isCssBackgroundEnabled); |
}, |
/** @return {boolean} Whether the ticket store has the copies capability. */ |
@@ -609,6 +619,34 @@ cr.define('print_preview', function() { |
}, |
/** |
+ * @return {boolean} Whether the print CSS backgrounds capability is |
+ * available. |
+ */ |
+ hasCssBackgroundCapability: function() { |
+ return this.cssBackground_.isCapabilityAvailable(); |
+ }, |
+ |
+ /** |
+ * @return {boolean} Whether the print CSS backgrounds capability is |
+ * enabled. |
+ */ |
+ isCssBackgroundEnabled: function() { |
+ return this.cssBackground_.getValue(); |
+ }, |
+ |
+ /** |
+ * @param {boolean} isCssBackgroundEnabled Whether to enable the |
+ * print CSS backgrounds capability. |
+ */ |
+ updateCssBackground: function(isCssBackgroundEnabled) { |
+ if (this.cssBackground_.getValue() != isCssBackgroundEnabled) { |
+ this.cssBackground_.updateValue(isCssBackgroundEnabled); |
+ this.appState_.persistIsCssBackgroundEnabled(isCssBackgroundEnabled); |
+ cr.dispatchSimpleEvent(this, PrintTicketStore.EventType.TICKET_CHANGE); |
+ } |
+ }, |
+ |
+ /** |
* @return {boolean} {@code true} if the stored print ticket is valid, |
* {@code false} otherwise. |
*/ |