summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorthestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-06-29 03:04:47 +0000
committerthestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-06-29 03:04:47 +0000
commit7bd80241b862451b05566797f4ef6debf98f5c45 (patch)
tree193c1ec3e329486299774d5195ee71037fdb22c0
parent8243d0bef6f5c60fef06f222d059393ad96b3ce6 (diff)
downloadchromium_src-7bd80241b862451b05566797f4ef6debf98f5c45.zip
chromium_src-7bd80241b862451b05566797f4ef6debf98f5c45.tar.gz
chromium_src-7bd80241b862451b05566797f4ef6debf98f5c45.tar.bz2
Print Preview: Remove unused draft mode code.
BUG=none TEST=none Review URL: http://codereview.chromium.org/7275030 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@90919 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/resources/print_preview/print_preview.js17
-rw-r--r--chrome/renderer/print_web_view_helper.cc14
-rw-r--r--chrome/renderer/print_web_view_helper.h9
-rw-r--r--chrome/renderer/print_web_view_helper_linux.cc3
-rw-r--r--chrome/renderer/print_web_view_helper_mac.mm3
-rw-r--r--chrome/renderer/print_web_view_helper_win.cc3
-rw-r--r--printing/emf_win.h2
-rw-r--r--printing/metafile.h5
-rw-r--r--printing/pdf_metafile_cairo_linux.h2
-rw-r--r--printing/pdf_metafile_cg_mac.h2
-rw-r--r--printing/pdf_metafile_skia.cc3
-rw-r--r--printing/pdf_metafile_skia.h2
-rw-r--r--printing/print_job_constants.cc3
-rw-r--r--printing/print_job_constants.h1
14 files changed, 11 insertions, 58 deletions
diff --git a/chrome/browser/resources/print_preview/print_preview.js b/chrome/browser/resources/print_preview/print_preview.js
index 48d0aae..729692e 100644
--- a/chrome/browser/resources/print_preview/print_preview.js
+++ b/chrome/browser/resources/print_preview/print_preview.js
@@ -45,9 +45,6 @@ var hasError = false;
// True when preview tab is hidden.
var isTabHidden = false;
-// True when draft preview data is requested for preview.
-var draftDocument = true;
-
/**
* Window onload handler, sets up the page and starts print preview by getting
* the printer list.
@@ -356,8 +353,7 @@ function getSettingsJSON() {
'collate': isCollated(),
'landscape': isLandscape(),
'color': isColor(),
- 'printToPDF': printToPDF,
- 'draftDocument': draftDocument});
+ 'printToPDF': printToPDF});
}
/**
@@ -394,12 +390,6 @@ function printFile() {
return;
}
- if (draftDocument) {
- hasPendingPrintFileRequest = true;
- requestPrintPreview();
- return;
- }
-
if (isTabHidden || deviceName == PRINT_TO_PDF) {
sendPrintFileRequest();
} else {
@@ -432,9 +422,7 @@ function requestPrintPreview() {
hasPendingPreviewRequest = true;
removeEventListeners();
printSettings.save();
- if (isTabHidden || hasPendingPrintFileRequest)
- draftDocument = false;
- else
+ if (!isTabHidden)
showLoadingAnimation();
chrome.send('getPreview', [getSettingsJSON()]);
@@ -445,7 +433,6 @@ function requestPrintPreview() {
* preview tab regarding the file selection cancel event.
*/
function fileSelectionCancelled() {
- draftDocument = true;
hasPendingPrintFileRequest = false;
}
diff --git a/chrome/renderer/print_web_view_helper.cc b/chrome/renderer/print_web_view_helper.cc
index 408d480..64ae937 100644
--- a/chrome/renderer/print_web_view_helper.cc
+++ b/chrome/renderer/print_web_view_helper.cc
@@ -18,7 +18,6 @@
#include "content/renderer/render_view.h"
#include "grit/generated_resources.h"
#include "printing/metafile.h"
-#include "printing/print_job_constants.h"
#include "printing/units.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebConsoleMessage.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebDataSource.h"
@@ -369,11 +368,7 @@ void PrintWebViewHelper::PrintPreview(WebKit::WebFrame* frame,
return;
}
- bool draft;
- if (!settings.GetBoolean(printing::kSettingDraftDocument, &draft))
- draft = false;
-
- if (draft && old_print_pages_params_.get() &&
+ if (old_print_pages_params_.get() &&
PrintMsg_Print_Params_IsEqual(*old_print_pages_params_,
*print_pages_params_)) {
PrintHostMsg_DidPreviewDocument_Params preview_params;
@@ -389,7 +384,7 @@ void PrintWebViewHelper::PrintPreview(WebKit::WebFrame* frame,
}
// Render Pages for preview.
- if (!RenderPagesForPreview(frame, node, draft))
+ if (!RenderPagesForPreview(frame, node))
DidFinishPrinting(FAIL_PREVIEW);
}
@@ -691,13 +686,12 @@ bool PrintWebViewHelper::RenderPagesForPrint(WebKit::WebFrame* frame,
}
bool PrintWebViewHelper::RenderPagesForPreview(WebKit::WebFrame* frame,
- WebKit::WebNode* node,
- bool draft) {
+ WebKit::WebNode* node) {
PrintMsg_PrintPages_Params print_settings = *print_pages_params_;
// PDF printer device supports alpha blending.
print_settings.params.supports_alpha_blend = true;
// TODO(kmadhusu): Handle print selection.
- return CreatePreviewDocument(print_settings, frame, node, draft);
+ return CreatePreviewDocument(print_settings, frame, node);
}
base::TimeTicks PrintWebViewHelper::ReportPreviewPageRenderTime(
diff --git a/chrome/renderer/print_web_view_helper.h b/chrome/renderer/print_web_view_helper.h
index 7c453e1..2546b55 100644
--- a/chrome/renderer/print_web_view_helper.h
+++ b/chrome/renderer/print_web_view_helper.h
@@ -176,19 +176,14 @@ class PrintWebViewHelper : public RenderViewObserver ,
bool RenderPagesForPrint(WebKit::WebFrame* frame, WebKit::WebNode* node);
// Render the frame for preview.
- // |draft| is true when the output is only going to the screen and not the
- // printer.
- bool RenderPagesForPreview(WebKit::WebFrame* frame,
- WebKit::WebNode* node,
- bool draft);
+ bool RenderPagesForPreview(WebKit::WebFrame* frame, WebKit::WebNode* node);
// Renders all the pages listed in |params| for preview.
// On success, Send PrintHostMsg_PagesReadyForPreview message with a
// valid metafile data handle.
bool CreatePreviewDocument(const PrintMsg_PrintPages_Params& params,
WebKit::WebFrame* frame,
- WebKit::WebNode* node,
- bool draft);
+ WebKit::WebNode* node);
// Platform specific helper function for rendering page(s) to |metafile|.
#if defined(OS_WIN)
diff --git a/chrome/renderer/print_web_view_helper_linux.cc b/chrome/renderer/print_web_view_helper_linux.cc
index 9e00adc..ebbea61 100644
--- a/chrome/renderer/print_web_view_helper_linux.cc
+++ b/chrome/renderer/print_web_view_helper_linux.cc
@@ -27,10 +27,9 @@ using WebKit::WebNode;
bool PrintWebViewHelper::CreatePreviewDocument(
const PrintMsg_PrintPages_Params& params, WebKit::WebFrame* frame,
- WebKit::WebNode* node, bool draft) {
+ WebKit::WebNode* node) {
preview_page_count_ = 0;
printing::PreviewMetafile metafile;
- metafile.set_draft(draft);
if (!metafile.Init())
return false;
diff --git a/chrome/renderer/print_web_view_helper_mac.mm b/chrome/renderer/print_web_view_helper_mac.mm
index 0860af1..aab653d 100644
--- a/chrome/renderer/print_web_view_helper_mac.mm
+++ b/chrome/renderer/print_web_view_helper_mac.mm
@@ -61,7 +61,7 @@ void PrintWebViewHelper::PrintPageInternal(
bool PrintWebViewHelper::CreatePreviewDocument(
const PrintMsg_PrintPages_Params& params, WebKit::WebFrame* frame,
- WebKit::WebNode* node, bool draft) {
+ WebKit::WebNode* node) {
PrintMsg_Print_Params printParams = params.params;
UpdatePrintableSizeInPrintParameters(frame, node, &printParams);
@@ -73,7 +73,6 @@ bool PrintWebViewHelper::CreatePreviewDocument(
return false;
printing::PreviewMetafile metafile;
- metafile.set_draft(draft);
if (!metafile.Init())
return false;
diff --git a/chrome/renderer/print_web_view_helper_win.cc b/chrome/renderer/print_web_view_helper_win.cc
index 783bd6c..5514780 100644
--- a/chrome/renderer/print_web_view_helper_win.cc
+++ b/chrome/renderer/print_web_view_helper_win.cc
@@ -125,7 +125,7 @@ void PrintWebViewHelper::PrintPageInternal(
bool PrintWebViewHelper::CreatePreviewDocument(
const PrintMsg_PrintPages_Params& params, WebKit::WebFrame* frame,
- WebKit::WebNode* node, bool draft) {
+ WebKit::WebNode* node) {
PrintMsg_Print_Params print_params = params.params;
UpdatePrintableSizeInPrintParameters(frame, node, &print_params);
PrepareFrameAndViewForPrint prep_frame_view(print_params, frame, node,
@@ -135,7 +135,6 @@ bool PrintWebViewHelper::CreatePreviewDocument(
return false;
scoped_ptr<Metafile> metafile(new printing::PreviewMetafile);
- metafile->set_draft(draft);
metafile->Init();
// Calculate the dpi adjustment.
diff --git a/printing/emf_win.h b/printing/emf_win.h
index 7b8dab6..f7e0ed5 100644
--- a/printing/emf_win.h
+++ b/printing/emf_win.h
@@ -84,8 +84,6 @@ class Emf : public Metafile {
return emf_;
}
- virtual void set_draft(bool /* draft */) const {}
-
private:
FRIEND_TEST_ALL_PREFIXES(EmfTest, DC);
FRIEND_TEST_ALL_PREFIXES(EmfPrintingTest, PageBreak);
diff --git a/printing/metafile.h b/printing/metafile.h
index 2ec1d78..84c0556 100644
--- a/printing/metafile.h
+++ b/printing/metafile.h
@@ -143,11 +143,6 @@ class Metafile {
// Returns true if writing succeeded.
virtual bool SaveToFD(const base::FileDescriptor& fd) const = 0;
#endif // if defined(OS_CHROMEOS)
-
- // Sets the flag to create a draft metafile.
- // NOTE: Draft metafile does not include font embedding, compression, etc.
- // This is currently used only in print preview workflow.
- virtual void set_draft(bool draft) const = 0;
};
} // namespace printing
diff --git a/printing/pdf_metafile_cairo_linux.h b/printing/pdf_metafile_cairo_linux.h
index 7919980..6f07ae0 100644
--- a/printing/pdf_metafile_cairo_linux.h
+++ b/printing/pdf_metafile_cairo_linux.h
@@ -60,8 +60,6 @@ class PdfMetafileCairo : public Metafile {
virtual bool SaveToFD(const base::FileDescriptor& fd) const;
#endif // if defined(OS_CHROMEOS)
- virtual void set_draft(bool /* draft */) const {}
-
private:
// Cleans up all resources.
void CleanUpAll();
diff --git a/printing/pdf_metafile_cg_mac.h b/printing/pdf_metafile_cg_mac.h
index 303cfd5..5a7f56d 100644
--- a/printing/pdf_metafile_cg_mac.h
+++ b/printing/pdf_metafile_cg_mac.h
@@ -65,8 +65,6 @@ class PdfMetafileCg : public Metafile, public base::ThreadChecker {
bool center_horizontally,
bool center_vertically) const;
- virtual void set_draft(bool /* draft */) const {}
-
private:
// Returns a CGPDFDocumentRef version of pdf_data_.
CGPDFDocumentRef GetPDFDocument() const;
diff --git a/printing/pdf_metafile_skia.cc b/printing/pdf_metafile_skia.cc
index 0ef33f2..69cae9e 100644
--- a/printing/pdf_metafile_skia.cc
+++ b/printing/pdf_metafile_skia.cc
@@ -236,7 +236,4 @@ PdfMetafileSkia::PdfMetafileSkia()
: data_(new PdfMetafileSkiaData),
draft_(false) {}
-void PdfMetafileSkia::set_draft(bool draft) const {
- draft_ = draft;
-}
} // namespace printing
diff --git a/printing/pdf_metafile_skia.h b/printing/pdf_metafile_skia.h
index 2b8c7c1..c28cd08 100644
--- a/printing/pdf_metafile_skia.h
+++ b/printing/pdf_metafile_skia.h
@@ -68,8 +68,6 @@ class PdfMetafileSkia : public Metafile {
virtual bool SaveToFD(const base::FileDescriptor& fd) const;
#endif // if defined(OS_CHROMEOS)
- virtual void set_draft(bool draft) const;
-
private:
scoped_ptr<PdfMetafileSkiaData> data_;
diff --git a/printing/print_job_constants.cc b/printing/print_job_constants.cc
index 5f72252..d8eb0ce 100644
--- a/printing/print_job_constants.cc
+++ b/printing/print_job_constants.cc
@@ -39,7 +39,4 @@ const char kSettingPrinterName[] = "printerName";
// Print to PDF option: true if selected, false if not.
const char kSettingPrintToPDF[] = "printToPDF";
-// True when draft preview document is required.
-const char kSettingDraftDocument[] = "draftDocument";
-
} // namespace printing
diff --git a/printing/print_job_constants.h b/printing/print_job_constants.h
index 8ee5e7f..0f43b7f 100644
--- a/printing/print_job_constants.h
+++ b/printing/print_job_constants.h
@@ -11,7 +11,6 @@ extern const char kSettingCollate[];
extern const char kSettingColor[];
extern const char kSettingCopies[];
extern const char kSettingDeviceName[];
-extern const char kSettingDraftDocument[];
extern const char kSettingDuplexMode[];
extern const char kSettingLandscape[];
extern const char kSettingPageRange[];