summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsanjeevr@chromium.org <sanjeevr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-12 05:29:07 +0000
committersanjeevr@chromium.org <sanjeevr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-12 05:29:07 +0000
commit38bba4f8e2f93dd789c3483a3f0c153ca5809793 (patch)
tree18ec7bd6d8cf84dd7492b1f986f210621a79db00
parent31548a10135c11ff689074896237d2b7a404959c (diff)
downloadchromium_src-38bba4f8e2f93dd789c3483a3f0c153ca5809793.zip
chromium_src-38bba4f8e2f93dd789c3483a3f0c153ca5809793.tar.gz
chromium_src-38bba4f8e2f93dd789c3483a3f0c153ca5809793.tar.bz2
Changes made to the printing logic to allow plugins to participate in the browser's print workflow. These changes mainly involve allowing the plugin to specify
whether it wants the browser to use overlays and also changes to the EMF code on Windows to decompress JPEGs/PNGs in the metafile. The related webkit change is https://bugs.webkit.org/show_bug.cgi?id=35550 BUG=None TEST=Test printing with new Pepper plugins that support custom printing. Review URL: http://codereview.chromium.org/745001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@41400 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/printing/print_job_worker.cc4
-rw-r--r--chrome/browser/printing/print_job_worker.h3
-rw-r--r--chrome/browser/printing/printer_query.cc4
-rw-r--r--chrome/browser/printing/printer_query.h1
-rw-r--r--chrome/browser/renderer_host/resource_message_filter.cc2
-rw-r--r--chrome/common/render_messages.h7
-rw-r--r--chrome/renderer/print_web_view_helper.cc7
-rw-r--r--chrome/renderer/print_web_view_helper.h5
-rw-r--r--chrome/renderer/print_web_view_helper_win.cc9
-rw-r--r--printing/emf_win.cc85
-rw-r--r--printing/print_settings.cc14
-rw-r--r--printing/print_settings.h5
-rw-r--r--printing/printed_document.cc3
-rw-r--r--printing/printing_context.h4
-rw-r--r--webkit/glue/webplugin_impl.cc39
-rw-r--r--webkit/glue/webplugin_impl.h28
16 files changed, 204 insertions, 16 deletions
diff --git a/chrome/browser/printing/print_job_worker.cc b/chrome/browser/printing/print_job_worker.cc
index 3a91f0c..34d14dc 100644
--- a/chrome/browser/printing/print_job_worker.cc
+++ b/chrome/browser/printing/print_job_worker.cc
@@ -67,13 +67,15 @@ void PrintJobWorker::SetNewOwner(PrintJobWorkerOwner* new_owner) {
void PrintJobWorker::GetSettings(bool ask_user_for_settings,
gfx::NativeWindow parent_window,
int document_page_count,
- bool has_selection) {
+ bool has_selection,
+ bool use_overlays) {
DCHECK_EQ(message_loop(), MessageLoop::current());
DCHECK_EQ(page_number_, PageNumber::npos());
// Recursive task processing is needed for the dialog in case it needs to be
// destroyed by a task.
MessageLoop::current()->SetNestableTasksAllowed(true);
+ printing_context_.SetUseOverlays(use_overlays);
if (ask_user_for_settings) {
#if defined(OS_MACOSX)
diff --git a/chrome/browser/printing/print_job_worker.h b/chrome/browser/printing/print_job_worker.h
index 15f16da..8eb15dd 100644
--- a/chrome/browser/printing/print_job_worker.h
+++ b/chrome/browser/printing/print_job_worker.h
@@ -36,7 +36,8 @@ class PrintJobWorker : public base::Thread {
void GetSettings(bool ask_user_for_settings,
gfx::NativeWindow parent_window,
int document_page_count,
- bool has_selection);
+ bool has_selection,
+ bool use_overlays);
// Starts the printing loop. Every pages are printed as soon as the data is
// available. Makes sure the new_document is the right one.
diff --git a/chrome/browser/printing/printer_query.cc b/chrome/browser/printing/printer_query.cc
index 4fdadbe..86c0f67 100644
--- a/chrome/browser/printing/printer_query.cc
+++ b/chrome/browser/printing/printer_query.cc
@@ -65,6 +65,7 @@ void PrinterQuery::GetSettings(GetSettingsAskParam ask_user_for_settings,
gfx::NativeWindow parent_window,
int expected_page_count,
bool has_selection,
+ bool use_overlays,
CancelableTask* callback) {
DCHECK_EQ(ui_message_loop_, MessageLoop::current());
DCHECK(!is_print_dialog_box_shown_);
@@ -93,7 +94,8 @@ void PrinterQuery::GetSettings(GetSettingsAskParam ask_user_for_settings,
is_print_dialog_box_shown_,
parent_window,
expected_page_count,
- has_selection));
+ has_selection,
+ use_overlays));
}
void PrinterQuery::StopWorker() {
diff --git a/chrome/browser/printing/printer_query.h b/chrome/browser/printing/printer_query.h
index b9c2734..847611c 100644
--- a/chrome/browser/printing/printer_query.h
+++ b/chrome/browser/printing/printer_query.h
@@ -50,6 +50,7 @@ class PrinterQuery : public PrintJobWorkerOwner {
gfx::NativeWindow parent_window,
int expected_page_count,
bool has_selection,
+ bool use_overlays,
CancelableTask* callback);
// Stops the worker thread since the client is done with this object.
diff --git a/chrome/browser/renderer_host/resource_message_filter.cc b/chrome/browser/renderer_host/resource_message_filter.cc
index 65b6469..f25be7c 100644
--- a/chrome/browser/renderer_host/resource_message_filter.cc
+++ b/chrome/browser/renderer_host/resource_message_filter.cc
@@ -1070,6 +1070,7 @@ void ResourceMessageFilter::OnGetDefaultPrintSettings(IPC::Message* reply_msg) {
NULL,
0,
false,
+ true,
task);
}
@@ -1133,6 +1134,7 @@ void ResourceMessageFilter::OnScriptedPrint(
host_window,
params.expected_pages_count,
params.has_selection,
+ params.use_overlays,
task);
}
diff --git a/chrome/common/render_messages.h b/chrome/common/render_messages.h
index 0fb09e4..d032520 100644
--- a/chrome/common/render_messages.h
+++ b/chrome/common/render_messages.h
@@ -492,6 +492,7 @@ struct ViewHostMsg_ScriptedPrint_Params {
int cookie;
int expected_pages_count;
bool has_selection;
+ bool use_overlays;
};
// Signals a storage event.
@@ -2268,6 +2269,7 @@ struct ParamTraits<ViewHostMsg_ScriptedPrint_Params> {
WriteParam(m, p.cookie);
WriteParam(m, p.expected_pages_count);
WriteParam(m, p.has_selection);
+ WriteParam(m, p.use_overlays);
}
static bool Read(const Message* m, void** iter, param_type* p) {
return
@@ -2275,7 +2277,8 @@ struct ParamTraits<ViewHostMsg_ScriptedPrint_Params> {
ReadParam(m, iter, &p->host_window_id) &&
ReadParam(m, iter, &p->cookie) &&
ReadParam(m, iter, &p->expected_pages_count) &&
- ReadParam(m, iter, &p->has_selection);
+ ReadParam(m, iter, &p->has_selection) &&
+ ReadParam(m, iter, &p->use_overlays);
}
static void Log(const param_type& p, std::wstring* l) {
l->append(L"(");
@@ -2288,6 +2291,8 @@ struct ParamTraits<ViewHostMsg_ScriptedPrint_Params> {
LogParam(p.expected_pages_count, l);
l->append(L", ");
LogParam(p.has_selection, l);
+ l->append(L",");
+ LogParam(p.use_overlays, l);
l->append(L")");
}
};
diff --git a/chrome/renderer/print_web_view_helper.cc b/chrome/renderer/print_web_view_helper.cc
index 32e4064..52aede1 100644
--- a/chrome/renderer/print_web_view_helper.cc
+++ b/chrome/renderer/print_web_view_helper.cc
@@ -29,7 +29,8 @@ PrepareFrameAndViewForPrint::PrepareFrameAndViewForPrint(
const ViewMsg_Print_Params& print_params,
WebFrame* frame,
WebView* web_view)
- : frame_(frame), web_view_(web_view), expected_pages_count_(0) {
+ : frame_(frame), web_view_(web_view), expected_pages_count_(0),
+ use_browser_overlays_(true) {
print_canvas_size_.set_width(
printing::ConvertUnit(print_params.printable_size.width(),
static_cast<int>(print_params.dpi),
@@ -53,7 +54,9 @@ PrepareFrameAndViewForPrint::PrepareFrameAndViewForPrint(
web_view->resize(print_layout_size);
- expected_pages_count_ = frame->printBegin(print_canvas_size_);
+ expected_pages_count_ = frame->printBegin(
+ print_canvas_size_, static_cast<int>(print_params.dpi),
+ &use_browser_overlays_);
}
PrepareFrameAndViewForPrint::~PrepareFrameAndViewForPrint() {
diff --git a/chrome/renderer/print_web_view_helper.h b/chrome/renderer/print_web_view_helper.h
index 1a4f5aa..45d174b 100644
--- a/chrome/renderer/print_web_view_helper.h
+++ b/chrome/renderer/print_web_view_helper.h
@@ -47,6 +47,10 @@ class PrepareFrameAndViewForPrint {
return expected_pages_count_;
}
+ bool ShouldUseBrowserOverlays() const {
+ return use_browser_overlays_;
+ }
+
const gfx::Size& GetPrintCanvasSize() const {
return print_canvas_size_;
}
@@ -57,6 +61,7 @@ class PrepareFrameAndViewForPrint {
gfx::Size print_canvas_size_;
gfx::Size prev_view_size_;
int expected_pages_count_;
+ bool use_browser_overlays_;
DISALLOW_COPY_AND_ASSIGN(PrepareFrameAndViewForPrint);
};
diff --git a/chrome/renderer/print_web_view_helper_win.cc b/chrome/renderer/print_web_view_helper_win.cc
index b75aa10..09fcb20 100644
--- a/chrome/renderer/print_web_view_helper_win.cc
+++ b/chrome/renderer/print_web_view_helper_win.cc
@@ -71,6 +71,7 @@ void PrintWebViewHelper::Print(WebFrame* frame, bool script_initiated) {
// Continue only if the settings are valid.
if (default_settings.dpi && default_settings.document_cookie) {
int expected_pages_count = 0;
+ bool use_browser_overlays = true;
// Prepare once to calculate the estimated page count. This must be in
// a scope for itself (see comments on PrepareFrameAndViewForPrint).
@@ -80,6 +81,7 @@ void PrintWebViewHelper::Print(WebFrame* frame, bool script_initiated) {
frame->view());
expected_pages_count = prep_frame_view.GetExpectedPageCount();
DCHECK(expected_pages_count);
+ use_browser_overlays = prep_frame_view.ShouldUseBrowserOverlays();
}
// Ask the browser to show UI to retrieve the final print settings.
@@ -98,9 +100,10 @@ void PrintWebViewHelper::Print(WebFrame* frame, bool script_initiated) {
params.cookie = default_settings.document_cookie;
// TODO(maruel): Reenable once http://crbug.com/22937 is fixed.
// Print selection is broken because DidStopLoading is never called.
- //params.has_selection = frame->hasSelection();
+ // params.has_selection = frame->hasSelection();
params.has_selection = false;
params.expected_pages_count = expected_pages_count;
+ params.use_overlays = use_browser_overlays;
msg = new ViewHostMsg_ScriptedPrint(routing_id(), params,
&print_settings);
@@ -178,8 +181,8 @@ void PrintWebViewHelper::PrintPages(const ViewMsg_PrintPages_Params& params,
}
void PrintWebViewHelper::PrintPage(const ViewMsg_PrintPage_Params& params,
- const gfx::Size& canvas_size,
- WebFrame* frame) {
+ const gfx::Size& canvas_size,
+ WebFrame* frame) {
// Generate a memory-based metafile. It will use the current screen's DPI.
printing::NativeMetafile metafile;
diff --git a/printing/emf_win.cc b/printing/emf_win.cc
index f69d4fa..62cc4a0 100644
--- a/printing/emf_win.cc
+++ b/printing/emf_win.cc
@@ -4,11 +4,29 @@
#include "printing/emf_win.h"
+#include "app/gfx/codec/jpeg_codec.h"
+#include "app/gfx/codec/png_codec.h"
+#include "app/gfx/gdi_util.h"
#include "base/gfx/rect.h"
+#include "base/histogram.h"
#include "base/logging.h"
+#include "base/scoped_ptr.h"
+#include "base/time.h"
+#include "third_party/skia/include/core/SkBitmap.h"
namespace printing {
+bool DIBFormatNativelySupported(HDC dc, uint32 escape, const BYTE* bits,
+ int size) {
+ BOOL supported = FALSE;
+ if (ExtEscape(dc, QUERYESCSUPPORT, sizeof(escape),
+ reinterpret_cast<LPCSTR>(&escape), 0, 0) > 0) {
+ ExtEscape(dc, escape, size, reinterpret_cast<LPCSTR>(bits),
+ sizeof(supported), reinterpret_cast<LPSTR>(&supported));
+ }
+ return !!supported;
+}
+
Emf::Emf() : emf_(NULL), hdc_(NULL) {
}
@@ -65,7 +83,6 @@ bool Emf::SafePlayback(HDC context) const {
NOTREACHED();
return false;
}
-
return EnumEnhMetaFile(context,
emf_,
&Emf::SafePlaybackProc,
@@ -209,9 +226,75 @@ bool Emf::Record::SafePlayback(const XFORM* base_matrix) const {
// I also use this opportunity to skip over eventual EMR_SETLAYOUT record that
// could remain.
//
+ // Another tweak we make is for JPEGs/PNGs in calls to StretchDIBits.
+ // (Our Pepper plugin code uses a JPEG). If the printer does not support
+ // JPEGs/PNGs natively we decompress the JPEG/PNG and then set it to the
+ // device.
+ // TODO(sanjeevr): We should also add JPEG/PNG support for SetSIBitsToDevice
+ //
// Note: I should probably care about view ports and clipping, eventually.
bool res;
switch (record()->iType) {
+ case EMR_STRETCHDIBITS: {
+ const EMRSTRETCHDIBITS * sdib_record =
+ reinterpret_cast<const EMRSTRETCHDIBITS*>(record());
+ const BYTE* record_start = reinterpret_cast<const BYTE *>(record());
+ const BITMAPINFOHEADER *bmih =
+ reinterpret_cast<const BITMAPINFOHEADER *>(record_start +
+ sdib_record->offBmiSrc);
+ const BYTE* bits = record_start + sdib_record->offBitsSrc;
+ bool play_normally = true;
+ res = false;
+ HDC hdc = context_->hdc;
+ scoped_ptr<SkBitmap> bitmap;
+ if (bmih->biCompression == BI_JPEG) {
+ if (!DIBFormatNativelySupported(hdc, CHECKJPEGFORMAT, bits,
+ bmih->biSizeImage)) {
+ play_normally = false;
+ base::TimeTicks start_time = base::TimeTicks::Now();
+ bitmap.reset(gfx::JPEGCodec::Decode(bits, bmih->biSizeImage));
+ UMA_HISTOGRAM_TIMES("Printing.JPEGDecompressTime",
+ base::TimeTicks::Now() - start_time);
+ }
+ } else if (bmih->biCompression == BI_PNG) {
+ if (!DIBFormatNativelySupported(hdc, CHECKPNGFORMAT, bits,
+ bmih->biSizeImage)) {
+ play_normally = false;
+ bitmap.reset(new SkBitmap());
+ base::TimeTicks start_time = base::TimeTicks::Now();
+ gfx::PNGCodec::Decode(bits, bmih->biSizeImage, bitmap.get());
+ UMA_HISTOGRAM_TIMES("Printing.PNGDecompressTime",
+ base::TimeTicks::Now() - start_time);
+ }
+ }
+ if (!play_normally) {
+ DCHECK(bitmap.get());
+ if (bitmap.get()) {
+ SkAutoLockPixels lock(*bitmap.get());
+ DCHECK_EQ(bitmap->getConfig(), SkBitmap::kARGB_8888_Config);
+ const uint32_t* pixels =
+ static_cast<const uint32_t*>(bitmap->getPixels());
+ if (pixels == NULL) {
+ NOTREACHED();
+ return false;
+ }
+ BITMAPINFOHEADER bmi = {0};
+ gfx::CreateBitmapHeader(bitmap->width(), bitmap->height(), &bmi);
+ res = (0 != StretchDIBits(hdc, sdib_record->xDest, sdib_record->yDest,
+ sdib_record->cxDest,
+ sdib_record->cyDest, sdib_record->xSrc,
+ sdib_record->ySrc,
+ sdib_record->cxSrc, sdib_record->cySrc,
+ pixels,
+ reinterpret_cast<const BITMAPINFO *>(&bmi),
+ sdib_record->iUsageSrc,
+ sdib_record->dwRop));
+ }
+ } else {
+ res = Play();
+ }
+ break;
+ }
case EMR_SETWORLDTRANSFORM: {
DCHECK_EQ(record()->nSize, sizeof(DWORD) * 2 + sizeof(XFORM));
const XFORM* xform = reinterpret_cast<const XFORM*>(record()->dParm);
diff --git a/printing/print_settings.cc b/printing/print_settings.cc
index 4764952..77c4049 100644
--- a/printing/print_settings.cc
+++ b/printing/print_settings.cc
@@ -19,6 +19,7 @@ PrintSettings::PrintSettings()
max_shrink(2.0),
desired_dpi(72),
selection_only(false),
+ use_overlays(true),
dpi_(0),
landscape_(false) {
}
@@ -120,16 +121,19 @@ void PrintSettings::SetPrinterPrintableArea(
gfx::Size const& physical_size_pixels,
gfx::Rect const& printable_area_pixels) {
- // Hard-code text_height = 0.5cm = ~1/5 of inch.
- int header_footer_text_height = ConvertUnit(500, kHundrethsMMPerInch, dpi_);
-
+ int header_footer_text_height = 0;
+ int margin_printer_units = 0;
+ if (use_overlays) {
+ // Hard-code text_height = 0.5cm = ~1/5 of inch.
+ header_footer_text_height = ConvertUnit(500, kHundrethsMMPerInch, dpi_);
+ // Default margins 1.0cm = ~2/5 of an inch.
+ margin_printer_units = ConvertUnit(1000, kHundrethsMMPerInch, dpi_);
+ }
// Start by setting the user configuration
page_setup_pixels_.Init(physical_size_pixels,
printable_area_pixels,
header_footer_text_height);
- // Default margins 1.0cm = ~2/5 of an inch.
- int margin_printer_units = ConvertUnit(1000, kHundrethsMMPerInch, dpi_);
// Apply default margins (not user configurable just yet).
// Since the font height is half the margin we put the header and footers at
diff --git a/printing/print_settings.h b/printing/print_settings.h
index dd90007f..b5bb723 100644
--- a/printing/print_settings.h
+++ b/printing/print_settings.h
@@ -85,6 +85,11 @@ class PrintSettings {
// Indicates if the user only wants to print the current selection.
bool selection_only;
+ // Indicates whether we should use browser-controlled page overlays
+ // (header, footer, margins etc). If it is false, the overlays are
+ // controlled by the renderer.
+ bool use_overlays;
+
// Cookie generator. It is used to initialize PrintedDocument with its
// associated PrintSettings, to be sure that each generated PrintedPage is
// correctly associated with its corresponding PrintedDocument.
diff --git a/printing/printed_document.cc b/printing/printed_document.cc
index 5f5f53c..7857859 100644
--- a/printing/printed_document.cc
+++ b/printing/printed_document.cc
@@ -180,6 +180,9 @@ void PrintedDocument::PrintHeaderFooter(gfx::NativeDrawingContext context,
PageOverlays::VerticalPosition y,
const gfx::Font& font) const {
const PrintSettings& settings = immutable_.settings_;
+ if (!settings.use_overlays) {
+ return;
+ }
const std::wstring& line = settings.overlays.GetOverlay(x, y);
if (line.empty()) {
return;
diff --git a/printing/printing_context.h b/printing/printing_context.h
index 29c9478..a931c8b 100644
--- a/printing/printing_context.h
+++ b/printing/printing_context.h
@@ -54,6 +54,10 @@ class PrintingContext {
// default device settings.
Result UseDefaultSettings();
+ void SetUseOverlays(bool use_overlays) {
+ settings_.use_overlays = use_overlays;
+ }
+
// Initializes with predefined settings.
Result InitWithSettings(const PrintSettings& settings);
diff --git a/webkit/glue/webplugin_impl.cc b/webkit/glue/webplugin_impl.cc
index c5877e3..ec7bf71 100644
--- a/webkit/glue/webplugin_impl.cc
+++ b/webkit/glue/webplugin_impl.cc
@@ -24,7 +24,6 @@
#include "third_party/WebKit/WebKit/chromium/public/WebKitClient.h"
#include "third_party/WebKit/WebKit/chromium/public/WebPluginContainer.h"
#include "third_party/WebKit/WebKit/chromium/public/WebPluginParams.h"
-#include "third_party/WebKit/WebKit/chromium/public/WebRect.h"
#include "third_party/WebKit/WebKit/chromium/public/WebURL.h"
#include "third_party/WebKit/WebKit/chromium/public/WebURLError.h"
#include "third_party/WebKit/WebKit/chromium/public/WebURLLoader.h"
@@ -377,6 +376,44 @@ void WebPluginImpl::didFailLoadingFrameRequest(
url, reason, reinterpret_cast<intptr_t>(notify_data));
}
+bool WebPluginImpl::supportsPaginatedPrint() {
+ if (!delegate_)
+ return false;
+ return delegate_->PrintSupportsPrintExtension();
+}
+
+int WebPluginImpl::printBegin(const WebRect& printable_area, int printer_dpi) {
+ if (!delegate_)
+ return 0;
+
+ if (!supportsPaginatedPrint())
+ return 0;
+
+ print_settings_.is_printing = true;
+ print_settings_.printable_area = printable_area;
+ print_settings_.printer_dpi = printer_dpi;
+ return delegate_->PrintBegin(printable_area, printer_dpi);
+}
+
+bool WebPluginImpl::printPage(int page_number, WebCanvas* canvas) {
+ if (!delegate_)
+ return false;
+ if (!print_settings_.is_printing) {
+ NOTREACHED();
+ return false;
+ }
+ return delegate_->PrintPage(page_number, print_settings_.printable_area,
+ print_settings_.printer_dpi, canvas);
+}
+
+void WebPluginImpl::printEnd() {
+ DCHECK(print_settings_.is_printing);
+ print_settings_.Clear();
+ if (delegate_)
+ delegate_->PrintEnd();
+}
+
+
// -----------------------------------------------------------------------------
WebPluginImpl::WebPluginImpl(
diff --git a/webkit/glue/webplugin_impl.h b/webkit/glue/webplugin_impl.h
index 86e9df4..ced39f5 100644
--- a/webkit/glue/webplugin_impl.h
+++ b/webkit/glue/webplugin_impl.h
@@ -16,6 +16,7 @@
#include "base/weak_ptr.h"
#include "googleurl/src/gurl.h"
#include "third_party/WebKit/WebKit/chromium/public/WebPlugin.h"
+#include "third_party/WebKit/WebKit/chromium/public/WebRect.h"
#include "third_party/WebKit/WebKit/chromium/public/WebString.h"
#include "third_party/WebKit/WebKit/chromium/public/WebURLLoaderClient.h"
#include "third_party/WebKit/WebKit/chromium/public/WebURLRequest.h"
@@ -84,6 +85,11 @@ class WebPluginImpl : public WebPlugin,
virtual void didFailLoadingFrameRequest(
const WebKit::WebURL& url, void* notify_data,
const WebKit::WebURLError& error);
+ virtual bool supportsPaginatedPrint();
+ virtual int printBegin(const WebKit::WebRect& printable_area,
+ int printer_dpi);
+ virtual bool printPage(int page_number, WebKit::WebCanvas* canvas);
+ virtual void printEnd();
// WebPlugin implementation:
void SetWindow(gfx::PluginWindowHandle window);
@@ -305,6 +311,28 @@ class WebPluginImpl : public WebPlugin,
std::vector<std::string> arg_names_;
std::vector<std::string> arg_values_;
+ struct PrintSettings {
+ // This is set to true when printBegin is called and false when printEnd is
+ // called.
+ bool is_printing;
+ // The remembered printable_area from the last printBegin call. It is
+ // cleared in printEnd.
+ WebKit::WebRect printable_area;
+ // The remembered printer_dpi from the last printBegin call. It is cleared
+ // in printEnd.
+ int printer_dpi;
+ PrintSettings() {
+ Clear();
+ }
+ void Clear() {
+ is_printing = false;
+ printable_area = WebKit::WebRect(0, 0, 0, 0);
+ printer_dpi = 0;
+ }
+ };
+
+ PrintSettings print_settings_;
+
ScopedRunnableMethodFactory<WebPluginImpl> method_factory_;
DISALLOW_COPY_AND_ASSIGN(WebPluginImpl);