OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/process_util.h" | 9 #include "base/process_util.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 // minimum (default) scaling. | 61 // minimum (default) scaling. |
62 // This is important for sites that try to fill the page. | 62 // This is important for sites that try to fill the page. |
63 gfx::Size print_layout_size(print_canvas_size_); | 63 gfx::Size print_layout_size(print_canvas_size_); |
64 print_layout_size.set_height(static_cast<int>( | 64 print_layout_size.set_height(static_cast<int>( |
65 static_cast<double>(print_layout_size.height()) * 1.25)); | 65 static_cast<double>(print_layout_size.height()) * 1.25)); |
66 | 66 |
67 prev_view_size_ = web_view->size(); | 67 prev_view_size_ = web_view->size(); |
68 | 68 |
69 web_view->resize(print_layout_size); | 69 web_view->resize(print_layout_size); |
70 | 70 |
| 71 #if defined(WEBFRAME_PRINTBEGIN_TAKES_NODE) |
| 72 expected_pages_count_ = frame->printBegin( |
| 73 print_canvas_size_, NULL, static_cast<int>(print_params.dpi), |
| 74 &use_browser_overlays_); |
| 75 #else |
71 expected_pages_count_ = frame->printBegin( | 76 expected_pages_count_ = frame->printBegin( |
72 print_canvas_size_, static_cast<int>(print_params.dpi), | 77 print_canvas_size_, static_cast<int>(print_params.dpi), |
73 &use_browser_overlays_); | 78 &use_browser_overlays_); |
| 79 #endif |
74 } | 80 } |
75 | 81 |
76 PrepareFrameAndViewForPrint::~PrepareFrameAndViewForPrint() { | 82 PrepareFrameAndViewForPrint::~PrepareFrameAndViewForPrint() { |
77 frame_->printEnd(); | 83 frame_->printEnd(); |
78 web_view_->resize(prev_view_size_); | 84 web_view_->resize(prev_view_size_); |
79 } | 85 } |
80 | 86 |
81 | 87 |
82 PrintWebViewHelper::PrintWebViewHelper(RenderView* render_view) | 88 PrintWebViewHelper::PrintWebViewHelper(RenderView* render_view) |
83 : render_view_(render_view), | 89 : render_view_(render_view), |
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
498 shared_buf.GiveToProcess(base::GetCurrentProcessHandle(), | 504 shared_buf.GiveToProcess(base::GetCurrentProcessHandle(), |
499 shared_mem_handle); | 505 shared_mem_handle); |
500 return true; | 506 return true; |
501 } | 507 } |
502 } | 508 } |
503 } | 509 } |
504 NOTREACHED(); | 510 NOTREACHED(); |
505 return false; | 511 return false; |
506 } | 512 } |
507 #endif | 513 #endif |
OLD | NEW |