OLD | NEW |
1 // Copyright (c) 2010 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 <string> |
| 8 |
7 #include "app/l10n_util.h" | 9 #include "app/l10n_util.h" |
8 #include "base/logging.h" | 10 #include "base/logging.h" |
9 #include "base/process_util.h" | 11 #include "base/process_util.h" |
10 #include "base/utf_string_conversions.h" | 12 #include "base/utf_string_conversions.h" |
11 #include "chrome/common/render_messages.h" | 13 #include "chrome/common/render_messages.h" |
12 #include "chrome/common/render_messages_params.h" | 14 #include "chrome/common/render_messages_params.h" |
13 #include "chrome/renderer/render_view.h" | 15 #include "chrome/renderer/render_view.h" |
14 #include "grit/generated_resources.h" | 16 #include "grit/generated_resources.h" |
15 #include "printing/units.h" | 17 #include "printing/units.h" |
16 #include "third_party/WebKit/WebKit/chromium/public/WebConsoleMessage.h" | 18 #include "third_party/WebKit/WebKit/chromium/public/WebConsoleMessage.h" |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 int page_count = prep_frame_view.GetExpectedPageCount(); | 241 int page_count = prep_frame_view.GetExpectedPageCount(); |
240 | 242 |
241 Send(new ViewHostMsg_DidGetPrintedPagesCount(routing_id(), | 243 Send(new ViewHostMsg_DidGetPrintedPagesCount(routing_id(), |
242 printParams.document_cookie, | 244 printParams.document_cookie, |
243 page_count)); | 245 page_count)); |
244 if (!page_count) | 246 if (!page_count) |
245 return; | 247 return; |
246 | 248 |
247 const gfx::Size& canvas_size = prep_frame_view.GetPrintCanvasSize(); | 249 const gfx::Size& canvas_size = prep_frame_view.GetPrintCanvasSize(); |
248 ViewMsg_PrintPage_Params page_params; | 250 ViewMsg_PrintPage_Params page_params; |
249 page_params.params = params.params; | 251 page_params.params = printParams; |
250 if (params.pages.empty()) { | 252 if (params.pages.empty()) { |
251 for (int i = 0; i < page_count; ++i) { | 253 for (int i = 0; i < page_count; ++i) { |
252 page_params.page_number = i; | 254 page_params.page_number = i; |
253 PrintPage(page_params, canvas_size, frame); | 255 PrintPage(page_params, canvas_size, frame); |
254 } | 256 } |
255 } else { | 257 } else { |
256 for (size_t i = 0; i < params.pages.size(); ++i) { | 258 for (size_t i = 0; i < params.pages.size(); ++i) { |
257 if (params.pages[i] >= page_count) | 259 if (params.pages[i] >= page_count) |
258 break; | 260 break; |
259 page_params.page_number = params.pages[i]; | 261 page_params.page_number = params.pages[i]; |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
507 shared_buf.GiveToProcess(base::GetCurrentProcessHandle(), | 509 shared_buf.GiveToProcess(base::GetCurrentProcessHandle(), |
508 shared_mem_handle); | 510 shared_mem_handle); |
509 return true; | 511 return true; |
510 } | 512 } |
511 } | 513 } |
512 } | 514 } |
513 NOTREACHED(); | 515 NOTREACHED(); |
514 return false; | 516 return false; |
515 } | 517 } |
516 #endif | 518 #endif |
OLD | NEW |