OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "components/printing/renderer/print_web_view_helper.h" | 5 #include "components/printing/renderer/print_web_view_helper.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 #include <string> | 9 #include <string> |
10 #include <utility> | 10 #include <utility> |
(...skipping 694 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
705 blink::WebView* web_view = frame_.view(); | 705 blink::WebView* web_view = frame_.view(); |
706 // Backup size and offset. | 706 // Backup size and offset. |
707 if (blink::WebFrame* web_frame = web_view->mainFrame()) | 707 if (blink::WebFrame* web_frame = web_view->mainFrame()) |
708 prev_scroll_offset_ = web_frame->scrollOffset(); | 708 prev_scroll_offset_ = web_frame->scrollOffset(); |
709 prev_view_size_ = web_view->size(); | 709 prev_view_size_ = web_view->size(); |
710 | 710 |
711 web_view->resize(print_layout_size); | 711 web_view->resize(print_layout_size); |
712 } | 712 } |
713 | 713 |
714 void PrepareFrameAndViewForPrint::StartPrinting() { | 714 void PrepareFrameAndViewForPrint::StartPrinting() { |
715 ResizeForPrinting(); | |
716 blink::WebView* web_view = frame_.view(); | 715 blink::WebView* web_view = frame_.view(); |
717 web_view->settings()->setShouldPrintBackgrounds(should_print_backgrounds_); | 716 web_view->settings()->setShouldPrintBackgrounds(should_print_backgrounds_); |
718 expected_pages_count_ = | 717 expected_pages_count_ = |
719 frame()->printBegin(web_print_params_, node_to_print_); | 718 frame()->printBegin(web_print_params_, node_to_print_); |
| 719 ResizeForPrinting(); |
720 is_printing_started_ = true; | 720 is_printing_started_ = true; |
721 } | 721 } |
722 | 722 |
723 void PrepareFrameAndViewForPrint::CopySelectionIfNeeded( | 723 void PrepareFrameAndViewForPrint::CopySelectionIfNeeded( |
724 const WebPreferences& preferences, | 724 const WebPreferences& preferences, |
725 const base::Closure& on_ready) { | 725 const base::Closure& on_ready) { |
726 on_ready_ = on_ready; | 726 on_ready_ = on_ready; |
727 if (should_print_selection_only_) { | 727 if (should_print_selection_only_) { |
728 CopySelection(preferences); | 728 CopySelection(preferences); |
729 } else { | 729 } else { |
(...skipping 1531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2261 blink::WebConsoleMessage::LevelWarning, message)); | 2261 blink::WebConsoleMessage::LevelWarning, message)); |
2262 return false; | 2262 return false; |
2263 } | 2263 } |
2264 | 2264 |
2265 void PrintWebViewHelper::ScriptingThrottler::Reset() { | 2265 void PrintWebViewHelper::ScriptingThrottler::Reset() { |
2266 // Reset counter on successful print. | 2266 // Reset counter on successful print. |
2267 count_ = 0; | 2267 count_ = 0; |
2268 } | 2268 } |
2269 | 2269 |
2270 } // namespace printing | 2270 } // namespace printing |
OLD | NEW |