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

Unified Diff: chrome/renderer/print_web_view_helper_win.cc

Issue 6538048: Cleanup PrintWebViewHelper. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: do not change metafile_data_handle Created 9 years, 10 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
« no previous file with comments | « chrome/renderer/print_web_view_helper_mac.mm ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/print_web_view_helper_win.cc
===================================================================
--- chrome/renderer/print_web_view_helper_win.cc (revision 75320)
+++ chrome/renderer/print_web_view_helper_win.cc (working copy)
@@ -8,21 +8,18 @@
#include "base/process_util.h"
#include "chrome/common/render_messages.h"
#include "chrome/common/render_messages_params.h"
-#include "chrome/renderer/render_view.h"
-#include "grit/generated_resources.h"
-#include "printing/native_metafile.h"
#include "printing/units.h"
#include "skia/ext/vector_canvas.h"
#include "skia/ext/vector_platform_device.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h"
#include "ui/gfx/gdi_util.h"
-#include "ui/gfx/size.h"
using printing::ConvertUnitDouble;
using printing::kPointsPerInch;
using WebKit::WebFrame;
-using WebKit::WebString;
+namespace {
+
int CALLBACK EnhMetaFileProc(HDC dc,
HANDLETABLE* handle_table,
const ENHMETARECORD *record,
@@ -63,6 +60,8 @@
return 1; // Continue enumeration
}
+} // namespace
+
void PrintWebViewHelper::PrintPage(const ViewMsg_PrintPage_Params& params,
const gfx::Size& canvas_size,
WebFrame* frame) {
@@ -261,18 +260,16 @@
// Page used alpha blend, but printer doesn't support it. Rewrite the
// metafile and flatten out the transparency.
HDC bitmap_dc = CreateCompatibleDC(GetDC(NULL));
- if (!bitmap_dc) {
+ if (!bitmap_dc)
NOTREACHED() << "Bitmap DC creation failed";
- }
SetGraphicsMode(bitmap_dc, GM_ADVANCED);
void* bits = NULL;
BITMAPINFO hdr;
gfx::CreateBitmapHeader(width, height, &hdr.bmiHeader);
HBITMAP hbitmap = CreateDIBSection(
bitmap_dc, &hdr, DIB_RGB_COLORS, &bits, NULL, 0);
- if (!hbitmap) {
+ if (!hbitmap)
NOTREACHED() << "Raster bitmap creation for printing failed";
- }
HGDIOBJ old_bitmap = SelectObject(bitmap_dc, hbitmap);
RECT rect = {0, 0, width, height };
« no previous file with comments | « chrome/renderer/print_web_view_helper_mac.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698