web_contents.patch 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
  2. From: Anonymous <[email protected]>
  3. Date: Thu, 20 Sep 2018 17:46:53 -0700
  4. Subject: web_contents.patch
  5. diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
  6. index 08c2fda816c1c2c983849b5172946662515ed4d9..c2a579ed267f4081f44e9f2da2cfc90ae08bf750 100644
  7. --- a/content/browser/web_contents/web_contents_impl.cc
  8. +++ b/content/browser/web_contents/web_contents_impl.cc
  9. @@ -2068,6 +2068,12 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params) {
  10. std::string unique_name;
  11. frame_tree_.root()->SetFrameName(params.main_frame_name, unique_name);
  12. + if (params.view && params.delegate_view) {
  13. + view_.reset(params.view);
  14. + render_view_host_delegate_view_ = params.delegate_view;
  15. + }
  16. +
  17. + if (!view_) {
  18. WebContentsViewDelegate* delegate =
  19. GetContentClient()->browser()->GetWebContentsViewDelegate(this);
  20. @@ -2078,6 +2084,7 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params) {
  21. view_.reset(CreateWebContentsView(this, delegate,
  22. &render_view_host_delegate_view_));
  23. }
  24. + } // !view_
  25. CHECK(render_view_host_delegate_view_);
  26. CHECK(view_.get());
  27. diff --git a/content/public/browser/web_contents.h b/content/public/browser/web_contents.h
  28. index ecee31b744ed0871a9f1052d5419075582a90baa..0ce547c74610e13f7f723da997fb0a9799c96efb 100644
  29. --- a/content/public/browser/web_contents.h
  30. +++ b/content/public/browser/web_contents.h
  31. @@ -79,9 +79,12 @@ class BrowserPluginGuestDelegate;
  32. class InterstitialPage;
  33. class RenderFrameHost;
  34. class RenderViewHost;
  35. +class RenderViewHostDelegateView;
  36. class RenderWidgetHost;
  37. class RenderWidgetHostView;
  38. +class RenderWidgetHostViewBase;
  39. class WebContentsDelegate;
  40. +class WebContentsView;
  41. struct CustomContextMenuContext;
  42. struct DropData;
  43. struct MHTMLGenerationParams;
  44. @@ -214,6 +217,10 @@ class WebContents : public PageNavigator,
  45. kInitializeAndWarmupRendererProcess,
  46. } desired_renderer_state;
  47. + // Optionally specify the view and delegate view.
  48. + content::WebContentsView* view = nullptr;
  49. + content::RenderViewHostDelegateView* delegate_view = nullptr;
  50. +
  51. // Sandboxing flags set on the new WebContents.
  52. blink::WebSandboxFlags starting_sandbox_flags;