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

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

Issue 1394383002: OOPIF: Send page-level focus messages to all processes rendering a page. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 2 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_manager.h" 5 #include "content/browser/frame_host/render_frame_host_manager.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 14 matching lines...) Expand all
25 #include "content/browser/frame_host/render_frame_host_factory.h" 25 #include "content/browser/frame_host/render_frame_host_factory.h"
26 #include "content/browser/frame_host/render_frame_host_impl.h" 26 #include "content/browser/frame_host/render_frame_host_impl.h"
27 #include "content/browser/frame_host/render_frame_proxy_host.h" 27 #include "content/browser/frame_host/render_frame_proxy_host.h"
28 #include "content/browser/renderer_host/render_process_host_impl.h" 28 #include "content/browser/renderer_host/render_process_host_impl.h"
29 #include "content/browser/renderer_host/render_view_host_factory.h" 29 #include "content/browser/renderer_host/render_view_host_factory.h"
30 #include "content/browser/renderer_host/render_view_host_impl.h" 30 #include "content/browser/renderer_host/render_view_host_impl.h"
31 #include "content/browser/site_instance_impl.h" 31 #include "content/browser/site_instance_impl.h"
32 #include "content/browser/webui/web_ui_controller_factory_registry.h" 32 #include "content/browser/webui/web_ui_controller_factory_registry.h"
33 #include "content/browser/webui/web_ui_impl.h" 33 #include "content/browser/webui/web_ui_impl.h"
34 #include "content/common/frame_messages.h" 34 #include "content/common/frame_messages.h"
35 #include "content/common/input_messages.h"
35 #include "content/common/site_isolation_policy.h" 36 #include "content/common/site_isolation_policy.h"
36 #include "content/common/view_messages.h" 37 #include "content/common/view_messages.h"
37 #include "content/public/browser/content_browser_client.h" 38 #include "content/public/browser/content_browser_client.h"
38 #include "content/public/browser/render_process_host_observer.h" 39 #include "content/public/browser/render_process_host_observer.h"
39 #include "content/public/browser/render_widget_host_iterator.h" 40 #include "content/public/browser/render_widget_host_iterator.h"
40 #include "content/public/browser/render_widget_host_view.h" 41 #include "content/public/browser/render_widget_host_view.h"
41 #include "content/public/browser/user_metrics.h" 42 #include "content/public/browser/user_metrics.h"
42 #include "content/public/browser/web_ui_controller.h" 43 #include "content/public/browser/web_ui_controller.h"
43 #include "content/public/common/browser_plugin_guest_mode.h" 44 #include "content/public/common/browser_plugin_guest_mode.h"
44 #include "content/public/common/content_switches.h" 45 #include "content/public/common/content_switches.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 // If this tree is already on our processing list *and* we have visited it, 77 // If this tree is already on our processing list *and* we have visited it,
77 // then this node's opener is a back link. This means the node will need 78 // then this node's opener is a back link. This means the node will need
78 // special treatment to process its opener. 79 // special treatment to process its opener.
79 size_t position = std::distance(opener_trees->begin(), existing_tree_it); 80 size_t position = std::distance(opener_trees->begin(), existing_tree_it);
80 if (position < visited_index) 81 if (position < visited_index)
81 nodes_with_back_links->insert(node); 82 nodes_with_back_links->insert(node);
82 } 83 }
83 return true; 84 return true;
84 } 85 }
85 86
87 bool CollectSiteInstances(std::set<SiteInstance*>* set,
Charlie Reis 2015/10/16 18:56:09 nit: Add comment about what this is useful for (e.
alexmos 2015/10/16 22:56:05 Done.
88 FrameTreeNode* node) {
89 set->insert(node->current_frame_host()->GetSiteInstance());
90 return true;
91 }
92
86 } // namespace 93 } // namespace
87 94
88 // A helper class to hold all frame proxies and register as a 95 // A helper class to hold all frame proxies and register as a
89 // RenderProcessHostObserver for them. 96 // RenderProcessHostObserver for them.
90 class RenderFrameHostManager::RenderFrameProxyHostMap 97 class RenderFrameHostManager::RenderFrameProxyHostMap
91 : public RenderProcessHostObserver { 98 : public RenderProcessHostObserver {
92 public: 99 public:
93 using MapType = base::hash_map<int32, RenderFrameProxyHost*>; 100 using MapType = base::hash_map<int32, RenderFrameProxyHost*>;
94 101
95 RenderFrameProxyHostMap(RenderFrameHostManager* manager); 102 RenderFrameProxyHostMap(RenderFrameHostManager* manager);
(...skipping 1889 matching lines...) Expand 10 before | Expand all | Expand 10 after
1985 false /* is_loading */, FrameReplicationState())); 1992 false /* is_loading */, FrameReplicationState()));
1986 proxy->set_render_frame_proxy_created(true); 1993 proxy->set_render_frame_proxy_created(true);
1987 } 1994 }
1988 1995
1989 void RenderFrameHostManager::SetRWHViewForInnerContents( 1996 void RenderFrameHostManager::SetRWHViewForInnerContents(
1990 RenderWidgetHostView* child_rwhv) { 1997 RenderWidgetHostView* child_rwhv) {
1991 DCHECK(ForInnerDelegate() && frame_tree_node_->IsMainFrame()); 1998 DCHECK(ForInnerDelegate() && frame_tree_node_->IsMainFrame());
1992 GetProxyToOuterDelegate()->SetChildRWHView(child_rwhv); 1999 GetProxyToOuterDelegate()->SetChildRWHView(child_rwhv);
1993 } 2000 }
1994 2001
2002 void RenderFrameHostManager::ReplicatePageFocus(bool is_focused) {
2003 CHECK(frame_tree_node_->IsMainFrame());
2004
2005 std::set<SiteInstance*> frame_tree_site_instances;
2006 frame_tree_node_->frame_tree()->ForEach(
2007 base::Bind(&CollectSiteInstances, &frame_tree_site_instances));
2008
2009 for (const auto& instance : frame_tree_site_instances) {
2010 if (instance == render_frame_host_->GetSiteInstance())
2011 continue;
2012
2013 // Main frame should have proxies in all SiteInstances of other frames in
Charlie Reis 2015/10/16 18:56:09 nit: Notify the proxies for all SiteInstances of o
alexmos 2015/10/16 22:56:05 Done.
2014 // this FrameTree. Note that it might also contain proxies in SiteInstances
2015 // for a frame in a different FrameTree (e.g., for window.open), so we
2016 // can't just iterate over proxy_hosts_.
Charlie Reis 2015/10/16 18:56:09 This comment should go above line 2005.
alexmos 2015/10/16 22:56:05 Done.
2017 RenderFrameProxyHost* proxy = GetRenderFrameProxyHost(instance);
2018 CHECK(proxy);
2019
2020 proxy->Send(new InputMsg_SetFocus(proxy->GetRoutingID(), is_focused));
2021 }
2022 }
2023
1995 bool RenderFrameHostManager::InitRenderView( 2024 bool RenderFrameHostManager::InitRenderView(
1996 RenderViewHostImpl* render_view_host, 2025 RenderViewHostImpl* render_view_host,
1997 int proxy_routing_id) { 2026 int proxy_routing_id) {
1998 // Ensure the renderer process is initialized before creating the 2027 // Ensure the renderer process is initialized before creating the
1999 // RenderView. 2028 // RenderView.
2000 if (!render_view_host->GetProcess()->Init()) 2029 if (!render_view_host->GetProcess()->Init())
2001 return false; 2030 return false;
2002 2031
2003 // We may have initialized this RenderViewHost for another RenderFrameHost. 2032 // We may have initialized this RenderViewHost for another RenderFrameHost.
2004 if (render_view_host->IsRenderViewLive()) 2033 if (render_view_host->IsRenderViewLive())
(...skipping 636 matching lines...) Expand 10 before | Expand all | Expand 10 after
2641 int RenderFrameHostManager::GetOpenerRoutingID(SiteInstance* instance) { 2670 int RenderFrameHostManager::GetOpenerRoutingID(SiteInstance* instance) {
2642 if (!frame_tree_node_->opener()) 2671 if (!frame_tree_node_->opener())
2643 return MSG_ROUTING_NONE; 2672 return MSG_ROUTING_NONE;
2644 2673
2645 return frame_tree_node_->opener() 2674 return frame_tree_node_->opener()
2646 ->render_manager() 2675 ->render_manager()
2647 ->GetRoutingIdForSiteInstance(instance); 2676 ->GetRoutingIdForSiteInstance(instance);
2648 } 2677 }
2649 2678
2650 } // namespace content 2679 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698