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 efdd55b36073695ca5a34c475a299e408e7ea0a9..954ffae8cca562443288b3f55b2087536e57659b 100644 |
--- a/chrome/browser/resources/print_preview/native_layer.js |
+++ b/chrome/browser/resources/print_preview/native_layer.js |
@@ -46,6 +46,7 @@ cr.define('print_preview', function() { |
global['onPrivetCapabilitiesSet'] = |
this.onPrivetCapabilitiesSet_.bind(this); |
global['onPrivetPrintFailed'] = this.onPrivetPrintFailed_.bind(this); |
+ global['onManipulateSettings'] = this.onManipulateSettings_.bind(this); |
}; |
/** |
@@ -77,7 +78,8 @@ cr.define('print_preview', function() { |
PRIVET_PRINTER_CHANGED: 'print_preview.NativeLayer.PRIVET_PRINTER_CHANGED', |
PRIVET_CAPABILITIES_SET: |
'print_preview.NativeLayer.PRIVET_CAPABILITIES_SET', |
- PRIVET_PRINT_FAILED: 'print_preview.NativeLayer.PRIVET_PRINT_FAILED' |
+ PRIVET_PRINT_FAILED: 'print_preview.NativeLayer.PRIVET_PRINT_FAILED', |
+ MANIPULATE_SETTINGS: 'print_preview.NativeLayer.MANIPULATE_SETTINGS' |
}; |
/** |
@@ -672,6 +674,33 @@ cr.define('print_preview', function() { |
new Event(NativeLayer.EventType.PRIVET_PRINT_FAILED); |
privetPrintFailedEvent.httpError = http_error; |
this.dispatchEvent(privetPrintFailedEvent); |
+ }, |
+ |
+ /** |
+ * Function call from browsertest to start clicking certain buttons |
+ */ |
+ onManipulateSettings_: function(messageName, parameter) { |
ivandavid
2014/06/17 21:38:18
'messageName' is the property of print preview tha
Lei Zhang
2014/06/17 21:57:33
You should update the JS doc, rather than mentioni
ivandavid
2014/06/17 22:59:16
Done. I think I correctly followed the @param sect
|
+ var manipulateSettingsEvent = |
+ new Event(NativeLayer.EventType.MANIPULATE_SETTINGS); |
+ manipulateSettingsEvent.messageName = messageName; |
+ if (messageName == 'SAVE_AS_PDF') { |
+ } |
+ else if (messageName == 'LAYOUT_SETTINGS') { |
+ manipulateSettingsEvent.layoutSettings = parameter; |
+ } |
+ else if (messageName == 'PAGE_NUMBERS') { |
+ manipulateSettingsEvent.pageNumbers = parameter; |
+ } |
+ else if (messageName == 'HEADERS_AND_FOOTERS') { |
+ manipulateSettingsEvent.headersAndFooters = parameter; |
+ } |
+ else if (messageName == 'BACKGROUND_COLORS_AND_IMAGES') { |
+ manipulateSettingsEvent.backgroundColorsAndImages = parameter; |
+ } |
+ else if (messageName == 'MARGINS') { |
+ manipulateSettingsEvent.margins = parameter; |
+ } |
+ this.dispatchEvent(manipulateSettingsEvent); |
} |
}; |