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

Unified Diff: content/browser/web_contents/web_contents_impl.cc

Issue 2666193002: Switch RenderViewContextMenu to use RequestOpenURL (Closed)
Patch Set: cleanup Created 3 years, 10 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 side-by-side diff with in-line comments
Download patch
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 30cc8989e92062def7bacd32f14c6e30c5107a27..4d4151f7551b49260a4a1a4421961956acfb8538 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -2573,6 +2573,19 @@ WebContents* WebContentsImpl::OpenURL(const OpenURLParams& params) {
return NULL;
WebContents* new_contents = delegate_->OpenURLFromTab(this, params);
+
+ RenderFrameHost* render_frame_host =
+ RenderFrameHost::FromID(params.process_id, params.frame_id);
+
+ if (new_contents && new_contents != this) {
nasko 2017/02/14 00:10:23 The old code included a null check for the render_
Patrick Noland 2017/02/14 01:16:16 Done.
+ for (auto& observer : observers_) {
+ observer.DidOpenRequestedURL(new_contents, render_frame_host, params.url,
+ params.referrer, params.disposition,
+ params.transition,
+ params.started_from_context_menu);
+ }
+ }
+
return new_contents;
}
@@ -3380,25 +3393,6 @@ void WebContentsImpl::DidStartNavigationToPendingEntry(const GURL& url,
observer.DidStartNavigationToPendingEntry(url, reload_type);
}
-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);
- }
- }
-}
-
bool WebContentsImpl::ShouldTransferNavigation(bool is_main_frame_navigation) {
if (!delegate_)
return true;

Powered by Google App Engine
This is Rietveld 408576698