| 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 605 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 616 | 616 |
| 617 // blink::WebFrameClient: | 617 // blink::WebFrameClient: |
| 618 blink::WebFrame* createChildFrame( | 618 blink::WebFrame* createChildFrame( |
| 619 blink::WebLocalFrame* parent, | 619 blink::WebLocalFrame* parent, |
| 620 blink::WebTreeScopeType scope, | 620 blink::WebTreeScopeType scope, |
| 621 const blink::WebString& name, | 621 const blink::WebString& name, |
| 622 const blink::WebString& unique_name, | 622 const blink::WebString& unique_name, |
| 623 blink::WebSandboxFlags sandbox_flags, | 623 blink::WebSandboxFlags sandbox_flags, |
| 624 const blink::WebFrameOwnerProperties& frame_owner_properties) override; | 624 const blink::WebFrameOwnerProperties& frame_owner_properties) override; |
| 625 void frameDetached(blink::WebFrame* frame, DetachType type) override; | 625 void frameDetached(blink::WebFrame* frame, DetachType type) override; |
| 626 void checkIfAudioSinkExistsAndIsAuthorized( |
| 627 const blink::WebString& sinkId, |
| 628 const blink::WebSecurityOrigin&, |
| 629 blink::WebSetSinkIdCallbacks*) override; |
| 626 | 630 |
| 627 void CallOnReady(); | 631 void CallOnReady(); |
| 628 void ResizeForPrinting(); | 632 void ResizeForPrinting(); |
| 629 void RestoreSize(); | 633 void RestoreSize(); |
| 630 void CopySelection(const WebPreferences& preferences); | 634 void CopySelection(const WebPreferences& preferences); |
| 631 | 635 |
| 632 FrameReference frame_; | 636 FrameReference frame_; |
| 633 blink::WebNode node_to_print_; | 637 blink::WebNode node_to_print_; |
| 634 bool owns_web_view_; | 638 bool owns_web_view_; |
| 635 blink::WebPrintParams web_print_params_; | 639 blink::WebPrintParams web_print_params_; |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 778 } | 782 } |
| 779 | 783 |
| 780 void PrepareFrameAndViewForPrint::frameDetached(blink::WebFrame* frame, | 784 void PrepareFrameAndViewForPrint::frameDetached(blink::WebFrame* frame, |
| 781 DetachType type) { | 785 DetachType type) { |
| 782 DCHECK(type == DetachType::Remove); | 786 DCHECK(type == DetachType::Remove); |
| 783 if (frame->parent()) | 787 if (frame->parent()) |
| 784 frame->parent()->removeChild(frame); | 788 frame->parent()->removeChild(frame); |
| 785 frame->close(); | 789 frame->close(); |
| 786 } | 790 } |
| 787 | 791 |
| 792 void PrepareFrameAndViewForPrint::checkIfAudioSinkExistsAndIsAuthorized( |
| 793 const blink::WebString& sinkId, |
| 794 const blink::WebSecurityOrigin&, |
| 795 blink::WebSetSinkIdCallbacks*) { |
| 796 NOTREACHED(); |
| 797 } |
| 798 |
| 788 void PrepareFrameAndViewForPrint::CallOnReady() { | 799 void PrepareFrameAndViewForPrint::CallOnReady() { |
| 789 return on_ready_.Run(); // Can delete |this|. | 800 return on_ready_.Run(); // Can delete |this|. |
| 790 } | 801 } |
| 791 | 802 |
| 792 void PrepareFrameAndViewForPrint::RestoreSize() { | 803 void PrepareFrameAndViewForPrint::RestoreSize() { |
| 793 if (frame()) { | 804 if (frame()) { |
| 794 blink::WebView* web_view = frame_.GetFrame()->view(); | 805 blink::WebView* web_view = frame_.GetFrame()->view(); |
| 795 web_view->resize(prev_view_size_); | 806 web_view->resize(prev_view_size_); |
| 796 if (blink::WebFrame* web_frame = web_view->mainFrame()) | 807 if (blink::WebFrame* web_frame = web_view->mainFrame()) |
| 797 web_frame->setScrollOffset(prev_scroll_offset_); | 808 web_frame->setScrollOffset(prev_scroll_offset_); |
| (...skipping 1447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2245 blink::WebConsoleMessage::LevelWarning, message)); | 2256 blink::WebConsoleMessage::LevelWarning, message)); |
| 2246 return false; | 2257 return false; |
| 2247 } | 2258 } |
| 2248 | 2259 |
| 2249 void PrintWebViewHelper::ScriptingThrottler::Reset() { | 2260 void PrintWebViewHelper::ScriptingThrottler::Reset() { |
| 2250 // Reset counter on successful print. | 2261 // Reset counter on successful print. |
| 2251 count_ = 0; | 2262 count_ = 0; |
| 2252 } | 2263 } |
| 2253 | 2264 |
| 2254 } // namespace printing | 2265 } // namespace printing |
| OLD | NEW |