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

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

Issue 54963005: Upstream printing changes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: cleanup Created 7 years, 1 month 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/printing/print_web_view_helper.h" 5 #include "android_webview/renderer/print_web_view_helper.h"
6 6
7 #include "android_webview/common/print_messages.h"
7 #include "base/logging.h" 8 #include "base/logging.h"
8 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
9 #include "chrome/common/print_messages.h"
10 #include "content/public/renderer/render_thread.h" 10 #include "content/public/renderer/render_thread.h"
11 #include "printing/metafile.h" 11 #include "printing/metafile.h"
12 #include "printing/metafile_impl.h" 12 #include "printing/metafile_impl.h"
13 #include "printing/metafile_skia_wrapper.h" 13 #include "printing/metafile_skia_wrapper.h"
14 #include "printing/page_size_margins.h" 14 #include "printing/page_size_margins.h"
15 #include "skia/ext/platform_device.h" 15 #include "skia/ext/platform_device.h"
16 #include "skia/ext/vector_canvas.h" 16 #include "skia/ext/vector_canvas.h"
17 #include "third_party/WebKit/public/web/WebFrame.h" 17 #include "third_party/WebKit/public/web/WebFrame.h"
18 18
19 #if !defined(OS_CHROMEOS) && !defined(OS_ANDROID) 19 #if !defined(OS_CHROMEOS) && !defined(OS_ANDROID)
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 &(printed_page_params.metafile_data_handle)); 138 &(printed_page_params.metafile_data_handle));
139 } 139 }
140 140
141 for (size_t i = 0; i < printed_pages.size(); ++i) { 141 for (size_t i = 0; i < printed_pages.size(); ++i) {
142 printed_page_params.page_number = printed_pages[i]; 142 printed_page_params.page_number = printed_pages[i];
143 Send(new PrintHostMsg_DidPrintPage(routing_id(), printed_page_params)); 143 Send(new PrintHostMsg_DidPrintPage(routing_id(), printed_page_params));
144 // Send the rest of the pages with an invalid metafile handle. 144 // Send the rest of the pages with an invalid metafile handle.
145 printed_page_params.metafile_data_handle.fd = -1; 145 printed_page_params.metafile_data_handle.fd = -1;
146 } 146 }
147 return true; 147 return true;
148 #endif // defined(OS_CHROMEOS) 148 #endif // defined(OS_CHROMEOS) || defined(OS_ANDROID)
149 } 149 }
150 150
151 void PrintWebViewHelper::PrintPageInternal( 151 void PrintWebViewHelper::PrintPageInternal(
152 const PrintMsg_PrintPage_Params& params, 152 const PrintMsg_PrintPage_Params& params,
153 const gfx::Size& canvas_size, 153 const gfx::Size& canvas_size,
154 WebFrame* frame, 154 WebFrame* frame,
155 Metafile* metafile) { 155 Metafile* metafile) {
156 PageSizeMargins page_layout_in_points; 156 PageSizeMargins page_layout_in_points;
157 double scale_factor = 1.0f; 157 double scale_factor = 1.0f;
158 ComputePageLayoutInPointsForCss(frame, params.page_number, params.params, 158 ComputePageLayoutInPointsForCss(frame, params.page_number, params.params,
(...skipping 30 matching lines...) Expand all
189 } 189 }
190 RenderPageContent(frame, params.page_number, canvas_area, content_area, 190 RenderPageContent(frame, params.page_number, canvas_area, content_area,
191 scale_factor, canvas.get()); 191 scale_factor, canvas.get());
192 192
193 // Done printing. Close the device context to retrieve the compiled metafile. 193 // Done printing. Close the device context to retrieve the compiled metafile.
194 if (!metafile->FinishPage()) 194 if (!metafile->FinishPage())
195 NOTREACHED() << "metafile failed"; 195 NOTREACHED() << "metafile failed";
196 } 196 }
197 197
198 } // namespace printing 198 } // namespace printing
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698