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 f70b5808da311d3ae0d0c68be53834ef2c510cc6..8a8b2b341bef97032528238e5b2a2ff8c72ad200 100644 |
| --- a/content/browser/frame_host/render_frame_host_impl.cc |
| +++ b/content/browser/frame_host/render_frame_host_impl.cc |
| @@ -452,23 +452,27 @@ BrowserAccessibilityManager* RenderFrameHostImpl::AccessibilityGetChildFrame( |
| int accessibility_node_id) { |
| RenderFrameHostImpl* child_frame = |
| FrameAccessibility::GetInstance()->GetChild(this, accessibility_node_id); |
| - if (!child_frame) |
| - return NULL; |
| + if (!child_frame || IsSameSiteInstance(child_frame)) |
| + return nullptr; |
| - // Return NULL if this isn't an out-of-process iframe. Same-process iframes |
| - // are already part of the accessibility tree. |
| - if (child_frame->GetProcess()->GetID() == GetProcess()->GetID()) |
| - return NULL; |
| + return child_frame->GetOrCreateBrowserAccessibilityManager(); |
| +} |
| - // As a sanity check, make sure the frame we're going to return belongs |
| - // to the same BrowserContext. |
| - if (GetSiteInstance()->GetBrowserContext() != |
| - child_frame->GetSiteInstance()->GetBrowserContext()) { |
| - NOTREACHED(); |
| - return NULL; |
| - } |
| +void RenderFrameHostImpl::AccessibilityGetAllChildFrames( |
| + std::vector<BrowserAccessibilityManager*>* child_frames) { |
| + std::vector<RenderFrameHostImpl*> child_frame_hosts; |
| + FrameAccessibility::GetInstance()->GetAllChildFrames( |
| + this, &child_frame_hosts); |
| + for (size_t i = 0; i < child_frame_hosts.size(); ++i) { |
| + RenderFrameHostImpl* child_frame_host = child_frame_hosts[i]; |
| + if (!child_frame_host || IsSameSiteInstance(child_frame_host)) |
| + continue; |
| - return child_frame->GetOrCreateBrowserAccessibilityManager(); |
| + BrowserAccessibilityManager* manager = |
| + child_frame_host->GetOrCreateBrowserAccessibilityManager(); |
| + if (manager) |
| + child_frames->push_back(manager); |
| + } |
| } |
| BrowserAccessibility* RenderFrameHostImpl::AccessibilityGetParentFrame() { |
| @@ -1477,6 +1481,13 @@ void RenderFrameHostImpl::UpdateGuestFrameAccessibility( |
| } |
| } |
| +bool RenderFrameHostImpl::IsSameSiteInstance(RenderFrameHostImpl* child_frame) { |
|
nasko
2015/01/16 00:20:33
nit: s/child_frame/render_frame_host/
Nothing in
dmazzoni
2015/01/16 17:44:56
Done.
|
| + // As a sanity check, make sure the frame belongs to the same BrowserContext. |
| + CHECK_EQ(GetSiteInstance()->GetBrowserContext(), |
| + child_frame->GetSiteInstance()->GetBrowserContext()); |
| + return GetSiteInstance() == child_frame->GetSiteInstance(); |
| +} |
| + |
| void RenderFrameHostImpl::SetAccessibilityMode(AccessibilityMode mode) { |
| Send(new FrameMsg_SetAccessibilityMode(routing_id_, mode)); |
| } |