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

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

Issue 335583004: Added a test that currently is able to print to pdf. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Renamed some variables Created 6 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/print_preview.js
diff --git a/chrome/browser/resources/print_preview/print_preview.js b/chrome/browser/resources/print_preview/print_preview.js
index ac3a0ab789135db2746d6fe3b522398b759867d9..70bfeaf241abaf8b9b82091cd018b1219169586a 100644
--- a/chrome/browser/resources/print_preview/print_preview.js
+++ b/chrome/browser/resources/print_preview/print_preview.js
@@ -285,7 +285,10 @@ cr.define('print_preview', function() {
this.nativeLayer_,
print_preview.NativeLayer.EventType.PRIVET_PRINT_FAILED,
this.onPrivetPrintFailed_.bind(this));
-
+ this.tracker.add(
+ this.nativeLayer_,
+ print_preview.NativeLayer.EventType.MANIPULATE_SETTINGS,
+ this.onManipulateSettings_.bind(this));
this.tracker.add(
$('system-dialog-link'),
@@ -691,6 +694,7 @@ cr.define('print_preview', function() {
onPreviewGenerationDone_: function() {
this.isPreviewGenerationInProgress_ = false;
this.printHeader_.isPrintButtonEnabled = true;
+ chrome.send('UILoaded');
this.printIfReady_();
},
@@ -889,6 +893,16 @@ cr.define('print_preview', function() {
localStrings.getString('couldNotPrint'));
},
+ onManipulateSettings_: function() {
+ var settings = $('layout-settings');
+ this.destinationStore_.selectDefaultDestination_();
+ var portrait = document.getElementsByClassName(
+ 'layout-settings-landscape-radio')[0];
+ if (portrait) {
+ portrait.click();
+ }
+ },
+
/**
* Called when the open-cloud-print-dialog link is clicked. Opens the Google
* Cloud Print web dialog.

Powered by Google App Engine
This is Rietveld 408576698