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 <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 1761 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1772 AXContentTreeDataToAXTreeData(&dst_snapshot.tree_data); | 1772 AXContentTreeDataToAXTreeData(&dst_snapshot.tree_data); |
1773 dst_snapshot.has_tree_data = true; | 1773 dst_snapshot.has_tree_data = true; |
1774 } | 1774 } |
1775 it->second.Run(dst_snapshot); | 1775 it->second.Run(dst_snapshot); |
1776 ax_tree_snapshot_callbacks_.erase(it); | 1776 ax_tree_snapshot_callbacks_.erase(it); |
1777 } else { | 1777 } else { |
1778 NOTREACHED() << "Received AX tree snapshot response for unknown id"; | 1778 NOTREACHED() << "Received AX tree snapshot response for unknown id"; |
1779 } | 1779 } |
1780 } | 1780 } |
1781 | 1781 |
1782 // TODO(alexmos): When the allowFullscreen flag is known in the browser | |
1783 // process, use it to double-check that fullscreen can be entered here. | |
1784 void RenderFrameHostImpl::OnToggleFullscreen(bool enter_fullscreen) { | 1782 void RenderFrameHostImpl::OnToggleFullscreen(bool enter_fullscreen) { |
1785 // Entering fullscreen from a cross-process subframe also affects all | |
1786 // renderers for ancestor frames, which will need to apply fullscreen CSS to | |
1787 // appropriate ancestor <iframe> elements, fire fullscreenchange events, etc. | |
1788 // Thus, walk through the ancestor chain of this frame and for each (parent, | |
1789 // child) pair, send a message about the pending fullscreen change to the | |
1790 // child's proxy in parent's SiteInstance. The renderer process will use this | |
1791 // to find the <iframe> element in the parent frame that will need fullscreen | |
1792 // styles. This is done at most once per SiteInstance: for example, with a | |
1793 // A-B-A-B hierarchy, if the bottom frame goes fullscreen, this only needs to | |
1794 // notify its parent, and Blink-side logic will take care of applying | |
1795 // necessary changes to the other two ancestors. | |
1796 if (enter_fullscreen && | |
1797 SiteIsolationPolicy::AreCrossProcessFramesPossible()) { | |
1798 std::set<SiteInstance*> notified_instances; | |
1799 notified_instances.insert(GetSiteInstance()); | |
1800 for (FrameTreeNode* node = frame_tree_node_; node->parent(); | |
1801 node = node->parent()) { | |
1802 SiteInstance* parent_site_instance = | |
1803 node->parent()->current_frame_host()->GetSiteInstance(); | |
1804 if (ContainsKey(notified_instances, parent_site_instance)) | |
1805 continue; | |
1806 | |
1807 RenderFrameProxyHost* child_proxy = | |
1808 node->render_manager()->GetRenderFrameProxyHost(parent_site_instance); | |
1809 child_proxy->Send( | |
1810 new FrameMsg_WillEnterFullscreen(child_proxy->GetRoutingID())); | |
1811 notified_instances.insert(parent_site_instance); | |
1812 } | |
1813 } | |
1814 | |
1815 // TODO(alexmos): See if this can use the last committed origin instead. | |
1816 if (enter_fullscreen) | 1783 if (enter_fullscreen) |
1817 delegate_->EnterFullscreenMode(last_committed_url().GetOrigin()); | 1784 delegate_->EnterFullscreenMode(last_committed_url().GetOrigin()); |
1818 else | 1785 else |
1819 delegate_->ExitFullscreenMode(/* will_cause_resize */ true); | 1786 delegate_->ExitFullscreenMode(/* will_cause_resize */ true); |
1820 | 1787 |
1821 // The previous call might change the fullscreen state. We need to make sure | 1788 // The previous call might change the fullscreen state. We need to make sure |
1822 // the renderer is aware of that, which is done via the resize message. | 1789 // the renderer is aware of that, which is done via the resize message. |
1823 // Typically, this will be sent as part of the call on the |delegate_| above | |
1824 // when resizing the native windows, but sometimes fullscreen can be entered | |
1825 // without causing a resize, so we need to ensure that the resize message is | |
1826 // sent in that case. We always send this to the main frame's widget, and if | |
1827 // there are any OOPIF widgets, this will also trigger them to resize via | |
1828 // frameRectsChanged. | |
1829 render_view_host_->GetWidget()->WasResized(); | 1790 render_view_host_->GetWidget()->WasResized(); |
1830 } | 1791 } |
1831 | 1792 |
1832 void RenderFrameHostImpl::OnDidStartLoading(bool to_different_document) { | 1793 void RenderFrameHostImpl::OnDidStartLoading(bool to_different_document) { |
1833 if (IsBrowserSideNavigationEnabled() && to_different_document) { | 1794 if (IsBrowserSideNavigationEnabled() && to_different_document) { |
1834 bad_message::ReceivedBadMessage(GetProcess(), | 1795 bad_message::ReceivedBadMessage(GetProcess(), |
1835 bad_message::RFH_UNEXPECTED_LOAD_START); | 1796 bad_message::RFH_UNEXPECTED_LOAD_START); |
1836 return; | 1797 return; |
1837 } | 1798 } |
1838 bool was_previously_loading = frame_tree_node_->frame_tree()->IsLoading(); | 1799 bool was_previously_loading = frame_tree_node_->frame_tree()->IsLoading(); |
(...skipping 956 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2795 // handler after it's destroyed so it can't run after the RFHI is destroyed. | 2756 // handler after it's destroyed so it can't run after the RFHI is destroyed. |
2796 web_bluetooth_service_->SetClientConnectionErrorHandler(base::Bind( | 2757 web_bluetooth_service_->SetClientConnectionErrorHandler(base::Bind( |
2797 &RenderFrameHostImpl::DeleteWebBluetoothService, base::Unretained(this))); | 2758 &RenderFrameHostImpl::DeleteWebBluetoothService, base::Unretained(this))); |
2798 } | 2759 } |
2799 | 2760 |
2800 void RenderFrameHostImpl::DeleteWebBluetoothService() { | 2761 void RenderFrameHostImpl::DeleteWebBluetoothService() { |
2801 web_bluetooth_service_.reset(); | 2762 web_bluetooth_service_.reset(); |
2802 } | 2763 } |
2803 | 2764 |
2804 } // namespace content | 2765 } // namespace content |
OLD | NEW |