Chromium Code Reviews| 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 e4b677af3d5a0d7741cc011036a18221d595b919..cd4059344cb5857ea39f24d29651d167eea7e368 100644 |
| --- a/content/browser/frame_host/render_frame_host_impl.cc |
| +++ b/content/browser/frame_host/render_frame_host_impl.cc |
| @@ -19,6 +19,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" |
| @@ -44,6 +45,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" |
| @@ -208,6 +211,8 @@ RenderFrameHostImpl::~RenderFrameHostImpl() { |
| // 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); |
| + |
| + FrameAccessibility::GetInstance()->OnRenderFrameHostDestroyed(this); |
|
Charlie Reis
2014/09/11 21:46:21
This is a bit more related to the delegate notific
dmazzoni
2014/09/12 07:34:34
Done.
|
| } |
| int RenderFrameHostImpl::GetRoutingID() { |
| @@ -475,35 +480,34 @@ 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(); |
| + 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) |
| + 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) { |
| @@ -1034,9 +1038,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; |
| @@ -1052,10 +1056,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(); |
| + 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); |
| + } |
| } |
| } |