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 <string> | 7 #include <string> |
8 | 8 |
9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
10 #include "base/json/json_writer.h" | 10 #include "base/json/json_writer.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 #include "grit/components_resources.h" | 25 #include "grit/components_resources.h" |
26 #include "net/base/escape.h" | 26 #include "net/base/escape.h" |
27 #include "printing/pdf_metafile_skia.h" | 27 #include "printing/pdf_metafile_skia.h" |
28 #include "printing/units.h" | 28 #include "printing/units.h" |
29 #include "third_party/WebKit/public/platform/WebSize.h" | 29 #include "third_party/WebKit/public/platform/WebSize.h" |
30 #include "third_party/WebKit/public/platform/WebURLRequest.h" | 30 #include "third_party/WebKit/public/platform/WebURLRequest.h" |
31 #include "third_party/WebKit/public/web/WebConsoleMessage.h" | 31 #include "third_party/WebKit/public/web/WebConsoleMessage.h" |
32 #include "third_party/WebKit/public/web/WebDocument.h" | 32 #include "third_party/WebKit/public/web/WebDocument.h" |
33 #include "third_party/WebKit/public/web/WebElement.h" | 33 #include "third_party/WebKit/public/web/WebElement.h" |
34 #include "third_party/WebKit/public/web/WebFrameClient.h" | 34 #include "third_party/WebKit/public/web/WebFrameClient.h" |
| 35 #include "third_party/WebKit/public/web/WebFrameOwnerProperties.h" |
35 #include "third_party/WebKit/public/web/WebLocalFrame.h" | 36 #include "third_party/WebKit/public/web/WebLocalFrame.h" |
36 #include "third_party/WebKit/public/web/WebPlugin.h" | 37 #include "third_party/WebKit/public/web/WebPlugin.h" |
37 #include "third_party/WebKit/public/web/WebPluginDocument.h" | 38 #include "third_party/WebKit/public/web/WebPluginDocument.h" |
38 #include "third_party/WebKit/public/web/WebPrintParams.h" | 39 #include "third_party/WebKit/public/web/WebPrintParams.h" |
39 #include "third_party/WebKit/public/web/WebPrintPresetOptions.h" | 40 #include "third_party/WebKit/public/web/WebPrintPresetOptions.h" |
40 #include "third_party/WebKit/public/web/WebSandboxFlags.h" | 41 #include "third_party/WebKit/public/web/WebSandboxFlags.h" |
41 #include "third_party/WebKit/public/web/WebScriptSource.h" | 42 #include "third_party/WebKit/public/web/WebScriptSource.h" |
42 #include "third_party/WebKit/public/web/WebSettings.h" | 43 #include "third_party/WebKit/public/web/WebSettings.h" |
43 #include "third_party/WebKit/public/web/WebView.h" | 44 #include "third_party/WebKit/public/web/WebView.h" |
44 #include "third_party/WebKit/public/web/WebViewClient.h" | 45 #include "third_party/WebKit/public/web/WebViewClient.h" |
(...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
592 | 593 |
593 protected: | 594 protected: |
594 // blink::WebViewClient override: | 595 // blink::WebViewClient override: |
595 virtual void didStopLoading(); | 596 virtual void didStopLoading(); |
596 | 597 |
597 // blink::WebFrameClient override: | 598 // blink::WebFrameClient override: |
598 virtual blink::WebFrame* createChildFrame( | 599 virtual blink::WebFrame* createChildFrame( |
599 blink::WebLocalFrame* parent, | 600 blink::WebLocalFrame* parent, |
600 blink::WebTreeScopeType scope, | 601 blink::WebTreeScopeType scope, |
601 const blink::WebString& name, | 602 const blink::WebString& name, |
602 blink::WebSandboxFlags sandboxFlags); | 603 blink::WebSandboxFlags sandboxFlags, |
| 604 const blink::WebFrameOwnerProperties& frameOwnerProperties); |
603 virtual void frameDetached(blink::WebFrame* frame, DetachType type); | 605 virtual void frameDetached(blink::WebFrame* frame, DetachType type); |
604 | 606 |
605 private: | 607 private: |
606 void CallOnReady(); | 608 void CallOnReady(); |
607 void ResizeForPrinting(); | 609 void ResizeForPrinting(); |
608 void RestoreSize(); | 610 void RestoreSize(); |
609 void CopySelection(const WebPreferences& preferences); | 611 void CopySelection(const WebPreferences& preferences); |
610 | 612 |
611 FrameReference frame_; | 613 FrameReference frame_; |
612 blink::WebNode node_to_print_; | 614 blink::WebNode node_to_print_; |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
736 // called didStopLoading. | 738 // called didStopLoading. |
737 base::ThreadTaskRunnerHandle::Get()->PostTask( | 739 base::ThreadTaskRunnerHandle::Get()->PostTask( |
738 FROM_HERE, base::Bind(&PrepareFrameAndViewForPrint::CallOnReady, | 740 FROM_HERE, base::Bind(&PrepareFrameAndViewForPrint::CallOnReady, |
739 weak_ptr_factory_.GetWeakPtr())); | 741 weak_ptr_factory_.GetWeakPtr())); |
740 } | 742 } |
741 | 743 |
742 blink::WebFrame* PrepareFrameAndViewForPrint::createChildFrame( | 744 blink::WebFrame* PrepareFrameAndViewForPrint::createChildFrame( |
743 blink::WebLocalFrame* parent, | 745 blink::WebLocalFrame* parent, |
744 blink::WebTreeScopeType scope, | 746 blink::WebTreeScopeType scope, |
745 const blink::WebString& name, | 747 const blink::WebString& name, |
746 blink::WebSandboxFlags sandboxFlags) { | 748 blink::WebSandboxFlags sandboxFlags, |
| 749 const blink::WebFrameOwnerProperties& frameOwnerProperties) { |
747 blink::WebFrame* frame = blink::WebLocalFrame::create(scope, this); | 750 blink::WebFrame* frame = blink::WebLocalFrame::create(scope, this); |
748 parent->appendChild(frame); | 751 parent->appendChild(frame); |
749 return frame; | 752 return frame; |
750 } | 753 } |
751 | 754 |
752 void PrepareFrameAndViewForPrint::frameDetached(blink::WebFrame* frame, | 755 void PrepareFrameAndViewForPrint::frameDetached(blink::WebFrame* frame, |
753 DetachType type) { | 756 DetachType type) { |
754 DCHECK(type == DetachType::Remove); | 757 DCHECK(type == DetachType::Remove); |
755 if (frame->parent()) | 758 if (frame->parent()) |
756 frame->parent()->removeChild(frame); | 759 frame->parent()->removeChild(frame); |
(...skipping 1339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2096 blink::WebConsoleMessage::LevelWarning, message)); | 2099 blink::WebConsoleMessage::LevelWarning, message)); |
2097 return false; | 2100 return false; |
2098 } | 2101 } |
2099 | 2102 |
2100 void PrintWebViewHelper::ScriptingThrottler::Reset() { | 2103 void PrintWebViewHelper::ScriptingThrottler::Reset() { |
2101 // Reset counter on successful print. | 2104 // Reset counter on successful print. |
2102 count_ = 0; | 2105 count_ = 0; |
2103 } | 2106 } |
2104 | 2107 |
2105 } // namespace printing | 2108 } // namespace printing |
OLD | NEW |