summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorthestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-06-10 05:54:31 +0000
committerthestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-06-10 05:54:31 +0000
commitbf8e366ca8ae435e6666cf8b792d7c7adfaffeaf (patch)
treeb9563bf2b2f6440f51c6cd82c6bc4377947c151c
parent915ca8354fc280d5426c2ebbfb49ca1790bb0fd8 (diff)
downloadchromium_src-bf8e366ca8ae435e6666cf8b792d7c7adfaffeaf.zip
chromium_src-bf8e366ca8ae435e6666cf8b792d7c7adfaffeaf.tar.gz
chromium_src-bf8e366ca8ae435e6666cf8b792d7c7adfaffeaf.tar.bz2
Print Preview: Set color correctly if there is no printers; Make some optional PDF plugin feature checks required.
BUG=none TEST=On a computer with no printers, Print to PDF defaults to color. Review URL: http://codereview.chromium.org/7003107 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@88641 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/resources/print_preview.js26
1 files changed, 10 insertions, 16 deletions
diff --git a/chrome/browser/resources/print_preview.js b/chrome/browser/resources/print_preview.js
index 1c7e18e..5d363ca 100644
--- a/chrome/browser/resources/print_preview.js
+++ b/chrome/browser/resources/print_preview.js
@@ -204,7 +204,6 @@ function updateWithPrinterCapabilities(settingInfo) {
if (colorOption.checked != setColorAsDefault) {
colorOption.checked = setColorAsDefault;
bwOption.checked = !setColorAsDefault;
- setColor(colorOption.checked);
}
}
@@ -485,6 +484,8 @@ function onPDFLoad() {
else
$('pdf-viewer').fitToHeight();
+ setColor($('color').checked);
+
hideLoadingAnimation();
if (!previewModifiable)
@@ -554,13 +555,10 @@ function createPDFPlugin(previewUid) {
var pdfViewer = $('pdf-viewer');
if (pdfViewer) {
- // Older version of the PDF plugin may not have this method.
- // TODO(thestig) Eventually remove this check.
- if (pdfViewer.goToPage) {
- // Need to call this before the reload(), where the plugin resets its
- // internal page count.
- pdfViewer.goToPage('0');
- }
+ // Need to call this before the reload(), where the plugin resets its
+ // internal page count.
+ pdfViewer.goToPage('0');
+
pdfViewer.reload();
pdfViewer.grayscale(!isColor());
return;
@@ -573,13 +571,7 @@ function createPDFPlugin(previewUid) {
var mainView = $('mainview');
mainView.appendChild(pdfPlugin);
pdfPlugin.onload('onPDFLoad()');
-
- // Older version of the PDF plugin may not have this method.
- // TODO(thestig) Eventually remove this check.
- if (pdfPlugin.removePrintButton) {
- pdfPlugin.removePrintButton();
- }
-
+ pdfPlugin.removePrintButton();
pdfPlugin.grayscale(true);
}
@@ -588,7 +580,9 @@ function createPDFPlugin(previewUid) {
*/
function checkCompatiblePluginExists() {
var dummyPlugin = $('dummy-viewer')
- return !!dummyPlugin.onload;
+ return (dummyPlugin.onload &&
+ dummyPlugin.goToPage &&
+ dummyPlugin.removePrintButton);
}
/**