OLD | NEW |
---|---|
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 "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/containers/hash_tables.h" | 8 #include "base/containers/hash_tables.h" |
9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
10 #include "base/metrics/user_metrics_action.h" | 10 #include "base/metrics/user_metrics_action.h" |
11 #include "content/browser/child_process_security_policy_impl.h" | 11 #include "content/browser/child_process_security_policy_impl.h" |
12 #include "content/browser/frame_host/cross_process_frame_connector.h" | 12 #include "content/browser/frame_host/cross_process_frame_connector.h" |
13 #include "content/browser/frame_host/cross_site_transferring_request.h" | 13 #include "content/browser/frame_host/cross_site_transferring_request.h" |
14 #include "content/browser/frame_host/frame_tree.h" | 14 #include "content/browser/frame_host/frame_tree.h" |
15 #include "content/browser/frame_host/frame_tree_node.h" | 15 #include "content/browser/frame_host/frame_tree_node.h" |
16 #include "content/browser/frame_host/navigator.h" | 16 #include "content/browser/frame_host/navigator.h" |
17 #include "content/browser/frame_host/render_frame_host_delegate.h" | 17 #include "content/browser/frame_host/render_frame_host_delegate.h" |
18 #include "content/browser/frame_host/render_frame_proxy_host.h" | 18 #include "content/browser/frame_host/render_frame_proxy_host.h" |
19 #include "content/browser/renderer_host/input/input_router.h" | 19 #include "content/browser/renderer_host/input/input_router.h" |
20 #include "content/browser/renderer_host/input/timeout_monitor.h" | 20 #include "content/browser/renderer_host/input/timeout_monitor.h" |
21 #include "content/browser/renderer_host/render_process_host_impl.h" | |
21 #include "content/browser/renderer_host/render_view_host_impl.h" | 22 #include "content/browser/renderer_host/render_view_host_impl.h" |
22 #include "content/browser/renderer_host/render_widget_host_impl.h" | 23 #include "content/browser/renderer_host/render_widget_host_impl.h" |
23 #include "content/common/desktop_notification_messages.h" | 24 #include "content/common/desktop_notification_messages.h" |
24 #include "content/common/frame_messages.h" | 25 #include "content/common/frame_messages.h" |
25 #include "content/common/input_messages.h" | 26 #include "content/common/input_messages.h" |
26 #include "content/common/inter_process_time_ticks_converter.h" | 27 #include "content/common/inter_process_time_ticks_converter.h" |
28 #include "content/common/render_frame_setup.mojom.h" | |
27 #include "content/common/swapped_out_messages.h" | 29 #include "content/common/swapped_out_messages.h" |
28 #include "content/public/browser/browser_thread.h" | 30 #include "content/public/browser/browser_thread.h" |
29 #include "content/public/browser/content_browser_client.h" | 31 #include "content/public/browser/content_browser_client.h" |
30 #include "content/public/browser/desktop_notification_delegate.h" | 32 #include "content/public/browser/desktop_notification_delegate.h" |
31 #include "content/public/browser/render_process_host.h" | 33 #include "content/public/browser/render_process_host.h" |
32 #include "content/public/browser/render_widget_host_view.h" | 34 #include "content/public/browser/render_widget_host_view.h" |
33 #include "content/public/browser/user_metrics.h" | 35 #include "content/public/browser/user_metrics.h" |
34 #include "content/public/common/content_constants.h" | 36 #include "content/public/common/content_constants.h" |
35 #include "content/public/common/url_constants.h" | 37 #include "content/public/common/url_constants.h" |
36 #include "content/public/common/url_utils.h" | 38 #include "content/public/common/url_utils.h" |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
154 frame_tree_(frame_tree), | 156 frame_tree_(frame_tree), |
155 frame_tree_node_(frame_tree_node), | 157 frame_tree_node_(frame_tree_node), |
156 routing_id_(routing_id), | 158 routing_id_(routing_id), |
157 is_swapped_out_(is_swapped_out), | 159 is_swapped_out_(is_swapped_out), |
158 weak_ptr_factory_(this) { | 160 weak_ptr_factory_(this) { |
159 frame_tree_->RegisterRenderFrameHost(this); | 161 frame_tree_->RegisterRenderFrameHost(this); |
160 GetProcess()->AddRoute(routing_id_, this); | 162 GetProcess()->AddRoute(routing_id_, this); |
161 g_routing_id_frame_map.Get().insert(std::make_pair( | 163 g_routing_id_frame_map.Get().insert(std::make_pair( |
162 RenderFrameHostID(GetProcess()->GetID(), routing_id_), | 164 RenderFrameHostID(GetProcess()->GetID(), routing_id_), |
163 this)); | 165 this)); |
166 | |
167 if (GetProcess()->GetServiceRegistry()) { | |
168 RenderFrameSetupPtr setup; | |
169 GetProcess()->GetServiceRegistry()->GetRemoteInterface(&setup); | |
170 mojo::IInterfaceProviderPtr service_provider; | |
171 setup->GetServiceProvider(routing_id_, mojo::Get(&service_provider)); | |
darin (slow to review)
2014/06/21 04:33:35
nit: It might read better if this were GetServiceP
Sam McNally
2014/06/24 04:00:29
Done.
| |
172 service_registry_.BindRemoteServiceProvider( | |
173 service_provider.PassMessagePipe()); | |
174 } | |
164 } | 175 } |
165 | 176 |
166 RenderFrameHostImpl::~RenderFrameHostImpl() { | 177 RenderFrameHostImpl::~RenderFrameHostImpl() { |
167 GetProcess()->RemoveRoute(routing_id_); | 178 GetProcess()->RemoveRoute(routing_id_); |
168 g_routing_id_frame_map.Get().erase( | 179 g_routing_id_frame_map.Get().erase( |
169 RenderFrameHostID(GetProcess()->GetID(), routing_id_)); | 180 RenderFrameHostID(GetProcess()->GetID(), routing_id_)); |
170 if (delegate_) | 181 if (delegate_) |
171 delegate_->RenderFrameDeleted(this); | 182 delegate_->RenderFrameDeleted(this); |
172 | 183 |
173 // Notify the FrameTree that this RFH is going away, allowing it to shut down | 184 // Notify the FrameTree that this RFH is going away, allowing it to shut down |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
234 Send(new FrameMsg_JavaScriptExecuteRequest(routing_id_, | 245 Send(new FrameMsg_JavaScriptExecuteRequest(routing_id_, |
235 javascript, | 246 javascript, |
236 key, true)); | 247 key, true)); |
237 javascript_callbacks_.insert(std::make_pair(key, callback)); | 248 javascript_callbacks_.insert(std::make_pair(key, callback)); |
238 } | 249 } |
239 | 250 |
240 RenderViewHost* RenderFrameHostImpl::GetRenderViewHost() { | 251 RenderViewHost* RenderFrameHostImpl::GetRenderViewHost() { |
241 return render_view_host_; | 252 return render_view_host_; |
242 } | 253 } |
243 | 254 |
255 ServiceRegistry* RenderFrameHostImpl::GetServiceRegistry() { | |
256 static_cast<RenderProcessHostImpl*>(GetProcess())->ActivateMojo(); | |
darin (slow to review)
2014/06/21 04:33:35
nit: perhaps we should rename ActivateMojo to Ensu
Sam McNally
2014/06/24 04:00:29
Done.
| |
257 return &service_registry_; | |
258 } | |
259 | |
244 bool RenderFrameHostImpl::Send(IPC::Message* message) { | 260 bool RenderFrameHostImpl::Send(IPC::Message* message) { |
245 if (IPC_MESSAGE_ID_CLASS(message->type()) == InputMsgStart) { | 261 if (IPC_MESSAGE_ID_CLASS(message->type()) == InputMsgStart) { |
246 return render_view_host_->input_router()->SendInput( | 262 return render_view_host_->input_router()->SendInput( |
247 make_scoped_ptr(message)); | 263 make_scoped_ptr(message)); |
248 } | 264 } |
249 | 265 |
250 if (render_view_host_->IsSwappedOut()) { | 266 if (render_view_host_->IsSwappedOut()) { |
251 DCHECK(render_frame_proxy_host_); | 267 DCHECK(render_frame_proxy_host_); |
252 return render_frame_proxy_host_->Send(message); | 268 return render_frame_proxy_host_->Send(message); |
253 } | 269 } |
(...skipping 636 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
890 cancel_notification_callbacks_.erase(notification_id); | 906 cancel_notification_callbacks_.erase(notification_id); |
891 } | 907 } |
892 | 908 |
893 void RenderFrameHostImpl::DesktopNotificationPermissionRequestDone( | 909 void RenderFrameHostImpl::DesktopNotificationPermissionRequestDone( |
894 int callback_context) { | 910 int callback_context) { |
895 Send(new DesktopNotificationMsg_PermissionRequestDone( | 911 Send(new DesktopNotificationMsg_PermissionRequestDone( |
896 routing_id_, callback_context)); | 912 routing_id_, callback_context)); |
897 } | 913 } |
898 | 914 |
899 } // namespace content | 915 } // namespace content |
OLD | NEW |