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

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: 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..a78caa83baab66b469a614c99dc36973aa336984 100644
--- a/content/browser/frame_host/frame_accessibility.cc
+++ b/content/browser/frame_host/frame_accessibility.cc
@@ -105,19 +105,9 @@ 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 GetRFHIFromFrameTreeNodeId(
+ parent_frame_host, iter->child_frame_tree_node_id);
- return child_node->current_frame_host();
}
if (iter->browser_plugin_instance_id) {
@@ -132,6 +122,34 @@ RenderFrameHostImpl* FrameAccessibility::GetChild(
return NULL;
}
+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(
RenderFrameHostImpl* child_frame_host,
RenderFrameHostImpl** out_parent_frame_host,
@@ -176,4 +194,22 @@ 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 NULL;
nasko 2015/01/15 21:44:38 s/NULL/nullptr/
dmazzoni 2015/01/15 23:09:22 Done.
+
+ // 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;
nasko 2015/01/15 21:44:38 s/NULL/nullptr/
dmazzoni 2015/01/15 23:09:22 Done.
+ }
+
+ return child_node->current_frame_host();
nasko 2015/01/15 21:44:38 There is no verification that the frame found is a
dmazzoni 2015/01/15 23:09:22 True. Note that this is not new logic, I just refa
nasko 2015/01/16 00:20:33 Yeah, I saw it is just moved, but it is useful to
+}
+
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698