Index: chrome/browser/resources/print_preview/data/ticket_items/print_friendly.js |
diff --git a/chrome/browser/resources/print_preview/data/ticket_items/selection_only.js b/chrome/browser/resources/print_preview/data/ticket_items/print_friendly.js |
similarity index 62% |
copy from chrome/browser/resources/print_preview/data/ticket_items/selection_only.js |
copy to chrome/browser/resources/print_preview/data/ticket_items/print_friendly.js |
index f129a0f7bfb030796a6076ebec386e0740f544b6..8639d22a06d27fd4cc95e2f25a582054f1c0f48d 100644 |
--- a/chrome/browser/resources/print_preview/data/ticket_items/selection_only.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,22 +7,28 @@ cr.define('print_preview.ticket_items', function() { |
/** |
* Ticket item whose value is a {@code boolean} that represents whether to |
- * print selection only. |
+ * simplify the page before printing. |
* @param {!print_preview.DocumentInfo} documentInfo Information about the |
* document to print. |
+ * @param {!print_preview.SelectionOnly} selectionOnly Ticket definig whether |
+ * only selected content should be printed. |
* @constructor |
* @extends {print_preview.ticket_items.TicketItem} |
*/ |
- function SelectionOnly(documentInfo) { |
+ function PrintFriendly(documentInfo, selectionOnly) { |
print_preview.ticket_items.TicketItem.call( |
this, |
null /*appState*/, |
null /*field*/, |
null /*destinationStore*/, |
documentInfo); |
+ |
+ this.isAvailable_ = false; |
+ |
+ this.selectionOnly_ = selectionOnly; |
}; |
- SelectionOnly.prototype = { |
+ PrintFriendly.prototype = { |
__proto__: print_preview.ticket_items.TicketItem.prototype, |
/** @override */ |
@@ -32,8 +38,7 @@ cr.define('print_preview.ticket_items', function() { |
/** @override */ |
isCapabilityAvailable: function() { |
- return this.getDocumentInfoInternal().isModifiable && |
- this.getDocumentInfoInternal().hasSelection; |
+ return this.isAvailable_ && !this.selectionOnly_.isCapabilityAvailable(); |
Aleksey Shlyapnikov
2015/07/07 01:26:17
Wouldn't the behavior be pretty random for the uns
|
}, |
/** @override */ |
@@ -44,11 +49,16 @@ cr.define('print_preview.ticket_items', function() { |
/** @override */ |
getCapabilityNotAvailableValueInternal: function() { |
return false; |
+ }, |
+ |
+ setIsCapabilityAvailable: function(isAvailable) { |
+ this.isAvailable_ = isAvailable; |
+ this.dispatchChangeEventInternal(); |
Aleksey Shlyapnikov
2015/07/07 01:26:17
Dispatch this event only when the value was actual
|
} |
}; |
// Export |
return { |
- SelectionOnly: SelectionOnly |
+ PrintFriendly: PrintFriendly |
}; |
}); |