Index: content/browser/frame_host/render_frame_host_impl.cc |
diff --git a/content/browser/frame_host/render_frame_host_impl.cc b/content/browser/frame_host/render_frame_host_impl.cc |
index b5bff3e090b91b9dc9e3688500c6ab83234cc43b..418020e9c8cdc9d990c14eb4ce5701ae78cb6430 100644 |
--- a/content/browser/frame_host/render_frame_host_impl.cc |
+++ b/content/browser/frame_host/render_frame_host_impl.cc |
@@ -17,6 +17,7 @@ |
#include "content/browser/child_process_security_policy_impl.h" |
#include "content/browser/frame_host/cross_process_frame_connector.h" |
#include "content/browser/frame_host/cross_site_transferring_request.h" |
+#include "content/browser/frame_host/frame_accessibility.h" |
#include "content/browser/frame_host/frame_tree.h" |
#include "content/browser/frame_host/frame_tree_node.h" |
#include "content/browser/frame_host/navigator.h" |
@@ -42,6 +43,8 @@ |
#include "content/common/swapped_out_messages.h" |
#include "content/public/browser/ax_event_notification_details.h" |
#include "content/public/browser/browser_accessibility_state.h" |
+#include "content/public/browser/browser_context.h" |
+#include "content/public/browser/browser_plugin_guest_manager.h" |
#include "content/public/browser/browser_thread.h" |
#include "content/public/browser/content_browser_client.h" |
#include "content/public/browser/desktop_notification_delegate.h" |
@@ -203,6 +206,8 @@ RenderFrameHostImpl::~RenderFrameHostImpl() { |
if (delegate_) |
delegate_->RenderFrameDeleted(this); |
+ FrameAccessibility::GetInstance()->OnRenderFrameHostDestroyed(this); |
+ |
// Notify the FrameTree that this RFH is going away, allowing it to shut down |
// the corresponding RenderViewHost if it is no longer needed. |
frame_tree_->UnregisterRenderFrameHost(this); |
@@ -473,35 +478,52 @@ gfx::NativeViewAccessible |
} |
BrowserAccessibilityManager* RenderFrameHostImpl::AccessibilityGetChildFrame( |
- int64 frame_tree_node_id) { |
- FrameTreeNode* child_node = FrameTree::GloballyFindByID(frame_tree_node_id); |
- if (!child_node) |
+ int accessibility_node_id) { |
+ RenderFrameHostImpl* child_frame = |
+ FrameAccessibility::GetInstance()->GetChild(this, accessibility_node_id); |
+ if (!child_frame) |
return NULL; |
- // We should have gotten a node in the same frame tree. |
- CHECK(child_node->frame_tree() == frame_tree_node()->frame_tree()); |
- |
- RenderFrameHostImpl* child_rfhi = child_node->current_frame_host(); |
- |
// Return NULL if this isn't an out-of-process iframe. Same-process iframes |
// are already part of the accessibility tree. |
- if (child_rfhi->GetProcess()->GetID() == GetProcess()->GetID()) |
+ if (child_frame->GetProcess()->GetID() == GetProcess()->GetID()) |
return NULL; |
- return child_rfhi->GetOrCreateBrowserAccessibilityManager(); |
+ // As a sanity check, make sure the frame we're going to return belongs |
+ // to the same BrowserContext. |
+ DCHECK_EQ(GetSiteInstance()->GetBrowserContext(), |
+ child_frame->GetSiteInstance()->GetBrowserContext()); |
+ if (GetSiteInstance()->GetBrowserContext() != |
+ child_frame->GetSiteInstance()->GetBrowserContext()) { |
+ return NULL; |
Charlie Reis
2014/09/12 21:01:58
DCHECK -> NOTREACHED
(same below)
dmazzoni
2014/09/15 17:55:23
Done.
|
+ } |
+ |
+ return child_frame->GetOrCreateBrowserAccessibilityManager(); |
} |
-BrowserAccessibilityManager* |
-RenderFrameHostImpl::AccessibilityGetParentFrame() { |
- FrameTreeNode* parent_node = frame_tree_node()->parent(); |
- if (!parent_node) |
+BrowserAccessibility* RenderFrameHostImpl::AccessibilityGetParentFrame() { |
+ RenderFrameHostImpl* parent_frame = NULL; |
+ int parent_node_id = 0; |
+ if (!FrameAccessibility::GetInstance()->GetParent( |
+ this, &parent_frame, &parent_node_id)) { |
return NULL; |
+ } |
- RenderFrameHostImpl* parent_frame = parent_node->current_frame_host(); |
- if (!parent_frame) |
+ // As a sanity check, make sure the frame we're going to return belongs |
+ // to the same BrowserContext. |
+ DCHECK_EQ(GetSiteInstance()->GetBrowserContext(), |
+ parent_frame->GetSiteInstance()->GetBrowserContext()); |
+ if (GetSiteInstance()->GetBrowserContext() != |
+ parent_frame->GetSiteInstance()->GetBrowserContext()) { |
+ return NULL; |
+ } |
+ |
+ BrowserAccessibilityManager* manager = |
+ parent_frame->browser_accessibility_manager(); |
+ if (!manager) |
return NULL; |
- return parent_frame->GetOrCreateBrowserAccessibilityManager(); |
+ return manager->GetFromID(parent_node_id); |
} |
bool RenderFrameHostImpl::CreateRenderFrame(int parent_routing_id) { |
@@ -1012,9 +1034,9 @@ void RenderFrameHostImpl::OnAccessibilityEvents( |
} |
if (browser_accessibility_manager_) { |
- // Get the frame routing ids from out-of-process iframes and use them |
- // to notify our BrowserAccessibilityManager of the frame tree node id of |
- // any of its child frames. |
+ // Get the frame routing ids from out-of-process iframes and |
+ // browser plugin instance ids from guests and update the mappings in |
+ // FrameAccessibility. |
for (unsigned int i = 0; i < params.size(); ++i) { |
const AccessibilityHostMsg_EventParams& param = params[i]; |
std::map<int32, int>::const_iterator iter; |
@@ -1030,10 +1052,22 @@ void RenderFrameHostImpl::OnAccessibilityEvents( |
FrameTreeNode* child_frame_tree_node = frame_tree->FindByRoutingID( |
GetProcess()->GetID(), frame_routing_id); |
if (child_frame_tree_node) { |
- browser_accessibility_manager_->SetChildFrameTreeNodeId( |
- node_id, child_frame_tree_node->frame_tree_node_id()); |
+ FrameAccessibility::GetInstance()->AddChildFrame( |
+ this, node_id, child_frame_tree_node->frame_tree_node_id()); |
} |
} |
+ |
+ for (iter = param.node_to_browser_plugin_instance_id_map.begin(); |
nasko
2014/09/12 20:43:26
Can one message contain both a browser plugin and
dmazzoni
2014/09/15 17:55:23
Yes - one message can contain a whole DOM tree, wh
|
+ iter != param.node_to_browser_plugin_instance_id_map.end(); |
+ ++iter) { |
+ // This is the id of the accessibility node that hosts a plugin. |
+ int32 node_id = iter->first; |
+ // The id of the browser plugin. |
+ int browser_plugin_instance_id = iter->second; |
+ |
+ FrameAccessibility::GetInstance()->AddGuestWebContents( |
+ this, node_id, browser_plugin_instance_id); |
+ } |
} |
} |