| 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" |
| 11 #include "content/browser/frame_host/cross_process_frame_connector.h" | 11 #include "content/browser/frame_host/cross_process_frame_connector.h" |
| 12 #include "content/browser/frame_host/frame_tree.h" | 12 #include "content/browser/frame_host/frame_tree.h" |
| 13 #include "content/browser/frame_host/frame_tree_node.h" | 13 #include "content/browser/frame_host/frame_tree_node.h" |
| 14 #include "content/browser/frame_host/navigator.h" | 14 #include "content/browser/frame_host/navigator.h" |
| 15 #include "content/browser/frame_host/render_frame_host_delegate.h" | 15 #include "content/browser/frame_host/render_frame_host_delegate.h" |
| 16 #include "content/browser/frame_host/render_widget_host_view_child_frame.h" | 16 #include "content/browser/frame_host/render_widget_host_view_child_frame.h" |
| 17 #include "content/browser/message_port_message_filter.h" | 17 #include "content/browser/message_port_message_filter.h" |
| 18 #include "content/browser/renderer_host/render_view_host_impl.h" | 18 #include "content/browser/renderer_host/render_view_host_impl.h" |
| 19 #include "content/browser/renderer_host/render_widget_host_view_base.h" | 19 #include "content/browser/renderer_host/render_widget_host_view_base.h" |
| 20 #include "content/browser/site_instance_impl.h" | 20 #include "content/browser/site_instance_impl.h" |
| 21 #include "content/common/frame_messages.h" | 21 #include "content/common/frame_messages.h" |
| 22 #include "content/common/frame_owner_properties.h" | 22 #include "content/common/frame_owner_properties.h" |
| 23 #include "content/public/browser/browser_thread.h" | 23 #include "content/public/browser/browser_thread.h" |
| 24 #include "content/public/browser/notification_service.h" |
| 25 #include "content/public/browser/notification_types.h" |
| 26 #include "content/public/browser/print_subframe_details.h" |
| 24 #include "ipc/ipc_message.h" | 27 #include "ipc/ipc_message.h" |
| 25 | 28 |
| 26 namespace content { | 29 namespace content { |
| 27 | 30 |
| 28 namespace { | 31 namespace { |
| 29 | 32 |
| 30 // The (process id, routing id) pair that identifies one RenderFrameProxy. | 33 // The (process id, routing id) pair that identifies one RenderFrameProxy. |
| 31 typedef std::pair<int32_t, int32_t> RenderFrameProxyHostID; | 34 typedef std::pair<int32_t, int32_t> RenderFrameProxyHostID; |
| 32 typedef base::hash_map<RenderFrameProxyHostID, RenderFrameProxyHost*> | 35 typedef base::hash_map<RenderFrameProxyHostID, RenderFrameProxyHost*> |
| 33 RoutingIDFrameProxyMap; | 36 RoutingIDFrameProxyMap; |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 return true; | 135 return true; |
| 133 | 136 |
| 134 bool handled = true; | 137 bool handled = true; |
| 135 IPC_BEGIN_MESSAGE_MAP(RenderFrameProxyHost, msg) | 138 IPC_BEGIN_MESSAGE_MAP(RenderFrameProxyHost, msg) |
| 136 IPC_MESSAGE_HANDLER(FrameHostMsg_Detach, OnDetach) | 139 IPC_MESSAGE_HANDLER(FrameHostMsg_Detach, OnDetach) |
| 137 IPC_MESSAGE_HANDLER(FrameHostMsg_OpenURL, OnOpenURL) | 140 IPC_MESSAGE_HANDLER(FrameHostMsg_OpenURL, OnOpenURL) |
| 138 IPC_MESSAGE_HANDLER(FrameHostMsg_RouteMessageEvent, OnRouteMessageEvent) | 141 IPC_MESSAGE_HANDLER(FrameHostMsg_RouteMessageEvent, OnRouteMessageEvent) |
| 139 IPC_MESSAGE_HANDLER(FrameHostMsg_DidChangeOpener, OnDidChangeOpener) | 142 IPC_MESSAGE_HANDLER(FrameHostMsg_DidChangeOpener, OnDidChangeOpener) |
| 140 IPC_MESSAGE_HANDLER(FrameHostMsg_AdvanceFocus, OnAdvanceFocus) | 143 IPC_MESSAGE_HANDLER(FrameHostMsg_AdvanceFocus, OnAdvanceFocus) |
| 141 IPC_MESSAGE_HANDLER(FrameHostMsg_FrameFocused, OnFrameFocused) | 144 IPC_MESSAGE_HANDLER(FrameHostMsg_FrameFocused, OnFrameFocused) |
| 145 IPC_MESSAGE_HANDLER(FrameHostMsg_PrintRemoteFrame, OnPrintRemoteFrame) |
| 142 IPC_MESSAGE_UNHANDLED(handled = false) | 146 IPC_MESSAGE_UNHANDLED(handled = false) |
| 143 IPC_END_MESSAGE_MAP() | 147 IPC_END_MESSAGE_MAP() |
| 144 return handled; | 148 return handled; |
| 145 } | 149 } |
| 146 | 150 |
| 147 bool RenderFrameProxyHost::InitRenderFrameProxy() { | 151 bool RenderFrameProxyHost::InitRenderFrameProxy() { |
| 148 DCHECK(!render_frame_proxy_created_); | 152 DCHECK(!render_frame_proxy_created_); |
| 149 | 153 |
| 150 // It is possible to reach this when the process is dead (in particular, when | 154 // It is possible to reach this when the process is dead (in particular, when |
| 151 // creating proxies from CreateProxiesForChildFrame). In that case, don't | 155 // creating proxies from CreateProxiesForChildFrame). In that case, don't |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 365 : nullptr; | 369 : nullptr; |
| 366 | 370 |
| 367 target_rfh->AdvanceFocus(type, source_proxy); | 371 target_rfh->AdvanceFocus(type, source_proxy); |
| 368 } | 372 } |
| 369 | 373 |
| 370 void RenderFrameProxyHost::OnFrameFocused() { | 374 void RenderFrameProxyHost::OnFrameFocused() { |
| 371 frame_tree_node_->current_frame_host()->delegate()->SetFocusedFrame( | 375 frame_tree_node_->current_frame_host()->delegate()->SetFocusedFrame( |
| 372 frame_tree_node_, GetSiteInstance()); | 376 frame_tree_node_, GetSiteInstance()); |
| 373 } | 377 } |
| 374 | 378 |
| 379 void RenderFrameProxyHost::OnPrintRemoteFrame(const gfx::Rect& rect, |
| 380 int page_num) { |
| 381 RenderFrameHostImpl* target_rfh = |
| 382 frame_tree_node_->render_manager()->current_frame_host(); |
| 383 |
| 384 PrintSubframeDetails details(page_num, GetRoutingID()); |
| 385 NotificationService::current()->Notify( |
| 386 NOTIFICATION_PRINT_SUBFRAME_BEGIN, |
| 387 content::Source<RenderFrameProxyHost>(this), |
| 388 content::Details<PrintSubframeDetails>(&details)); |
| 389 target_rfh->Send( |
| 390 new FrameMsg_PrintFrame(target_rfh->GetRoutingID(), rect, page_num)); |
| 391 } |
| 392 |
| 375 } // namespace content | 393 } // namespace content |
| OLD | NEW |