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

Side by Side Diff: chrome/renderer/print_web_view_helper_linux.cc

Issue 179028: Revert "Fix a ton of compiler warnings." (Closed)
Patch Set: Created 11 years, 3 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 unified diff | Download patch
« no previous file with comments | « chrome/renderer/audio_message_filter.h ('k') | chrome/renderer/render_view.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/renderer/print_web_view_helper.h" 5 #include "chrome/renderer/print_web_view_helper.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "chrome/common/render_messages.h" 8 #include "chrome/common/render_messages.h"
9 #include "skia/ext/vector_canvas.h" 9 #include "skia/ext/vector_canvas.h"
10 #include "webkit/api/public/WebFrame.h" 10 #include "webkit/api/public/WebFrame.h"
11 11
12 using WebKit::WebFrame; 12 using WebKit::WebFrame;
13 13
14 void PrintWebViewHelper::Print(WebFrame* frame, bool script_initiated) { 14 void PrintWebViewHelper::Print(WebFrame* frame, bool script_initiated) {
15 // If still not finished with earlier print request simply ignore. 15 // If still not finished with earlier print request simply ignore.
16 if (IsPrinting()) 16 if (IsPrinting())
17 return; 17 return;
18 18
19 // TODO(myhuang): Get printing parameters via IPC. 19 // TODO(myhuang): Get printing parameters via IPC.
20 // For testing purpose, we hard-coded printing parameters here. 20 // For testing purpose, we hard-coded printing parameters here.
21 21
22 // The paper size is US Letter (8.5 in. by 11 in.). 22 // The paper size is US Letter (8.5 in. by 11 in.).
23 // Using default margins: 23 // Using default margins:
24 // Left = 0.25 in. 24 // Left = 0.25 in.
25 // Right = 0.25 in. 25 // Right = 0.25 in.
26 // Top = 0.25 in. 26 // Top = 0.25 in.
27 // Bottom = 0.56 in. 27 // Bottom = 0.56 in.
28 const int kDPI = 72; 28 const int kDPI = 72;
29 const int kWidth = static_cast<int>((8.5-0.25-0.25) * kDPI); 29 const int kWidth = (8.5-0.25-0.25) * kDPI;
30 const int kHeight = static_cast<int>((11-0.25-0.56) * kDPI); 30 const int kHeight = (11-0.25-0.56) * kDPI;
31 ViewMsg_Print_Params default_settings; 31 ViewMsg_Print_Params default_settings;
32 default_settings.printable_size = gfx::Size(kWidth, kHeight); 32 default_settings.printable_size = gfx::Size(kWidth, kHeight);
33 default_settings.dpi = kDPI; 33 default_settings.dpi = kDPI;
34 default_settings.min_shrink = 1.25; 34 default_settings.min_shrink = 1.25;
35 default_settings.max_shrink = 2.0; 35 default_settings.max_shrink = 2.0;
36 default_settings.desired_dpi = kDPI; 36 default_settings.desired_dpi = kDPI;
37 default_settings.document_cookie = 0; 37 default_settings.document_cookie = NULL;
38 default_settings.selection_only = false; 38 default_settings.selection_only = false;
39 39
40 // Calculate the estimated page count. 40 // Calculate the estimated page count.
41 PrepareFrameAndViewForPrint prep_frame_view(default_settings, 41 PrepareFrameAndViewForPrint prep_frame_view(default_settings,
42 frame, 42 frame,
43 frame->view()); 43 frame->view());
44 int expected_pages_count = prep_frame_view.GetExpectedPageCount(); 44 int expected_pages_count = prep_frame_view.GetExpectedPageCount();
45 DCHECK(expected_pages_count); 45 DCHECK(expected_pages_count);
46 46
47 ViewMsg_PrintPage_Params page_params; 47 ViewMsg_PrintPage_Params page_params;
(...skipping 29 matching lines...) Expand all
77 skia::VectorCanvas canvas(size_x, size_y); 77 skia::VectorCanvas canvas(size_x, size_y);
78 float webkit_shrink = frame->printPage(params.page_number, &canvas); 78 float webkit_shrink = frame->printPage(params.page_number, &canvas);
79 if (shrink <= 0) { 79 if (shrink <= 0) {
80 NOTREACHED() << "Printing page " << params.page_number << " failed."; 80 NOTREACHED() << "Printing page " << params.page_number << " failed.";
81 } else { 81 } else {
82 // Update the dpi adjustment with the "page shrink" calculated in webkit. 82 // Update the dpi adjustment with the "page shrink" calculated in webkit.
83 shrink /= webkit_shrink; 83 shrink /= webkit_shrink;
84 } 84 }
85 } 85 }
86 86
OLDNEW
« no previous file with comments | « chrome/renderer/audio_message_filter.h ('k') | chrome/renderer/render_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698