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

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

Issue 11818062: Adds option to enable CSS backgrounds for printing. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Merge with trunk. Created 7 years, 11 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/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.
*/

Powered by Google App Engine
This is Rietveld 408576698