Remove RenderWidgetHostDelegate::ReplicatePageFocus.

Don't go through WebContents to replicate the page focus. This can
be done directly from the RenderWidgetHostImpl accessing the FrameTree
directly.

BUG=1237111

Change-Id: I790f508971918b3ffcc8a590326253b28f34acfe
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3075661
Commit-Queue: Dave Tapuska <[email protected]>
Reviewed-by: Alexander Timin <[email protected]>
Cr-Commit-Position: refs/heads/master@{#909321}
diff --git a/content/browser/renderer_host/frame_tree.cc b/content/browser/renderer_host/frame_tree.cc
index 4a75ba4..e9ba9287 100644
--- a/content/browser/renderer_host/frame_tree.cc
+++ b/content/browser/renderer_host/frame_tree.cc
@@ -574,6 +574,11 @@
 }
 
 void FrameTree::ReplicatePageFocus(bool is_focused) {
+  // Focus loss may occur while this FrameTree is being destroyed.  Don't
+  // send the message in this case, as the main frame's RenderFrameHost and
+  // other state has already been cleared.
+  if (is_being_destroyed_)
+    return;
   std::set<SiteInstance*> frame_tree_site_instances =
       CollectSiteInstances(this);