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

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

Issue 2008873004: Reland: Add support for entering/exiting HTML fullscreen from OOPIFs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix tests on Mac 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 1808 matching lines...) Expand 10 before | Expand all | Expand 10 after
1819 AXContentTreeDataToAXTreeData(&dst_snapshot.tree_data); 1819 AXContentTreeDataToAXTreeData(&dst_snapshot.tree_data);
1820 dst_snapshot.has_tree_data = true; 1820 dst_snapshot.has_tree_data = true;
1821 } 1821 }
1822 it->second.Run(dst_snapshot); 1822 it->second.Run(dst_snapshot);
1823 ax_tree_snapshot_callbacks_.erase(it); 1823 ax_tree_snapshot_callbacks_.erase(it);
1824 } else { 1824 } else {
1825 NOTREACHED() << "Received AX tree snapshot response for unknown id"; 1825 NOTREACHED() << "Received AX tree snapshot response for unknown id";
1826 } 1826 }
1827 } 1827 }
1828 1828
1829 // TODO(alexmos): When the allowFullscreen flag is known in the browser
1830 // process, use it to double-check that fullscreen can be entered here.
1829 void RenderFrameHostImpl::OnToggleFullscreen(bool enter_fullscreen) { 1831 void RenderFrameHostImpl::OnToggleFullscreen(bool enter_fullscreen) {
1832 // Entering fullscreen from a cross-process subframe also affects all
1833 // renderers for ancestor frames, which will need to apply fullscreen CSS to
1834 // appropriate ancestor <iframe> elements, fire fullscreenchange events, etc.
1835 // Thus, walk through the ancestor chain of this frame and for each (parent,
1836 // child) pair, send a message about the pending fullscreen change to the
1837 // child's proxy in parent's SiteInstance. The renderer process will use this
1838 // to find the <iframe> element in the parent frame that will need fullscreen
1839 // styles. This is done at most once per SiteInstance: for example, with a
1840 // A-B-A-B hierarchy, if the bottom frame goes fullscreen, this only needs to
1841 // notify its parent, and Blink-side logic will take care of applying
1842 // necessary changes to the other two ancestors.
1843 if (enter_fullscreen &&
1844 SiteIsolationPolicy::AreCrossProcessFramesPossible()) {
1845 std::set<SiteInstance*> notified_instances;
1846 notified_instances.insert(GetSiteInstance());
1847 for (FrameTreeNode* node = frame_tree_node_; node->parent();
1848 node = node->parent()) {
1849 SiteInstance* parent_site_instance =
1850 node->parent()->current_frame_host()->GetSiteInstance();
1851 if (ContainsKey(notified_instances, parent_site_instance))
1852 continue;
1853
1854 RenderFrameProxyHost* child_proxy =
1855 node->render_manager()->GetRenderFrameProxyHost(parent_site_instance);
1856 child_proxy->Send(
1857 new FrameMsg_WillEnterFullscreen(child_proxy->GetRoutingID()));
1858 notified_instances.insert(parent_site_instance);
1859 }
1860 }
1861
1862 // TODO(alexmos): See if this can use the last committed origin instead.
1830 if (enter_fullscreen) 1863 if (enter_fullscreen)
1831 delegate_->EnterFullscreenMode(last_committed_url().GetOrigin()); 1864 delegate_->EnterFullscreenMode(last_committed_url().GetOrigin());
1832 else 1865 else
1833 delegate_->ExitFullscreenMode(/* will_cause_resize */ true); 1866 delegate_->ExitFullscreenMode(/* will_cause_resize */ true);
1834 1867
1835 // The previous call might change the fullscreen state. We need to make sure 1868 // The previous call might change the fullscreen state. We need to make sure
1836 // the renderer is aware of that, which is done via the resize message. 1869 // the renderer is aware of that, which is done via the resize message.
1870 // Typically, this will be sent as part of the call on the |delegate_| above
1871 // when resizing the native windows, but sometimes fullscreen can be entered
1872 // without causing a resize, so we need to ensure that the resize message is
1873 // sent in that case. We always send this to the main frame's widget, and if
1874 // there are any OOPIF widgets, this will also trigger them to resize via
1875 // frameRectsChanged.
1837 render_view_host_->GetWidget()->WasResized(); 1876 render_view_host_->GetWidget()->WasResized();
1838 } 1877 }
1839 1878
1840 void RenderFrameHostImpl::OnDidStartLoading(bool to_different_document) { 1879 void RenderFrameHostImpl::OnDidStartLoading(bool to_different_document) {
1841 if (IsBrowserSideNavigationEnabled() && to_different_document) { 1880 if (IsBrowserSideNavigationEnabled() && to_different_document) {
1842 bad_message::ReceivedBadMessage(GetProcess(), 1881 bad_message::ReceivedBadMessage(GetProcess(),
1843 bad_message::RFH_UNEXPECTED_LOAD_START); 1882 bad_message::RFH_UNEXPECTED_LOAD_START);
1844 return; 1883 return;
1845 } 1884 }
1846 bool was_previously_loading = frame_tree_node_->frame_tree()->IsLoading(); 1885 bool was_previously_loading = frame_tree_node_->frame_tree()->IsLoading();
(...skipping 994 matching lines...) Expand 10 before | Expand all | Expand 10 after
2841 // handler after it's destroyed so it can't run after the RFHI is destroyed. 2880 // handler after it's destroyed so it can't run after the RFHI is destroyed.
2842 web_bluetooth_service_->SetClientConnectionErrorHandler(base::Bind( 2881 web_bluetooth_service_->SetClientConnectionErrorHandler(base::Bind(
2843 &RenderFrameHostImpl::DeleteWebBluetoothService, base::Unretained(this))); 2882 &RenderFrameHostImpl::DeleteWebBluetoothService, base::Unretained(this)));
2844 } 2883 }
2845 2884
2846 void RenderFrameHostImpl::DeleteWebBluetoothService() { 2885 void RenderFrameHostImpl::DeleteWebBluetoothService() {
2847 web_bluetooth_service_.reset(); 2886 web_bluetooth_service_.reset();
2848 } 2887 }
2849 2888
2850 } // namespace content 2889 } // namespace content
OLDNEW
« no previous file with comments | « chrome/browser/site_per_process_interactive_browsertest.cc ('k') | content/browser/web_contents/web_contents_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698