Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(74)

Side by Side Diff: content/browser/frame_host/render_frame_host_impl.cc

Issue 1914643005: Add support for entering/exiting HTML fullscreen from OOPIFs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 1769 matching lines...) Expand 10 before | Expand all | Expand 10 after
1780 AXContentTreeDataToAXTreeData(&dst_snapshot.tree_data); 1780 AXContentTreeDataToAXTreeData(&dst_snapshot.tree_data);
1781 dst_snapshot.has_tree_data = true; 1781 dst_snapshot.has_tree_data = true;
1782 } 1782 }
1783 it->second.Run(dst_snapshot); 1783 it->second.Run(dst_snapshot);
1784 ax_tree_snapshot_callbacks_.erase(it); 1784 ax_tree_snapshot_callbacks_.erase(it);
1785 } else { 1785 } else {
1786 NOTREACHED() << "Received AX tree snapshot response for unknown id"; 1786 NOTREACHED() << "Received AX tree snapshot response for unknown id";
1787 } 1787 }
1788 } 1788 }
1789 1789
1790 // TODO(alexmos): When the allowFullscreen flag is known in the browser
1791 // process, use it to double-check that fullscreen can be entered here.
1790 void RenderFrameHostImpl::OnToggleFullscreen(bool enter_fullscreen) { 1792 void RenderFrameHostImpl::OnToggleFullscreen(bool enter_fullscreen) {
1793 // Entering fullscreen from a cross-process subframe also affects all
1794 // renderers for ancestor frames, which will need to apply fullscreen CSS to
1795 // appropriate ancestor <iframe> elements, fire fullscreenchange events, etc.
1796 // Thus, walk through the ancestor chain of this frame and send a message
1797 // about the pending fullscreen change, providing the routing ID of the
1798 // remote child frame that contains the fullscreened element. The renderer
Charlie Reis 2016/05/12 22:59:23 nit: renderer process
alexmos 2016/05/13 07:21:03 Done.
1799 // will use this to find the <iframe> element that will need fullscreen
1800 // styles. This is done at most once per SiteInstance: for example, with a
1801 // A-B-A-B hierarchy, if the bottom frame goes fullscreen, this only needs to
1802 // notify its parent, and Blink-side logic will take care of applying
1803 // necessary changes to the other two ancestors.
alexmos 2016/05/10 21:36:24 I considered whether this should be per-widget or
Charlie Reis 2016/05/12 22:59:23 Acknowledged.
1804 if (enter_fullscreen &&
1805 SiteIsolationPolicy::AreCrossProcessFramesPossible()) {
1806 std::set<SiteInstance*> notified_instances;
1807 notified_instances.insert(GetSiteInstance());
1808 for (FrameTreeNode* node = frame_tree_node_; node->parent();
1809 node = node->parent()) {
1810 RenderFrameHostImpl* parent_rfh = node->parent()->current_frame_host();
1811 if (ContainsKey(notified_instances, parent_rfh->GetSiteInstance()))
1812 continue;
1813
1814 int child_routing_id =
1815 node->render_manager()->GetRoutingIdForSiteInstance(
1816 parent_rfh->GetSiteInstance());
1817 parent_rfh->Send(new FrameMsg_WillEnterFullscreen(
1818 parent_rfh->GetRoutingID(), child_routing_id));
Charlie Reis 2016/05/12 22:59:23 Nick was wondering if this should just go to child
alexmos 2016/05/13 07:21:03 This is a great idea! Done.
1819 notified_instances.insert(parent_rfh->GetSiteInstance());
1820 }
1821 }
1822
1823 // TODO(alexmos): See if this can use the last committed origin instead.
1791 if (enter_fullscreen) 1824 if (enter_fullscreen)
1792 delegate_->EnterFullscreenMode(last_committed_url().GetOrigin()); 1825 delegate_->EnterFullscreenMode(last_committed_url().GetOrigin());
1793 else 1826 else
1794 delegate_->ExitFullscreenMode(/* will_cause_resize */ true); 1827 delegate_->ExitFullscreenMode(/* will_cause_resize */ true);
1795 1828
1796 // The previous call might change the fullscreen state. We need to make sure 1829 // The previous call might change the fullscreen state. We need to make sure
1797 // the renderer is aware of that, which is done via the resize message. 1830 // the renderer is aware of that, which is done via the resize message. We
1831 // always send this to the main frame's widget, and if there are any OOPIF
1832 // widgets, this will also trigger them to resize via frameRectsChanged.
alexmos 2016/05/10 21:36:24 My doc (https://goo.gl/Y5wdqi) has some more info
Charlie Reis 2016/05/12 22:59:23 Acknowledged.
1798 render_view_host_->GetWidget()->WasResized(); 1833 render_view_host_->GetWidget()->WasResized();
1799 } 1834 }
1800 1835
1801 void RenderFrameHostImpl::OnDidStartLoading(bool to_different_document) { 1836 void RenderFrameHostImpl::OnDidStartLoading(bool to_different_document) {
1802 if (IsBrowserSideNavigationEnabled() && to_different_document) { 1837 if (IsBrowserSideNavigationEnabled() && to_different_document) {
1803 bad_message::ReceivedBadMessage(GetProcess(), 1838 bad_message::ReceivedBadMessage(GetProcess(),
1804 bad_message::RFH_UNEXPECTED_LOAD_START); 1839 bad_message::RFH_UNEXPECTED_LOAD_START);
1805 return; 1840 return;
1806 } 1841 }
1807 bool was_previously_loading = frame_tree_node_->frame_tree()->IsLoading(); 1842 bool was_previously_loading = frame_tree_node_->frame_tree()->IsLoading();
(...skipping 956 matching lines...) Expand 10 before | Expand all | Expand 10 after
2764 // handler after it's destroyed so it can't run after the RFHI is destroyed. 2799 // handler after it's destroyed so it can't run after the RFHI is destroyed.
2765 web_bluetooth_service_->SetClientConnectionErrorHandler(base::Bind( 2800 web_bluetooth_service_->SetClientConnectionErrorHandler(base::Bind(
2766 &RenderFrameHostImpl::DeleteWebBluetoothService, base::Unretained(this))); 2801 &RenderFrameHostImpl::DeleteWebBluetoothService, base::Unretained(this)));
2767 } 2802 }
2768 2803
2769 void RenderFrameHostImpl::DeleteWebBluetoothService() { 2804 void RenderFrameHostImpl::DeleteWebBluetoothService() {
2770 web_bluetooth_service_.reset(); 2805 web_bluetooth_service_.reset();
2771 } 2806 }
2772 2807
2773 } // namespace content 2808 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698