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 ea9effad41b63c012ac9edf1cb47645a5a5a9afb..077db5b67628587bef6372dd79e0c213b5e23b21 100644 |
--- a/chrome/browser/resources/print_preview/native_layer.js |
+++ b/chrome/browser/resources/print_preview/native_layer.js |
@@ -15,6 +15,7 @@ cr.define('print_preview', function() { |
// Bind global handlers |
global['setInitialSettings'] = this.onSetInitialSettings_.bind(this); |
+ global['setPdfCapabilities'] = this.onSetPdfCapabilities_.bind(this); |
global['setUseCloudPrint'] = this.onSetUseCloudPrint_.bind(this); |
global['setPrinters'] = this.onSetPrinters_.bind(this); |
global['updateWithPrinterCapabilities'] = |
@@ -44,7 +45,7 @@ cr.define('print_preview', function() { |
global['autoCancelForTesting'] = this.autoCancelForTesting_.bind(this); |
global['onPrivetPrinterChanged'] = this.onPrivetPrinterChanged_.bind(this); |
global['onPrivetCapabilitiesSet'] = |
- this.onPrivetCapabilitiesSet_.bind(this); |
+ this.onPrivetCapabilitiesSet_.bind(this); |
global['onPrivetPrintFailed'] = this.onPrivetPrintFailed_.bind(this); |
}; |
@@ -68,6 +69,7 @@ cr.define('print_preview', function() { |
PAGE_COUNT_READY: 'print_preview.NativeLayer.PAGE_COUNT_READY', |
PAGE_LAYOUT_READY: 'print_preview.NativeLayer.PAGE_LAYOUT_READY', |
PAGE_PREVIEW_READY: 'print_preview.NativeLayer.PAGE_PREVIEW_READY', |
+ PDF_CAPABILITIES_READY: 'print_preview.NativeLayer.PDF_CAPABILITIES_READY', |
PREVIEW_GENERATION_DONE: |
'print_preview.NativeLayer.PREVIEW_GENERATION_DONE', |
PREVIEW_GENERATION_FAIL: |
@@ -124,6 +126,11 @@ cr.define('print_preview', function() { |
chrome.send('getInitialSettings'); |
}, |
+ /** Requests PDF printer capabilities, such as media size. */ |
+ startGetPdfCapabilities: function() { |
+ chrome.send('getPdfCapabilities'); |
+ }, |
+ |
/** |
* Requests the system's local print destinations. A LOCAL_DESTINATIONS_SET |
* event will be dispatched in response. |
@@ -405,6 +412,16 @@ cr.define('print_preview', function() { |
}, |
/** |
+ * @param {!Object} capabilities Object containing some of the PDF printer |
+ * capabilities, such as media size. |
+ */ |
+ onSetPdfCapabilities_: function(capabilities) { |
+ var event = new Event(NativeLayer.EventType.PDF_CAPABILITIES_READY); |
+ event.capabilities = capabilities; |
+ this.dispatchEvent(event); |
+ }, |
+ |
+ /** |
* Turn on the integration of Cloud Print. |
* @param {string} cloudPrintURL The URL to use for cloud print servers. |
* @private |