OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_proxy_host.h" | 5 #include "content/browser/frame_host/render_frame_proxy_host.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
10 #include "content/browser/bad_message.h" | 10 #include "content/browser/bad_message.h" |
(...skipping 28 matching lines...) Expand all Loading... |
39 // static | 39 // static |
40 RenderFrameProxyHost* RenderFrameProxyHost::FromID(int process_id, | 40 RenderFrameProxyHost* RenderFrameProxyHost::FromID(int process_id, |
41 int routing_id) { | 41 int routing_id) { |
42 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 42 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
43 RoutingIDFrameProxyMap* frames = g_routing_id_frame_proxy_map.Pointer(); | 43 RoutingIDFrameProxyMap* frames = g_routing_id_frame_proxy_map.Pointer(); |
44 RoutingIDFrameProxyMap::iterator it = frames->find( | 44 RoutingIDFrameProxyMap::iterator it = frames->find( |
45 RenderFrameProxyHostID(process_id, routing_id)); | 45 RenderFrameProxyHostID(process_id, routing_id)); |
46 return it == frames->end() ? NULL : it->second; | 46 return it == frames->end() ? NULL : it->second; |
47 } | 47 } |
48 | 48 |
49 RenderFrameProxyHost::RenderFrameProxyHost(SiteInstance* site_instance, | 49 RenderFrameProxyHost::RenderFrameProxyHost(SiteInstanceImpl* site_instance, |
50 RenderViewHostImpl* render_view_host, | 50 RenderViewHostImpl* render_view_host, |
51 FrameTreeNode* frame_tree_node) | 51 FrameTreeNode* frame_tree_node) |
52 : routing_id_(site_instance->GetProcess()->GetNextRoutingID()), | 52 : routing_id_(site_instance->GetProcess()->GetNextRoutingID()), |
53 site_instance_(site_instance), | 53 site_instance_(site_instance), |
54 process_(site_instance->GetProcess()), | 54 process_(site_instance->GetProcess()), |
55 frame_tree_node_(frame_tree_node), | 55 frame_tree_node_(frame_tree_node), |
56 render_frame_proxy_created_(false), | 56 render_frame_proxy_created_(false), |
57 render_view_host_(render_view_host) { | 57 render_view_host_(render_view_host) { |
58 GetProcess()->AddRoute(routing_id_, this); | 58 GetProcess()->AddRoute(routing_id_, this); |
59 CHECK(g_routing_id_frame_proxy_map.Get().insert( | 59 CHECK(g_routing_id_frame_proxy_map.Get().insert( |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 const FrameMsg_PostMessage_Params& params) { | 261 const FrameMsg_PostMessage_Params& params) { |
262 RenderFrameHostImpl* target_rfh = frame_tree_node()->current_frame_host(); | 262 RenderFrameHostImpl* target_rfh = frame_tree_node()->current_frame_host(); |
263 | 263 |
264 // Only deliver the message if the request came from a RenderFrameHost in the | 264 // Only deliver the message if the request came from a RenderFrameHost in the |
265 // same BrowsingInstance or if this WebContents is dedicated to a browser | 265 // same BrowsingInstance or if this WebContents is dedicated to a browser |
266 // plugin guest. | 266 // plugin guest. |
267 // | 267 // |
268 // TODO(alexmos, lazyboy): The check for browser plugin guest currently | 268 // TODO(alexmos, lazyboy): The check for browser plugin guest currently |
269 // requires going through the delegate. It should be refactored and | 269 // requires going through the delegate. It should be refactored and |
270 // performed here once OOPIF support in <webview> is further along. | 270 // performed here once OOPIF support in <webview> is further along. |
271 SiteInstance* target_site_instance = target_rfh->GetSiteInstance(); | 271 SiteInstanceImpl* target_site_instance = target_rfh->GetSiteInstance(); |
272 if (!target_site_instance->IsRelatedSiteInstance(GetSiteInstance()) && | 272 if (!target_site_instance->IsRelatedSiteInstance(GetSiteInstance()) && |
273 !target_rfh->delegate()->ShouldRouteMessageEvent(target_rfh, | 273 !target_rfh->delegate()->ShouldRouteMessageEvent(target_rfh, |
274 GetSiteInstance())) | 274 GetSiteInstance())) |
275 return; | 275 return; |
276 | 276 |
277 FrameMsg_PostMessage_Params new_params(params); | 277 FrameMsg_PostMessage_Params new_params(params); |
278 | 278 |
279 // If there is a source_routing_id, translate it to the routing ID of the | 279 // If there is a source_routing_id, translate it to the routing ID of the |
280 // equivalent RenderFrameProxyHost in the target process. | 280 // equivalent RenderFrameProxyHost in the target process. |
281 if (new_params.source_routing_id != MSG_ROUTING_NONE) { | 281 if (new_params.source_routing_id != MSG_ROUTING_NONE) { |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
358 target_rfh->Send(new FrameMsg_AdvanceFocus(target_rfh->GetRoutingID(), type, | 358 target_rfh->Send(new FrameMsg_AdvanceFocus(target_rfh->GetRoutingID(), type, |
359 source_proxy_routing_id)); | 359 source_proxy_routing_id)); |
360 } | 360 } |
361 | 361 |
362 void RenderFrameProxyHost::OnFrameFocused() { | 362 void RenderFrameProxyHost::OnFrameFocused() { |
363 frame_tree_node_->frame_tree()->SetFocusedFrame(frame_tree_node_, | 363 frame_tree_node_->frame_tree()->SetFocusedFrame(frame_tree_node_, |
364 GetSiteInstance()); | 364 GetSiteInstance()); |
365 } | 365 } |
366 | 366 |
367 } // namespace content | 367 } // namespace content |
OLD | NEW |