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

Unified Diff: chrome/browser/resources/print_preview/native_layer.js

Issue 1125343004: Add a "Simplify Page" option to the print preview dialog (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Simplify version of the HiddenPrintPreview and solved issues pointed out by the last review Created 5 years, 6 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/native_layer.js
diff --git a/chrome/browser/resources/print_preview/native_layer.js b/chrome/browser/resources/print_preview/native_layer.js
index d9289ffc33c028a4c40d6d1d446d10871dcc0759..2d68f6c9024cf8ec0f331940e5f8b889d5b8bd46 100644
--- a/chrome/browser/resources/print_preview/native_layer.js
+++ b/chrome/browser/resources/print_preview/native_layer.js
@@ -67,6 +67,8 @@ cr.define('print_preview', function() {
this.onEnableManipulateSettingsForTest_.bind(this);
global.printPresetOptionsFromDocument =
this.onPrintPresetOptionsFromDocument_.bind(this);
+ global.onDetectedSimplifiablePage =
Vitaly Buka (NO REVIEWS) 2015/07/13 07:00:30 DetectDistillablePage
arjunpatel 2015/07/21 17:25:00 Acknowledged.
+ this.onDetectedSimplifiablePage_.bind(this);
global.onProvisionalPrinterResolved =
this.onProvisionalDestinationResolved_.bind(this);
global.failedToResolveProvisionalPrinter =
@@ -80,6 +82,7 @@ cr.define('print_preview', function() {
*/
NativeLayer.EventType = {
ACCESS_TOKEN_READY: 'print_preview.NativeLayer.ACCESS_TOKEN_READY',
+ ALLOW_PRINT_FRIENDLY: 'print_preview.NativeLayer.ALLOW_PRINT_FRIENDLY',
CAPABILITIES_SET: 'print_preview.NativeLayer.CAPABILITIES_SET',
CLOUD_PRINT_ENABLE: 'print_preview.NativeLayer.CLOUD_PRINT_ENABLE',
DESTINATIONS_RELOAD: 'print_preview.NativeLayer.DESTINATIONS_RELOAD',
@@ -273,6 +276,7 @@ cr.define('print_preview', function() {
'landscape': printTicketStore.landscape.getValue(),
'color': this.getNativeColorModel_(destination, printTicketStore.color),
'headerFooterEnabled': printTicketStore.headerFooter.getValue(),
+ 'printFriendly': printTicketStore.printFriendly.getValue(),
'marginsType': printTicketStore.marginsType.getValue(),
'isFirstRequest': requestId == 0,
'requestID': requestId,
@@ -736,6 +740,19 @@ cr.define('print_preview', function() {
},
/**
+ * Updates the interface to show the "Print friendly" option
+ * when PrintPreviewHandler::HandleIsPageDistillableResult
+ * determines that this page can be simplified with the
+ * DOM Distiller.
+ * @private
+ */
+ onDetectedSimplifiablePage_: function() {
+ var allowPrintFriendlyEvent = new Event(
+ NativeLayer.EventType.ALLOW_PRINT_FRIENDLY);
+ this.dispatchEvent(allowPrintFriendlyEvent);
+ },
+
+ /**
* Simulates a user click on the print preview dialog cancel button. Used
* only for testing.
* @private

Powered by Google App Engine
This is Rietveld 408576698