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

Unified Diff: content/browser/frame_host/frame_accessibility.cc

Issue 799633007: Make Windows accessibility event firing aware of guest / child frames. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@webview_fixes
Patch Set: Fix Mac compile Created 5 years, 11 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/frame_host/frame_accessibility.cc
diff --git a/content/browser/frame_host/frame_accessibility.cc b/content/browser/frame_host/frame_accessibility.cc
index aa2c32667bfd4d184965dbf6233220380aa26792..c0e86b29dce12ea6782f7d1f2a5369c1c2103150 100644
--- a/content/browser/frame_host/frame_accessibility.cc
+++ b/content/browser/frame_host/frame_accessibility.cc
@@ -18,7 +18,7 @@ FrameAccessibility* FrameAccessibility::GetInstance() {
}
FrameAccessibility::ChildFrameMapping::ChildFrameMapping()
- : parent_frame_host(NULL),
+ : parent_frame_host(nullptr),
accessibility_node_id(0),
child_frame_tree_node_id(0),
browser_plugin_instance_id(0) {}
@@ -105,19 +105,8 @@ RenderFrameHostImpl* FrameAccessibility::GetChild(
}
if (iter->child_frame_tree_node_id) {
- FrameTreeNode* child_node =
- FrameTree::GloballyFindByID(iter->child_frame_tree_node_id);
- if (!child_node)
- return NULL;
-
- // We should have gotten a node in the same frame tree.
- if (child_node->frame_tree() !=
- parent_frame_host->frame_tree_node()->frame_tree()) {
- NOTREACHED();
- return NULL;
- }
-
- return child_node->current_frame_host();
+ return GetRFHIFromFrameTreeNodeId(
+ parent_frame_host, iter->child_frame_tree_node_id);
}
if (iter->browser_plugin_instance_id) {
@@ -129,7 +118,35 @@ RenderFrameHostImpl* FrameAccessibility::GetChild(
}
}
- return NULL;
+ return nullptr;
+}
+
+void FrameAccessibility::GetAllChildFrames(
+ RenderFrameHostImpl* parent_frame_host,
+ std::vector<RenderFrameHostImpl*>* child_frame_hosts) {
+ CHECK(child_frame_hosts);
+
+ for (std::vector<ChildFrameMapping>::iterator iter = mappings_.begin();
+ iter != mappings_.end();
+ ++iter) {
+ if (iter->parent_frame_host != parent_frame_host)
+ continue;
+
+ if (iter->child_frame_tree_node_id) {
+ RenderFrameHostImpl* child_frame_host = GetRFHIFromFrameTreeNodeId(
+ parent_frame_host, iter->child_frame_tree_node_id);
+ if (child_frame_host)
+ child_frame_hosts->push_back(child_frame_host);
+ }
+
+ if (iter->browser_plugin_instance_id) {
+ RenderFrameHost* guest =
+ parent_frame_host->delegate()->GetGuestByInstanceID(
+ iter->browser_plugin_instance_id);
+ if (guest)
+ child_frame_hosts->push_back(static_cast<RenderFrameHostImpl*>(guest));
+ }
+ }
}
bool FrameAccessibility::GetParent(
@@ -144,9 +161,9 @@ bool FrameAccessibility::GetParent(
FrameTree::GloballyFindByID(iter->child_frame_tree_node_id);
if (child_node &&
child_node->current_frame_host() == child_frame_host) {
- // We should have gotten a node in the same frame tree.
- if (child_node->frame_tree() !=
- iter->parent_frame_host->frame_tree_node()->frame_tree()) {
+ // We should have gotten a *direct* child of the parent frame.
+ if (child_node->parent() !=
+ iter->parent_frame_host->frame_tree_node()) {
NOTREACHED();
return false;
}
@@ -176,4 +193,21 @@ bool FrameAccessibility::GetParent(
return false;
}
+RenderFrameHostImpl* FrameAccessibility::GetRFHIFromFrameTreeNodeId(
+ RenderFrameHostImpl* parent_frame_host,
+ int64 child_frame_tree_node_id) {
+ FrameTreeNode* child_node =
+ FrameTree::GloballyFindByID(child_frame_tree_node_id);
+ if (!child_node)
+ return nullptr;
+
+ // We should have gotten a *direct* child of the parent frame.
+ if (child_node->parent() != parent_frame_host->frame_tree_node()) {
+ NOTREACHED();
+ return nullptr;
+ }
+
+ return child_node->current_frame_host();
+}
+
} // namespace content
« no previous file with comments | « content/browser/frame_host/frame_accessibility.h ('k') | content/browser/frame_host/render_frame_host_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698