Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(418)

Side by Side Diff: chrome/renderer/printing/print_web_view_helper.cc

Issue 837283003: Start replicating sandbox flags for OOPIF (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "chrome/renderer/printing/print_web_view_helper.h" 5 #include "chrome/renderer/printing/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/command_line.h" 10 #include "base/command_line.h"
(...skipping 22 matching lines...) Expand all
33 #include "third_party/WebKit/public/web/WebConsoleMessage.h" 33 #include "third_party/WebKit/public/web/WebConsoleMessage.h"
34 #include "third_party/WebKit/public/web/WebDocument.h" 34 #include "third_party/WebKit/public/web/WebDocument.h"
35 #include "third_party/WebKit/public/web/WebElement.h" 35 #include "third_party/WebKit/public/web/WebElement.h"
36 #include "third_party/WebKit/public/web/WebFrameClient.h" 36 #include "third_party/WebKit/public/web/WebFrameClient.h"
37 #include "third_party/WebKit/public/web/WebLocalFrame.h" 37 #include "third_party/WebKit/public/web/WebLocalFrame.h"
38 #include "third_party/WebKit/public/web/WebPlugin.h" 38 #include "third_party/WebKit/public/web/WebPlugin.h"
39 #include "third_party/WebKit/public/web/WebPluginDocument.h" 39 #include "third_party/WebKit/public/web/WebPluginDocument.h"
40 #include "third_party/WebKit/public/web/WebPrintParams.h" 40 #include "third_party/WebKit/public/web/WebPrintParams.h"
41 #include "third_party/WebKit/public/web/WebPrintPresetOptions.h" 41 #include "third_party/WebKit/public/web/WebPrintPresetOptions.h"
42 #include "third_party/WebKit/public/web/WebPrintScalingOption.h" 42 #include "third_party/WebKit/public/web/WebPrintScalingOption.h"
43 #include "third_party/WebKit/public/web/WebSandboxFlags.h"
43 #include "third_party/WebKit/public/web/WebScriptSource.h" 44 #include "third_party/WebKit/public/web/WebScriptSource.h"
44 #include "third_party/WebKit/public/web/WebSettings.h" 45 #include "third_party/WebKit/public/web/WebSettings.h"
45 #include "third_party/WebKit/public/web/WebView.h" 46 #include "third_party/WebKit/public/web/WebView.h"
46 #include "third_party/WebKit/public/web/WebViewClient.h" 47 #include "third_party/WebKit/public/web/WebViewClient.h"
47 #include "ui/base/resource/resource_bundle.h" 48 #include "ui/base/resource/resource_bundle.h"
48 49
49 #if defined(ENABLE_EXTENSIONS) 50 #if defined(ENABLE_EXTENSIONS)
50 #include "chrome/common/extensions/extension_constants.h" 51 #include "chrome/common/extensions/extension_constants.h"
51 #include "extensions/common/constants.h" 52 #include "extensions/common/constants.h"
52 #endif // defined(ENABLE_EXTENSIONS) 53 #endif // defined(ENABLE_EXTENSIONS)
(...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after
579 // TODO(ojan): Remove this override and have this class use a non-null 580 // TODO(ojan): Remove this override and have this class use a non-null
580 // layerTreeView. 581 // layerTreeView.
581 // blink::WebViewClient override: 582 // blink::WebViewClient override:
582 virtual bool allowsBrokenNullLayerTreeView() const; 583 virtual bool allowsBrokenNullLayerTreeView() const;
583 584
584 protected: 585 protected:
585 // blink::WebViewClient override: 586 // blink::WebViewClient override:
586 virtual void didStopLoading(); 587 virtual void didStopLoading();
587 588
588 // blink::WebFrameClient override: 589 // blink::WebFrameClient override:
589 virtual blink::WebFrame* createChildFrame(blink::WebLocalFrame* parent, 590 // TODO(alexmos): Remove once Blink is updated to use sandbox flags.
590 const blink::WebString& name); 591 virtual blink::WebFrame* createChildFrame(
592 blink::WebLocalFrame* parent,
593 const blink::WebString& name);
594 virtual blink::WebFrame* createChildFrame(
595 blink::WebLocalFrame* parent,
596 const blink::WebString& name,
597 blink::WebSandboxFlags sandboxFlags);
591 virtual void frameDetached(blink::WebFrame* frame); 598 virtual void frameDetached(blink::WebFrame* frame);
592 599
593 private: 600 private:
594 void CallOnReady(); 601 void CallOnReady();
595 void ResizeForPrinting(); 602 void ResizeForPrinting();
596 void RestoreSize(); 603 void RestoreSize();
597 void CopySelection(const WebPreferences& preferences); 604 void CopySelection(const WebPreferences& preferences);
598 605
599 FrameReference frame_; 606 FrameReference frame_;
600 blink::WebNode node_to_print_; 607 blink::WebNode node_to_print_;
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
723 void PrepareFrameAndViewForPrint::didStopLoading() { 730 void PrepareFrameAndViewForPrint::didStopLoading() {
724 DCHECK(!on_ready_.is_null()); 731 DCHECK(!on_ready_.is_null());
725 // Don't call callback here, because it can delete |this| and WebView that is 732 // Don't call callback here, because it can delete |this| and WebView that is
726 // called didStopLoading. 733 // called didStopLoading.
727 base::MessageLoop::current()->PostTask( 734 base::MessageLoop::current()->PostTask(
728 FROM_HERE, 735 FROM_HERE,
729 base::Bind(&PrepareFrameAndViewForPrint::CallOnReady, 736 base::Bind(&PrepareFrameAndViewForPrint::CallOnReady,
730 weak_ptr_factory_.GetWeakPtr())); 737 weak_ptr_factory_.GetWeakPtr()));
731 } 738 }
732 739
740 // TODO(alexmos): Remove once Blink is updated to use sandbox flags.
741 blink::WebFrame* PrepareFrameAndViewForPrint::createChildFrame(
742 blink::WebLocalFrame* parent,
743 const blink::WebString& name) {
744 return createChildFrame(parent, name, blink::WebSandboxNone);
745 }
746
733 blink::WebFrame* PrepareFrameAndViewForPrint::createChildFrame( 747 blink::WebFrame* PrepareFrameAndViewForPrint::createChildFrame(
734 blink::WebLocalFrame* parent, 748 blink::WebLocalFrame* parent,
735 const blink::WebString& name) { 749 const blink::WebString& name,
750 blink::WebSandboxFlags sandboxFlags) {
736 blink::WebFrame* frame = blink::WebLocalFrame::create(this); 751 blink::WebFrame* frame = blink::WebLocalFrame::create(this);
737 parent->appendChild(frame); 752 parent->appendChild(frame);
738 return frame; 753 return frame;
739 } 754 }
740 755
741 void PrepareFrameAndViewForPrint::frameDetached(blink::WebFrame* frame) { 756 void PrepareFrameAndViewForPrint::frameDetached(blink::WebFrame* frame) {
742 if (frame->parent()) 757 if (frame->parent())
743 frame->parent()->removeChild(frame); 758 frame->parent()->removeChild(frame);
744 frame->close(); 759 frame->close();
745 } 760 }
(...skipping 1298 matching lines...) Expand 10 before | Expand all | Expand 10 after
2044 blink::WebConsoleMessage::LevelWarning, message)); 2059 blink::WebConsoleMessage::LevelWarning, message));
2045 return false; 2060 return false;
2046 } 2061 }
2047 2062
2048 void PrintWebViewHelper::ScriptingThrottler::Reset() { 2063 void PrintWebViewHelper::ScriptingThrottler::Reset() {
2049 // Reset counter on successful print. 2064 // Reset counter on successful print.
2050 count_ = 0; 2065 count_ = 0;
2051 } 2066 }
2052 2067
2053 } // namespace printing 2068 } // namespace printing
OLDNEW
« no previous file with comments | « no previous file | content/browser/frame_host/frame_tree_node.h » ('j') | content/common/frame_messages.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698