OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/browser/frame_host/render_frame_host_impl.h" | 5 #include "content/browser/frame_host/render_frame_host_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 3721 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3732 RenderFrameHostImpl* rfh = nullptr; | 3732 RenderFrameHostImpl* rfh = nullptr; |
3733 RenderFrameProxyHost* rfph = nullptr; | 3733 RenderFrameProxyHost* rfph = nullptr; |
3734 LookupRenderFrameHostOrProxy(GetProcess()->GetID(), routing_id, &rfh, &rfph); | 3734 LookupRenderFrameHostOrProxy(GetProcess()->GetID(), routing_id, &rfh, &rfph); |
3735 if (rfph) { | 3735 if (rfph) { |
3736 rfh = rfph->frame_tree_node()->current_frame_host(); | 3736 rfh = rfph->frame_tree_node()->current_frame_host(); |
3737 } | 3737 } |
3738 | 3738 |
3739 if (!rfh) | 3739 if (!rfh) |
3740 return ui::AXTreeIDRegistry::kNoAXTreeID; | 3740 return ui::AXTreeIDRegistry::kNoAXTreeID; |
3741 | 3741 |
3742 // As a sanity check, make sure we're within the same frame tree and | |
3743 // crash the renderer if not. | |
3744 if (rfh->frame_tree_node()->frame_tree() != frame_tree_node()->frame_tree()) { | |
3745 AccessibilityFatalError(); | |
3746 return ui::AXTreeIDRegistry::kNoAXTreeID; | |
3747 } | |
3748 | |
3749 return rfh->GetAXTreeID(); | 3742 return rfh->GetAXTreeID(); |
3750 } | 3743 } |
3751 | 3744 |
3752 ui::AXTreeIDRegistry::AXTreeID | 3745 ui::AXTreeIDRegistry::AXTreeID |
3753 RenderFrameHostImpl::BrowserPluginInstanceIDToAXTreeID(int instance_id) { | 3746 RenderFrameHostImpl::BrowserPluginInstanceIDToAXTreeID(int instance_id) { |
3754 RenderFrameHostImpl* guest = static_cast<RenderFrameHostImpl*>( | 3747 RenderFrameHostImpl* guest = static_cast<RenderFrameHostImpl*>( |
3755 delegate()->GetGuestByInstanceID(this, instance_id)); | 3748 delegate()->GetGuestByInstanceID(this, instance_id)); |
3756 if (!guest) | 3749 if (!guest) |
3757 return ui::AXTreeIDRegistry::kNoAXTreeID; | 3750 return ui::AXTreeIDRegistry::kNoAXTreeID; |
3758 | 3751 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3806 dst->parent_tree_id = RoutingIDToAXTreeID(src.parent_routing_id); | 3799 dst->parent_tree_id = RoutingIDToAXTreeID(src.parent_routing_id); |
3807 | 3800 |
3808 if (browser_plugin_embedder_ax_tree_id_ != ui::AXTreeIDRegistry::kNoAXTreeID) | 3801 if (browser_plugin_embedder_ax_tree_id_ != ui::AXTreeIDRegistry::kNoAXTreeID) |
3809 dst->parent_tree_id = browser_plugin_embedder_ax_tree_id_; | 3802 dst->parent_tree_id = browser_plugin_embedder_ax_tree_id_; |
3810 | 3803 |
3811 // If this is not the root frame tree node, we're done. | 3804 // If this is not the root frame tree node, we're done. |
3812 if (frame_tree_node()->parent()) | 3805 if (frame_tree_node()->parent()) |
3813 return; | 3806 return; |
3814 | 3807 |
3815 // For the root frame tree node, also store the AXTreeID of the focused frame. | 3808 // For the root frame tree node, also store the AXTreeID of the focused frame. |
3816 // TODO(avallee): https://crbug.com/610795: No focus ax events. | 3809 auto* focused_frame = static_cast<RenderFrameHostImpl*>( |
3817 // This is probably where we need to fix the bug to enable the test. | 3810 delegate_->GetFocusedFrameIncludingInnerWebContents()); |
3818 FrameTreeNode* focused_frame_tree_node = frame_tree_->GetFocusedFrame(); | 3811 if (!focused_frame) |
3819 if (!focused_frame_tree_node) | |
3820 return; | 3812 return; |
3821 RenderFrameHostImpl* focused_frame = | |
3822 focused_frame_tree_node->current_frame_host(); | |
3823 DCHECK(focused_frame); | |
3824 dst->focused_tree_id = focused_frame->GetAXTreeID(); | 3813 dst->focused_tree_id = focused_frame->GetAXTreeID(); |
3825 } | 3814 } |
3826 | 3815 |
3827 WebBluetoothServiceImpl* RenderFrameHostImpl::CreateWebBluetoothService( | 3816 WebBluetoothServiceImpl* RenderFrameHostImpl::CreateWebBluetoothService( |
3828 const service_manager::BindSourceInfo& source_info, | 3817 const service_manager::BindSourceInfo& source_info, |
3829 blink::mojom::WebBluetoothServiceRequest request) { | 3818 blink::mojom::WebBluetoothServiceRequest request) { |
3830 // RFHI owns |web_bluetooth_services_| and |web_bluetooth_service| owns the | 3819 // RFHI owns |web_bluetooth_services_| and |web_bluetooth_service| owns the |
3831 // |binding_| which may run the error handler. |binding_| can't run the error | 3820 // |binding_| which may run the error handler. |binding_| can't run the error |
3832 // handler after it's destroyed so it can't run after the RFHI is destroyed. | 3821 // handler after it's destroyed so it can't run after the RFHI is destroyed. |
3833 auto web_bluetooth_service = | 3822 auto web_bluetooth_service = |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4108 } | 4097 } |
4109 | 4098 |
4110 void RenderFrameHostImpl::ForwardGetInterfaceToRenderFrame( | 4099 void RenderFrameHostImpl::ForwardGetInterfaceToRenderFrame( |
4111 const std::string& interface_name, | 4100 const std::string& interface_name, |
4112 mojo::ScopedMessagePipeHandle pipe) { | 4101 mojo::ScopedMessagePipeHandle pipe) { |
4113 GetRemoteInterfaces()->GetInterface(interface_name, std::move(pipe)); | 4102 GetRemoteInterfaces()->GetInterface(interface_name, std::move(pipe)); |
4114 } | 4103 } |
4115 #endif | 4104 #endif |
4116 | 4105 |
4117 } // namespace content | 4106 } // namespace content |
OLD | NEW |