summaryrefslogtreecommitdiffstats
path: root/chrome/browser/geolocation/geolocation_dispatcher_host.cc
diff options
context:
space:
mode:
authorbulach@chromium.org <bulach@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-01 19:13:15 +0000
committerbulach@chromium.org <bulach@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-01 19:13:15 +0000
commita7b7e53c1daeaa5fade446e3f77c1994d5465345 (patch)
tree3284fec9d6ab04a472f979327ebb6d99f9c1ff02 /chrome/browser/geolocation/geolocation_dispatcher_host.cc
parent9371970ee8ebd1ed597c1b4cb60da676bc36563c (diff)
downloadchromium_src-a7b7e53c1daeaa5fade446e3f77c1994d5465345.zip
chromium_src-a7b7e53c1daeaa5fade446e3f77c1994d5465345.tar.gz
chromium_src-a7b7e53c1daeaa5fade446e3f77c1994d5465345.tar.bz2
Follow-up on https://bugs.webkit.org/show_bug.cgi?id=35031:
Implements cancelGeolocationPermissionRequestForFrame() Queues infobars. BUG=39686,39804 TEST=geolocation_browsertest.cc Review URL: http://codereview.chromium.org/1573002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@43368 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/geolocation/geolocation_dispatcher_host.cc')
-rw-r--r--chrome/browser/geolocation/geolocation_dispatcher_host.cc27
1 files changed, 18 insertions, 9 deletions
diff --git a/chrome/browser/geolocation/geolocation_dispatcher_host.cc b/chrome/browser/geolocation/geolocation_dispatcher_host.cc
index fb8f531b..f937476 100644
--- a/chrome/browser/geolocation/geolocation_dispatcher_host.cc
+++ b/chrome/browser/geolocation/geolocation_dispatcher_host.cc
@@ -55,6 +55,8 @@ bool GeolocationDispatcherHost::OnMessageReceived(
OnRegisterDispatcher)
IPC_MESSAGE_HANDLER(ViewHostMsg_Geolocation_UnregisterDispatcher,
OnUnregisterDispatcher)
+ IPC_MESSAGE_HANDLER(ViewHostMsg_Geolocation_CancelPermissionRequest,
+ OnCancelPermissionRequest)
IPC_MESSAGE_HANDLER(ViewHostMsg_Geolocation_RequestPermission,
OnRequestPermission)
IPC_MESSAGE_HANDLER(ViewHostMsg_Geolocation_StartUpdating,
@@ -114,6 +116,14 @@ void GeolocationDispatcherHost::OnRequestPermission(
requesting_frame);
}
+void GeolocationDispatcherHost::OnCancelPermissionRequest(
+ int render_view_id, int bridge_id, const GURL& requesting_frame) {
+ LOG(INFO) << "cancel permission request";
+ geolocation_permission_context_->CancelGeolocationPermissionRequest(
+ resource_message_filter_process_id_, render_view_id, bridge_id,
+ requesting_frame);
+}
+
void GeolocationDispatcherHost::OnStartUpdating(
int render_view_id, int bridge_id, const GURL& requesting_frame,
bool enable_high_accuracy) {
@@ -121,12 +131,10 @@ void GeolocationDispatcherHost::OnStartUpdating(
// optimize the no-location-available case and reduce latency in the success
// case (location lookup happens in parallel with the permission request).
LOG(INFO) << "start updating" << render_view_id;
- if (!location_arbitrator_) {
- location_arbitrator_ =
- geolocation_permission_context_->StartUpdatingRequested(
- resource_message_filter_process_id_, render_view_id, bridge_id,
- requesting_frame);
- }
+ location_arbitrator_ =
+ geolocation_permission_context_->StartUpdatingRequested(
+ resource_message_filter_process_id_, render_view_id, bridge_id,
+ requesting_frame);
DCHECK(location_arbitrator_);
location_arbitrator_->AddObserver(
this, GeolocationArbitrator::UpdateOptions(enable_high_accuracy));
@@ -134,10 +142,11 @@ void GeolocationDispatcherHost::OnStartUpdating(
void GeolocationDispatcherHost::OnStopUpdating(
int render_view_id, int bridge_id) {
+ // TODO(joth): Balance calls to RemoveObserver here with AddObserver above.
+ // http://crbug.com/40103
LOG(INFO) << "stop updating" << render_view_id;
- if (location_arbitrator_)
- location_arbitrator_->RemoveObserver(this);
- location_arbitrator_ = NULL;
+ geolocation_permission_context_->StopUpdatingRequested(
+ resource_message_filter_process_id_, render_view_id, bridge_id);
}
void GeolocationDispatcherHost::OnSuspend(