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

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

Issue 6352001: Printing: Rename some variables in the two different PrintPages() to be more ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 9 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « chrome/renderer/print_web_view_helper.cc ('k') | no next file » | 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) 2011 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/file_descriptor_posix.h" 7 #include "base/file_descriptor_posix.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "chrome/common/render_messages.h" 9 #include "chrome/common/render_messages.h"
10 #include "chrome/common/render_messages_params.h" 10 #include "chrome/common/render_messages_params.h"
11 #include "printing/native_metafile.h" 11 #include "printing/native_metafile.h"
(...skipping 12 matching lines...) Expand all
24 printing::NativeMetafile metafile(printing::NativeMetafile::PDF); 24 printing::NativeMetafile metafile(printing::NativeMetafile::PDF);
25 int page_count; 25 int page_count;
26 skia::VectorCanvas* canvas = NULL; 26 skia::VectorCanvas* canvas = NULL;
27 27
28 { 28 {
29 // Hack - when |prep_frame_view| goes out of scope, PrintEnd() gets called. 29 // Hack - when |prep_frame_view| goes out of scope, PrintEnd() gets called.
30 // Doing this before closing |metafile| below ensures 30 // Doing this before closing |metafile| below ensures
31 // webkit::ppapi::PluginInstance::PrintEnd() has a valid canvas/metafile to 31 // webkit::ppapi::PluginInstance::PrintEnd() has a valid canvas/metafile to
32 // save the final output to. See pepper_plugin_instance.cc for the whole 32 // save the final output to. See pepper_plugin_instance.cc for the whole
33 // story. 33 // story.
34 PrepareFrameAndViewForPrint prep_frame_view(params.params, 34 ViewMsg_Print_Params printParams = params.params;
35 PrepareFrameAndViewForPrint prep_frame_view(printParams,
35 frame, 36 frame,
36 frame->view()); 37 frame->view());
37 page_count = prep_frame_view.GetExpectedPageCount(); 38 page_count = prep_frame_view.GetExpectedPageCount();
38 39
39 // TODO(myhuang): Send ViewHostMsg_DidGetPrintedPagesCount. 40 // TODO(myhuang): Send ViewHostMsg_DidGetPrintedPagesCount.
40 41
41 if (page_count == 0) 42 if (page_count == 0)
42 return; 43 return;
43 44
44 metafile.Init(); 45 metafile.Init();
45 46
46 ViewMsg_PrintPage_Params print_page_params; 47 ViewMsg_PrintPage_Params page_params;
47 print_page_params.params = params.params; 48 page_params.params = printParams;
48 const gfx::Size& canvas_size = prep_frame_view.GetPrintCanvasSize(); 49 const gfx::Size& canvas_size = prep_frame_view.GetPrintCanvasSize();
49 if (params.pages.empty()) { 50 if (params.pages.empty()) {
50 for (int i = 0; i < page_count; ++i) { 51 for (int i = 0; i < page_count; ++i) {
51 print_page_params.page_number = i; 52 page_params.page_number = i;
52 delete canvas; 53 delete canvas;
53 PrintPage(print_page_params, canvas_size, frame, &metafile, &canvas); 54 PrintPage(page_params, canvas_size, frame, &metafile, &canvas);
54 } 55 }
55 } else { 56 } else {
56 for (size_t i = 0; i < params.pages.size(); ++i) { 57 for (size_t i = 0; i < params.pages.size(); ++i) {
57 print_page_params.page_number = params.pages[i]; 58 page_params.page_number = params.pages[i];
58 delete canvas; 59 delete canvas;
59 PrintPage(print_page_params, canvas_size, frame, &metafile, &canvas); 60 PrintPage(page_params, canvas_size, frame, &metafile, &canvas);
60 } 61 }
61 } 62 }
62 } 63 }
63 64
64 delete canvas; 65 delete canvas;
65 metafile.Close(); 66 metafile.Close();
66 67
67 int sequence_number = -1; 68 int sequence_number = -1;
68 // Get the size of the resulting metafile. 69 // Get the size of the resulting metafile.
69 uint32 buf_size = metafile.GetDataSize(); 70 uint32 buf_size = metafile.GetDataSize();
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 canvas_size.height()); 121 canvas_size.height());
121 frame->printPage(params.page_number, *canvas); 122 frame->printPage(params.page_number, *canvas);
122 123
123 // TODO(myhuang): We should handle transformation for paper margins. 124 // TODO(myhuang): We should handle transformation for paper margins.
124 // TODO(myhuang): We should render the header and the footer. 125 // TODO(myhuang): We should render the header and the footer.
125 126
126 // Done printing. Close the device context to retrieve the compiled metafile. 127 // Done printing. Close the device context to retrieve the compiled metafile.
127 if (!metafile->FinishPage()) 128 if (!metafile->FinishPage())
128 NOTREACHED() << "metafile failed"; 129 NOTREACHED() << "metafile failed";
129 } 130 }
OLDNEW
« no previous file with comments | « chrome/renderer/print_web_view_helper.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698