@@ -21,10 +21,21 @@ index 23cd457563d7d534e924428ac6da2b475e579326..d8698f9f37eefa50bf4e29a164b2cc30
2121 &no_javascript_access);
2222
2323diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
24- index f3204a39253652a906f8976c666395e8afa033a8..a45bf004f5096809b5fc7b70faa0b7fa7b257049 100644
24+ index f3204a39253652a906f8976c666395e8afa033a8..d9b5a70e0c7acfaac312663ba336580eb062fae4 100644
2525--- a/content/browser/web_contents/web_contents_impl.cc
2626+++ b/content/browser/web_contents/web_contents_impl.cc
27- @@ -5293,6 +5293,12 @@ FrameTree* WebContentsImpl::CreateNewWindow(
27+ @@ -5238,6 +5238,10 @@ FrameTree* WebContentsImpl::CreateNewWindow(
28+ create_params.initially_hidden = renderer_started_hidden;
29+ create_params.initial_popup_url = params.target_url;
30+
31+ + // Potentially allow the delegate to override the create_params.
32+ + if (delegate_)
33+ + delegate_->MaybeOverrideCreateParamsForNewWindow(&create_params);
34+ +
35+ // Even though all codepaths leading here are in response to a renderer
36+ // trying to open a new window, if the new window ends up in a different
37+ // browsing instance, then the RenderViewHost, RenderWidgetHost,
38+ @@ -5293,6 +5297,12 @@ FrameTree* WebContentsImpl::CreateNewWindow(
2839 // Sets the newly created WebContents WindowOpenDisposition.
2940 new_contents_impl->original_window_open_disposition_ = params.disposition;
3041
@@ -37,7 +48,7 @@ index f3204a39253652a906f8976c666395e8afa033a8..a45bf004f5096809b5fc7b70faa0b7fa
3748 // If the new frame has a name, make sure any SiteInstances that can find
3849 // this named frame have proxies for it. Must be called after
3950 // SetSessionStorageNamespace, since this calls CreateRenderView, which uses
40- @@ -5334,12 +5340 ,6 @@ FrameTree* WebContentsImpl::CreateNewWindow(
51+ @@ -5334,12 +5344 ,6 @@ FrameTree* WebContentsImpl::CreateNewWindow(
4152 AddWebContentsDestructionObserver(new_contents_impl);
4253 }
4354
@@ -122,7 +133,7 @@ index f42be2a1cc5ba3ccb52e48985e0532a34675e826..f6ab6ab2b036c7621b429181c3ff89d9
122133 WebContents* source,
123134 const OpenURLParams& params,
124135diff --git a/content/public/browser/web_contents_delegate.h b/content/public/browser/web_contents_delegate.h
125- index d33274984bf6523beeb3ab5ee586499d224bff3c..83bdd195339eb7d61ac88e2994fd8dabe93f6ecc 100644
136+ index d33274984bf6523beeb3ab5ee586499d224bff3c..89c3f86bc828c5bf844bb103477c0772ba275dc5 100644
126137--- a/content/public/browser/web_contents_delegate.h
127138+++ b/content/public/browser/web_contents_delegate.h
128139@@ -18,6 +18,7 @@
@@ -133,7 +144,7 @@ index d33274984bf6523beeb3ab5ee586499d224bff3c..83bdd195339eb7d61ac88e2994fd8dab
133144 #include "content/public/browser/eye_dropper.h"
134145 #include "content/public/browser/fullscreen_types.h"
135146 #include "content/public/browser/invalidate_type.h"
136- @@ -380,6 +381,13 @@ class CONTENT_EXPORT WebContentsDelegate {
147+ @@ -380,6 +381,16 @@ class CONTENT_EXPORT WebContentsDelegate {
137148 const StoragePartitionConfig& partition_config,
138149 SessionStorageNamespace* session_storage_namespace);
139150
@@ -143,6 +154,9 @@ index d33274984bf6523beeb3ab5ee586499d224bff3c..83bdd195339eb7d61ac88e2994fd8dab
143154+ int opener_render_frame_id,
144155+ const mojom::CreateNewWindowParams& params,
145156+ WebContents* new_contents);
157+ +
158+ + virtual void MaybeOverrideCreateParamsForNewWindow(
159+ + content::WebContents::CreateParams* create_params) {}
146160+
147161 // Notifies the delegate about the creation of a new WebContents. This
148162 // typically happens when popups are created.
0 commit comments