Remove assumption that the parent AX tree is the desktop.

Currently we have a single root accessibility tree (the "desktop"
tree) containing all aura Windows and views in the browser process,
and all WebContents accessibility trees are direct children of that
tree.

Under multi-process mash, we're going to want it to be possible for a
remote app to host a WebContents, so we need to remove the assumption
that the parent accessibility tree of a WebContents must be the root
accessibility tree.

To do this, modify AutomationInternalCustomBindings::GetParent
so that it checks for any tree that lists the current tree as
its child tree, rather than only trying the desktop tree.
To make this efficient, have AutomationAXTreeWrapper keep track
of a map from child tree ID to its host.

This is reasonably well-covered by existing tests - if GetParent
doesn't work correctly, nearly all automation tests break.

Bug: 888147
Change-Id: Ib7350d51dffed345dd03ec11e6cc0b7591bb243c
Reviewed-on: https://chromium-review.googlesource.com/c/1286903
Commit-Queue: Dominic Mazzoni <[email protected]>
Reviewed-by: David Tseng <[email protected]>
Reviewed-by: James Cook <[email protected]>
Cr-Commit-Position: refs/heads/master@{#604729}
diff --git a/ui/accessibility/ax_tree.h b/ui/accessibility/ax_tree.h
index 991e9f5..fb8f2b74 100644
--- a/ui/accessibility/ax_tree.h
+++ b/ui/accessibility/ax_tree.h
@@ -227,6 +227,9 @@
   // have a kChildTreeId int attribute with that value.
   std::set<int32_t> GetNodeIdsForChildTreeId(AXTreeID child_tree_id) const;
 
+  // Get all of the child tree IDs referenced by any node in this tree.
+  const std::set<AXTreeID> GetAllChildTreeIds() const;
+
   // Map from a relation attribute to a map from a target id to source ids.
   const IntReverseRelationMap& int_reverse_relations() {
     return int_reverse_relations_;