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

Unified Diff: printing/printed_document_win.cc

Issue 6673035: Move Start/EndPage() from NewPage/PageDone() to inside the metafile. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 9 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: printing/printed_document_win.cc
diff --git a/printing/printed_document_win.cc b/printing/printed_document_win.cc
index 938e2b5d9df51cf87f76ca59aeb48e576bbdb9d0..a75fdc97030d578b4d8a88cca69c56cb21800bd2 100644
--- a/printing/printed_document_win.cc
+++ b/printing/printed_document_win.cc
@@ -4,6 +4,8 @@
#include "printing/printed_document.h"
+#include <winspool.h>
+
#include "base/logging.h"
#include "base/string_util.h"
#include "base/utf_string_conversions.h"
@@ -77,7 +79,7 @@ string16 FormatSystemDate(const SYSTEMTIME& date, const string16& format) {
namespace printing {
-void PrintedDocument::RenderPrintedPage(
+bool PrintedDocument::RenderPrintedPage(
const PrintedPage& page, gfx::NativeDrawingContext context) const {
#ifndef NDEBUG
{
@@ -94,6 +96,10 @@ void PrintedDocument::RenderPrintedPage(
gfx::Rect content_area;
page.GetCenteredPageContentRect(page_setup.physical_size(), &content_area);
+ // Inform the driver that the application is about to begin sending data.
+ if (StartPage(context) <= 0)
vandebo (ex-Chrome) 2011/03/15 17:23:06 We wanted to move this to PrintWebViewHelper::Rend
dpapad 2011/03/15 20:32:32 Done.
+ return false;
+
// Save the state to make sure the context this function call does not modify
// the device context.
int saved_state = SaveDC(context);
@@ -153,6 +159,10 @@ void PrintedDocument::RenderPrintedPage(
font);
int res = RestoreDC(context, saved_state);
DCHECK_NE(res, 0);
+
+ if (EndPage(context) <= 0)
+ return false;
+ return true;
}
void PrintedDocument::Immutable::SetDocumentDate() {

Powered by Google App Engine
This is Rietveld 408576698