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 588 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
599 | 599 |
600 void FinishPrinting(); | 600 void FinishPrinting(); |
601 | 601 |
602 bool IsLoadingSelection() { | 602 bool IsLoadingSelection() { |
603 // It's not selection if not |owns_web_view_|. | 603 // It's not selection if not |owns_web_view_|. |
604 return owns_web_view_ && frame() && frame()->isLoading(); | 604 return owns_web_view_ && frame() && frame()->isLoading(); |
605 } | 605 } |
606 | 606 |
607 private: | 607 private: |
608 // blink::WebViewClient: | 608 // blink::WebViewClient: |
609 void didStopLoading() override; | 609 void didStopLoading(blink::WebLocalFrame*) override; |
610 // TODO(ojan): Remove this override and have this class use a non-null | 610 // TODO(ojan): Remove this override and have this class use a non-null |
611 // layerTreeView. | 611 // layerTreeView. |
612 bool allowsBrokenNullLayerTreeView() const override; | 612 bool allowsBrokenNullLayerTreeView() const override; |
613 | 613 |
614 // blink::WebFrameClient: | 614 // blink::WebFrameClient: |
615 blink::WebFrame* createChildFrame( | 615 blink::WebFrame* createChildFrame( |
616 blink::WebLocalFrame* parent, | 616 blink::WebLocalFrame* parent, |
617 blink::WebTreeScopeType scope, | 617 blink::WebTreeScopeType scope, |
618 const blink::WebString& name, | 618 const blink::WebString& name, |
619 blink::WebSandboxFlags sandboxFlags, | 619 blink::WebSandboxFlags sandboxFlags, |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
741 | 741 |
742 // When loading is done this will call didStopLoading() and that will do the | 742 // When loading is done this will call didStopLoading() and that will do the |
743 // actual printing. | 743 // actual printing. |
744 frame()->loadRequest(blink::WebURLRequest(GURL(url_str))); | 744 frame()->loadRequest(blink::WebURLRequest(GURL(url_str))); |
745 } | 745 } |
746 | 746 |
747 bool PrepareFrameAndViewForPrint::allowsBrokenNullLayerTreeView() const { | 747 bool PrepareFrameAndViewForPrint::allowsBrokenNullLayerTreeView() const { |
748 return true; | 748 return true; |
749 } | 749 } |
750 | 750 |
751 void PrepareFrameAndViewForPrint::didStopLoading() { | 751 void PrepareFrameAndViewForPrint::didStopLoading(blink::WebLocalFrame*) { |
752 DCHECK(!on_ready_.is_null()); | 752 DCHECK(!on_ready_.is_null()); |
753 // Don't call callback here, because it can delete |this| and WebView that is | 753 // Don't call callback here, because it can delete |this| and WebView that is |
754 // called didStopLoading. | 754 // called didStopLoading. |
755 base::ThreadTaskRunnerHandle::Get()->PostTask( | 755 base::ThreadTaskRunnerHandle::Get()->PostTask( |
756 FROM_HERE, base::Bind(&PrepareFrameAndViewForPrint::CallOnReady, | 756 FROM_HERE, base::Bind(&PrepareFrameAndViewForPrint::CallOnReady, |
757 weak_ptr_factory_.GetWeakPtr())); | 757 weak_ptr_factory_.GetWeakPtr())); |
758 } | 758 } |
759 | 759 |
760 blink::WebFrame* PrepareFrameAndViewForPrint::createChildFrame( | 760 blink::WebFrame* PrepareFrameAndViewForPrint::createChildFrame( |
761 blink::WebLocalFrame* parent, | 761 blink::WebLocalFrame* parent, |
(...skipping 1491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2253 blink::WebConsoleMessage::LevelWarning, message)); | 2253 blink::WebConsoleMessage::LevelWarning, message)); |
2254 return false; | 2254 return false; |
2255 } | 2255 } |
2256 | 2256 |
2257 void PrintWebViewHelper::ScriptingThrottler::Reset() { | 2257 void PrintWebViewHelper::ScriptingThrottler::Reset() { |
2258 // Reset counter on successful print. | 2258 // Reset counter on successful print. |
2259 count_ = 0; | 2259 count_ = 0; |
2260 } | 2260 } |
2261 | 2261 |
2262 } // namespace printing | 2262 } // namespace printing |
OLD | NEW |