| Index: content/renderer/geolocation_dispatcher.cc
|
| diff --git a/content/renderer/geolocation_dispatcher.cc b/content/renderer/geolocation_dispatcher.cc
|
| index fde4fc98cba9217f6adfb0c669ed1ecf23f69a5e..9eeca7118307f35cc2e04f3c77b7303f8ac13198 100644
|
| --- a/content/renderer/geolocation_dispatcher.cc
|
| +++ b/content/renderer/geolocation_dispatcher.cc
|
| @@ -4,7 +4,8 @@
|
|
|
| #include "content/renderer/geolocation_dispatcher.h"
|
|
|
| -#include "content/common/geolocation_messages.h"
|
| +#include "content/child/child_thread.h"
|
| +#include "content/public/common/geoposition.h"
|
| #include "content/renderer/render_view_impl.h"
|
| #include "third_party/WebKit/public/platform/WebString.h"
|
| #include "third_party/WebKit/public/web/WebGeolocationPermissionRequest.h"
|
| @@ -30,15 +31,6 @@ GeolocationDispatcher::GeolocationDispatcher(RenderFrame* render_frame)
|
|
|
| GeolocationDispatcher::~GeolocationDispatcher() {}
|
|
|
| -bool GeolocationDispatcher::OnMessageReceived(const IPC::Message& message) {
|
| - bool handled = true;
|
| - IPC_BEGIN_MESSAGE_MAP(GeolocationDispatcher, message)
|
| - IPC_MESSAGE_HANDLER(GeolocationMsg_PermissionSet, OnPermissionSet)
|
| - IPC_MESSAGE_UNHANDLED(handled = false)
|
| - IPC_END_MESSAGE_MAP()
|
| - return handled;
|
| -}
|
| -
|
| void GeolocationDispatcher::startUpdating() {
|
| if (!geolocation_service_.get()) {
|
| render_frame()->GetServiceRegistry()->ConnectToRemoteService(
|
| @@ -82,25 +74,38 @@ bool GeolocationDispatcher::lastPosition(WebGeolocationPosition&) {
|
| // conversion is necessary.
|
| void GeolocationDispatcher::requestPermission(
|
| const WebGeolocationPermissionRequest& permissionRequest) {
|
| - int bridge_id = pending_permissions_->add(permissionRequest);
|
| - base::string16 origin = permissionRequest.securityOrigin().toString();
|
| - Send(new GeolocationHostMsg_RequestPermission(
|
| - routing_id(), bridge_id, GURL(origin),
|
| - blink::WebUserGestureIndicator::isProcessingUserGesture()));
|
| + if (!permission_service_.get()) {
|
| + render_frame()->GetServiceRegistry()->ConnectToRemoteService(
|
| + &permission_service_);
|
| + }
|
| +
|
| + int permission_request_id = pending_permissions_->add(permissionRequest);
|
| +
|
| + PermissionName permission = PERMISSION_NAME_GEOLOCATION;
|
| +
|
| + permission_service_->RequestPermission(
|
| + permission,
|
| + permissionRequest.securityOrigin().toString().utf8(),
|
| + base::Bind(&GeolocationDispatcher::OnPermissionSet,
|
| + base::Unretained(this),
|
| + permission_request_id));
|
| }
|
|
|
| void GeolocationDispatcher::cancelPermissionRequest(
|
| - const WebGeolocationPermissionRequest& permissionRequest) {
|
| - int bridge_id;
|
| - pending_permissions_->remove(permissionRequest, bridge_id);
|
| + const blink::WebGeolocationPermissionRequest& permissionRequest) {
|
| + int permission_request_id;
|
| + pending_permissions_->remove(permissionRequest, permission_request_id);
|
| }
|
|
|
| // Permission for using geolocation has been set.
|
| -void GeolocationDispatcher::OnPermissionSet(int bridge_id, bool is_allowed) {
|
| +void GeolocationDispatcher::OnPermissionSet(
|
| + int permission_request_id,
|
| + PermissionStatus status) {
|
| WebGeolocationPermissionRequest permissionRequest;
|
| - if (!pending_permissions_->remove(bridge_id, permissionRequest))
|
| + if (!pending_permissions_->remove(permission_request_id, permissionRequest))
|
| return;
|
| - permissionRequest.setIsAllowed(is_allowed);
|
| +
|
| + permissionRequest.setIsAllowed(status == PERMISSION_STATUS_GRANTED);
|
| }
|
|
|
| void GeolocationDispatcher::OnLocationUpdate(MojoGeopositionPtr geoposition) {
|
|
|