Don't show status bar updates from originating renderer when fullscreen

In fullscreen mode WebContents has two renderviews. One for the
fullscreen display, and one for the originating page. It's entirely
possible that the renderer from the originating page tries to update
the status bar url. This seems to mostly occur because we can delay mouse
events so that when transitioning to fullscreen we can end up sending
a mouse event to the originating renderer after we're fullscreen,
which can result in the originating page trying to update the target
url of the status bar.

When fullscreen we should only care about updates from the fullscreen
renderer.

[email protected]
BUG=380005
TEST=see bug

Review URL: https://codereview.chromium.org/811523005

Cr-Commit-Position: refs/heads/master@{#310915}
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
index 0326fe5..f9ba939 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -2593,6 +2593,7 @@
 }
 
 void WebContentsImpl::DidNavigateMainFramePostCommit(
+    RenderFrameHostImpl* render_frame_host,
     const LoadCommittedDetails& details,
     const FrameHostMsg_DidCommitProvisionalLoad_Params& params) {
   if (details.is_navigation_to_different_page()) {
@@ -2602,7 +2603,7 @@
     // clicking on a link); see bugs 1184641 and 980803. We don't want to
     // clear the bubble when a user navigates to a named anchor in the same
     // page.
-    UpdateTargetURL(GURL());
+    UpdateTargetURL(render_frame_host->GetRenderViewHost(), GURL());
   }
 
   if (!details.is_in_page) {
@@ -3670,7 +3671,15 @@
   controller_.NotifyEntryChanged(entry, entry_index);
 }
 
-void WebContentsImpl::UpdateTargetURL(const GURL& url) {
+void WebContentsImpl::UpdateTargetURL(RenderViewHost* render_view_host,
+                                      const GURL& url) {
+  if (fullscreen_widget_routing_id_ != MSG_ROUTING_NONE) {
+    // If we're fullscreen only update the url if it's from the fullscreen
+    // renderer.
+    RenderWidgetHostView* fs = GetFullscreenRenderWidgetHostView();
+    if (fs && fs->GetRenderWidgetHost() != render_view_host)
+      return;
+  }
   if (delegate_)
     delegate_->UpdateTargetURL(this, url);
 }