Index: chrome/browser/resources/print_preview/data/ticket_items/print_friendly.js |
diff --git a/chrome/browser/resources/print_preview/data/ticket_items/css_background.js b/chrome/browser/resources/print_preview/data/ticket_items/print_friendly.js |
similarity index 65% |
copy from chrome/browser/resources/print_preview/data/ticket_items/css_background.js |
copy to chrome/browser/resources/print_preview/data/ticket_items/print_friendly.js |
index dbaca9132e82c371d83c5a7801d274a164a5a15b..462018a62ac60cb228aa80b15ddc5ca4881c2bfa 100644 |
--- a/chrome/browser/resources/print_preview/data/ticket_items/css_background.js |
+++ b/chrome/browser/resources/print_preview/data/ticket_items/print_friendly.js |
@@ -1,4 +1,4 @@ |
-// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
+// Copyright (c) 2015 The Chromium Authors. All rights reserved. |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
@@ -7,24 +7,28 @@ cr.define('print_preview.ticket_items', function() { |
/** |
* Ticket item whose value is a {@code boolean} that represents whether to |
- * print CSS backgrounds. |
- * @param {!print_preview.AppState} appState App state to persist CSS |
- * background value. |
+ * simplify the page before printing. |
+ * @param {!print_preview.AppState} appState App state to persist print |
+ * friendly value. |
* @param {!print_preview.DocumentInfo} documentInfo Information about the |
* document to print. |
* @constructor |
* @extends {print_preview.ticket_items.TicketItem} |
*/ |
- function CssBackground(appState, documentInfo) { |
+ function PrintFriendly(appState, documentInfo, selectionOnly) { |
print_preview.ticket_items.TicketItem.call( |
this, |
appState, |
- print_preview.AppState.Field.IS_CSS_BACKGROUND_ENABLED, |
+ print_preview.AppState.Field.IS_PRINT_FRIENDLY_ENABLED, |
null /*destinationStore*/, |
documentInfo); |
+ |
+ this.isAvailable_ = false; |
+ |
+ this.selectionOnly_ = selectionOnly; |
}; |
- CssBackground.prototype = { |
+ PrintFriendly.prototype = { |
__proto__: print_preview.ticket_items.TicketItem.prototype, |
/** @override */ |
@@ -34,7 +38,7 @@ cr.define('print_preview.ticket_items', function() { |
/** @override */ |
isCapabilityAvailable: function() { |
- return this.getDocumentInfoInternal().isModifiable; |
+ return this.isAvailable_ && !this.selectionOnly_.getValue(); |
}, |
/** @override */ |
@@ -45,11 +49,15 @@ cr.define('print_preview.ticket_items', function() { |
/** @override */ |
getCapabilityNotAvailableValueInternal: function() { |
return false; |
+ }, |
+ |
+ setIsCapabilityAvailable: function(isAvailable) { |
+ this.isAvailable_ = isAvailable; |
} |
}; |
// Export |
return { |
- CssBackground: CssBackground |
+ PrintFriendly: PrintFriendly |
}; |
}); |