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

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: Fixup "Add "Print friendly" option to print preview dialog" Created 5 years, 5 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..94123fae6e3430f9da020f84b680aaea0731e55e 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.detectDistillablePage =
+ this.detectDistillablePage_.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_DISTILL_PAGE: 'print_preview.NativeLayer.ALLOW_DISTILL_PAGE',
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(),
+ 'distillPage': printTicketStore.distillPage.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 "Distill Page" option
+ * when PrintPreviewHandler::HandleIsPageDistillableResult
+ * determines that this page can be distilled with the
+ * DOM Distiller.
+ * @private
+ */
+ detectDistillablePage_: function() {
+ var allowDistillPageEvent = new Event(
+ NativeLayer.EventType.ALLOW_DISTILL_PAGE);
+ this.dispatchEvent(allowDistillPageEvent);
+ },
+
+ /**
* 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