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

Unified Diff: content/browser/frame_host/render_frame_host_impl.cc

Issue 628773003: Partially convert geolocation IPC to Mojo. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase, fix build error Created 6 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 side-by-side diff with in-line comments
Download patch
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 e2bf47bc3e6b179002fb72ed4f1a3fdf6525290b..96f9de5ff090258e2c9d53f104ed3c7c63a350c4 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());
@@ -1197,6 +1198,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)
@@ -1570,4 +1583,12 @@ void RenderFrameHostImpl::CancelSuspendedNavigations() {
navigations_suspended_ = false;
}
+void RenderFrameHostImpl::DidUseGeolocationPermission() {
+ RenderFrameHost* top_frame = frame_tree_node()->frame_tree()->GetMainFrame();
blundell 2014/10/23 13:19:59 Charlie, could you just confirm that this is corre
Charlie Reis 2014/10/23 17:27:17 Yep, that works.
+ GetContentClient()->browser()->DidUseGeolocationPermission(
+ delegate_->GetAsWebContents(),
+ GetLastCommittedURL().GetOrigin(),
+ top_frame->GetLastCommittedURL().GetOrigin());
+}
+
} // namespace content
« no previous file with comments | « content/browser/frame_host/render_frame_host_impl.h ('k') | content/browser/geolocation/geolocation_dispatcher_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698