Chromium Code Reviews| Index: content/browser/frame_host/render_frame_host_impl.cc |
| diff --git a/content/browser/frame_host/render_frame_host_impl.cc b/content/browser/frame_host/render_frame_host_impl.cc |
| index af2f25ea772cb1cd3164bd62df31f95f629ca097..dc2a38f3ee9e439db4fb32908a9e5efc14da3335 100644 |
| --- a/content/browser/frame_host/render_frame_host_impl.cc |
| +++ b/content/browser/frame_host/render_frame_host_impl.cc |
| @@ -24,6 +24,7 @@ |
| #include "content/browser/frame_host/render_frame_host_delegate.h" |
| #include "content/browser/frame_host/render_frame_proxy_host.h" |
| #include "content/browser/frame_host/render_widget_host_view_child_frame.h" |
| +#include "content/browser/geolocation/geolocation_service_context.h" |
| #include "content/browser/renderer_host/input/input_router.h" |
| #include "content/browser/renderer_host/input/timeout_monitor.h" |
| #include "content/browser/renderer_host/render_process_host_impl.h" |
| @@ -40,7 +41,6 @@ |
| #include "content/common/inter_process_time_ticks_converter.h" |
| #include "content/common/navigation_params.h" |
| #include "content/common/platform_notification_messages.h" |
| -#include "content/common/render_frame_setup.mojom.h" |
| #include "content/common/swapped_out_messages.h" |
| #include "content/public/browser/ax_event_notification_details.h" |
| #include "content/public/browser/browser_accessibility_state.h" |
| @@ -204,11 +204,12 @@ RenderFrameHostImpl::RenderFrameHostImpl(RenderViewHostImpl* render_view_host, |
| } |
| if (GetProcess()->GetServiceRegistry()) { |
| - RenderFrameSetupPtr setup; |
| - GetProcess()->GetServiceRegistry()->ConnectToRemoteService(&setup); |
| + RegisterMojoServices(); |
| + GetProcess()->GetServiceRegistry()->ConnectToRemoteService( |
| + &render_frame_setup_); |
| mojo::ServiceProviderPtr service_provider; |
| - setup->GetServiceProviderForFrame(routing_id_, |
| - mojo::GetProxy(&service_provider)); |
| + render_frame_setup_->GetServiceProviderForFrame( |
| + routing_id_, mojo::GetProxy(&service_provider)); |
| service_registry_.BindRemoteServiceProvider( |
| service_provider.PassMessagePipe()); |
| @@ -1195,6 +1196,18 @@ void RenderFrameHostImpl::OnHidePopup() { |
| } |
| #endif |
| +void RenderFrameHostImpl::RegisterMojoServices() { |
| + GeolocationServiceContext* geolocation_service_context = |
| + delegate_ ? delegate_->GetGeolocationServiceContext() : NULL; |
| + if (geolocation_service_context) { |
| + GetServiceRegistry()->AddService<GeolocationService>( |
| + base::Bind(&GeolocationServiceContext::CreateService, |
| + base::Unretained(geolocation_service_context), |
| + base::Bind(&RenderFrameHostImpl::DidUseGeolocationPermission, |
| + base::Unretained(this)))); |
| + } |
| +} |
| + |
| void RenderFrameHostImpl::SetState(RenderFrameHostImplState rfh_state) { |
| // Only main frames should be swapped out and retained inside a proxy host. |
| if (rfh_state == STATE_SWAPPED_OUT) |
| @@ -1568,4 +1581,15 @@ void RenderFrameHostImpl::CancelSuspendedNavigations() { |
| navigations_suspended_ = false; |
| } |
| +void RenderFrameHostImpl::DidUseGeolocationPermission() { |
| + RenderFrameHost* top_frame = this; |
|
Charlie Reis
2014/10/21 22:28:32
We can use frame_tree_node()->frame_tree()->root()
blundell
2014/10/23 12:27:01
Done.
|
| + while (top_frame->GetParent()) { |
| + top_frame = top_frame->GetParent(); |
| + } |
| + GetContentClient()->browser()->DidUseGeolocationPermission( |
| + delegate_->GetAsWebContents(), |
| + GetLastCommittedURL().GetOrigin(), |
| + top_frame->GetLastCommittedURL().GetOrigin()); |
| +} |
| + |
| } // namespace content |