Use EmbeddingTokens as the "backing store" for AXTreeIDs

This allows us to remove the translation between routingIDs and
AXTreeIDs in RenderFrameHostImpl, as well as to remove completely
AXContentNodeData and AXContentTreeUpdate due to no longer needing
to pass routing IDs between the renderer and the browser process.

A side effect of this CL, though, is that it is now necessary that
the HTMLFrameOwnerElement that hosts the frame tree for an inner
WebContents (e.g. a <webview> or a portal) has the EmbeddingToken
of the main frame it is embedding set, as it already happens for
both same-site and cross-site iframes. For this reason, this CL
also adds a small change in RFHI::SetEmbeddingToken() in order to
make sure that the EmbeddingToken of a local main frame of an inner
WebContents gets properly propagated to the owner element in the
parent outer WebContents.

Additionally, this CL adds a helper method GetEmbeddingToken()
to Blink's Element and WebElement classes which allows retrieving
the EmbeddingToken out of an Element if it's set in a clean way,
something that is only the case for HTMLFrameOwnerElement for now.

Bug: 1094150
Change-Id: I25e5fbad934487602136136c02ebc1ef05b14755
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2270065
Commit-Queue: Mario Sanchez Prada <[email protected]>
Reviewed-by: Scott Violet <[email protected]>
Reviewed-by: Kinuko Yasuda <[email protected]>
Reviewed-by: Dominic Mazzoni <[email protected]>
Reviewed-by: Aaron Colwell <[email protected]>
Reviewed-by: Kentaro Hara <[email protected]>
Cr-Commit-Position: refs/heads/master@{#789091}
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
index 4d998b08..76746d8 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -3444,6 +3444,16 @@
   return accessibility_mode_;
 }
 
+void WebContentsImpl::AXTreeIDForMainFrameHasChanged() {
+  RenderWidgetHostViewBase* rwhv =
+      static_cast<RenderWidgetHostViewBase*>(GetRenderWidgetHostView());
+  if (rwhv)
+    rwhv->SetMainFrameAXTreeID(GetMainFrame()->GetAXTreeID());
+
+  for (auto& observer : observers_)
+    observer.AXTreeIDForMainFrameHasChanged();
+}
+
 void WebContentsImpl::AccessibilityEventReceived(
     const AXEventNotificationDetails& details) {
   for (auto& observer : observers_)