| Index: content/browser/web_contents/web_contents_impl.cc
|
| diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
|
| index e87e18dcaf6b5cd568197c03a428487ed61f9395..028e0eb54479963bd88d031e6a995a4f6a5b2786 100644
|
| --- a/content/browser/web_contents/web_contents_impl.cc
|
| +++ b/content/browser/web_contents/web_contents_impl.cc
|
| @@ -575,6 +575,11 @@ WebContentsImpl* WebContentsImpl::CreateWithOpener(
|
| const WebContents::CreateParams& params,
|
| FrameTreeNode* opener) {
|
| TRACE_EVENT0("browser", "WebContentsImpl::CreateWithOpener");
|
| + LOG(ERROR) << "WCI::CreateWithOpener: "
|
| + << " source_wc:" << params.source_web_contents
|
| + << " opener:" << opener
|
| + << " disposition:" << (int) params.disposition
|
| + << " context_menu:" << params.created_from_context_menu;
|
| WebContentsImpl* new_contents = new WebContentsImpl(params.browser_context);
|
|
|
| FrameTreeNode* new_root = new_contents->GetFrameTree()->root();
|
| @@ -613,6 +618,25 @@ WebContentsImpl* WebContentsImpl::CreateWithOpener(
|
| new_contents->is_subframe_ = true;
|
| }
|
| new_contents->Init(params);
|
| +
|
| + if (params.source_web_contents &&
|
| + (params.created_from_context_menu || opener)) {
|
| + LOG(ERROR) << "WCI::CreateWithOpener: "
|
| + << " dispatching notification";
|
| + WebContentsImpl* opener_contents =
|
| + static_cast<WebContentsImpl*>(params.source_web_contents);
|
| + RenderFrameHost* opener_rfh = RenderFrameHost::FromID(
|
| + params.opener_render_process_id, params.opener_render_frame_id);
|
| + for (auto& observer : opener_contents->observers_) {
|
| + observer.DidOpenRequestedURL(new_contents,
|
| + opener_rfh ? opener_rfh
|
| + : opener_contents->GetMainFrame(),
|
| + params.target_url,
|
| + params.referrer,
|
| + params.disposition, params.transition);
|
| + }
|
| + }
|
| +
|
| return new_contents;
|
| }
|
|
|
| @@ -2056,6 +2080,13 @@ void WebContentsImpl::CreateNewWindow(
|
| create_params.renderer_initiated_creation =
|
| main_frame_route_id != MSG_ROUTING_NONE;
|
|
|
| + create_params.source_web_contents = this;
|
| + create_params.target_url = params.target_url;
|
| + create_params.disposition = params.disposition;
|
| + create_params.referrer = params.referrer;
|
| + // TODO(nasko): Check what page transition is needed.
|
| + create_params.transition = ui::PAGE_TRANSITION_LINK;
|
| +
|
| WebContentsImpl* new_contents = NULL;
|
| if (!is_guest) {
|
| create_params.context = view_->GetNativeView();
|
| @@ -3295,21 +3326,7 @@ void WebContentsImpl::DidStartNavigationToPendingEntry(const GURL& url,
|
|
|
| void WebContentsImpl::RequestOpenURL(RenderFrameHostImpl* render_frame_host,
|
| const OpenURLParams& params) {
|
| - // OpenURL can blow away the source RFH. Use the process/frame routing ID as a
|
| - // weak pointer of sorts.
|
| - const int32_t process_id = render_frame_host->GetProcess()->GetID();
|
| - const int32_t frame_id = render_frame_host->GetRoutingID();
|
| -
|
| - WebContents* new_contents = OpenURL(params);
|
| -
|
| - if (new_contents && RenderFrameHost::FromID(process_id, frame_id)) {
|
| - // Notify observers.
|
| - for (auto& observer : observers_) {
|
| - observer.DidOpenRequestedURL(new_contents, render_frame_host, params.url,
|
| - params.referrer, params.disposition,
|
| - params.transition);
|
| - }
|
| - }
|
| + OpenURL(params);
|
| }
|
|
|
| bool WebContentsImpl::ShouldTransferNavigation(bool is_main_frame_navigation) {
|
|
|