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

Unified Diff: content/browser/geolocation/geolocation_dispatcher_host.cc

Issue 11269002: Introduce GeolocationPermissionRequestID, a wrapper struct to contain the (render process ID, rende… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 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/geolocation/geolocation_dispatcher_host.cc
===================================================================
--- content/browser/geolocation/geolocation_dispatcher_host.cc (revision 163741)
+++ content/browser/geolocation/geolocation_dispatcher_host.cc (working copy)
@@ -17,10 +17,7 @@
#include "content/public/common/geoposition.h"
#include "content/common/geolocation_messages.h"
-using content::BrowserThread;
-using content::GeolocationPermissionContext;
-using content::Geoposition;
-using content::RenderViewHostImpl;
+namespace content {
namespace {
@@ -29,16 +26,15 @@
GeolocationProvider::GetInstance()->OnPermissionGranted();
}
-void SendGeolocationPermissionResponse(int render_process_id,
- int render_view_id,
- int bridge_id,
+void SendGeolocationPermissionResponse(const GeolocationPermissionRequestID& id,
bool allowed) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
RenderViewHostImpl* r = RenderViewHostImpl::FromID(
- render_process_id, render_view_id);
+ id.render_process_id, id.render_view_id);
if (!r)
return;
- r->Send(new GeolocationMsg_PermissionSet(render_view_id, bridge_id, allowed));
+ r->Send(new GeolocationMsg_PermissionSet(id.render_view_id, id.bridge_id,
+ allowed));
if (allowed) {
BrowserThread::PostTask(
@@ -63,13 +59,15 @@
private:
virtual ~GeolocationDispatcherHostImpl();
- void OnRequestPermission(
- int render_view_id, int bridge_id, const GURL& requesting_frame);
- void OnCancelPermissionRequest(
- int render_view_id, int bridge_id, const GURL& requesting_frame);
- void OnStartUpdating(
- int render_view_id, const GURL& requesting_frame,
- bool enable_high_accuracy);
+ void OnRequestPermission(int render_view_id,
+ int bridge_id,
+ const GURL& requesting_frame);
+ void OnCancelPermissionRequest(int render_view_id,
+ int bridge_id,
+ const GURL& requesting_frame);
+ void OnStartUpdating(int render_view_id,
+ const GURL& requesting_frame,
+ bool enable_high_accuracy);
void OnStopUpdating(int render_view_id);
// Updates the |location_arbitrator_| with the currently required update
@@ -140,21 +138,17 @@
int bridge_id,
const GURL& requesting_frame) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
- DVLOG(1) << __FUNCTION__ << " " << render_process_id_ << ":"
- << render_view_id << ":" << bridge_id;
+ const GeolocationPermissionRequestID id(render_process_id_, render_view_id,
+ bridge_id);
+ DVLOG(1) << __FUNCTION__ << " " << id.ToString();
if (geolocation_permission_context_) {
geolocation_permission_context_->RequestGeolocationPermission(
- render_process_id_, render_view_id, bridge_id,
- requesting_frame,
- base::Bind(
- &SendGeolocationPermissionResponse,
- render_process_id_, render_view_id, bridge_id));
+ id, requesting_frame, base::Bind(&SendGeolocationPermissionResponse,
+ id));
} else {
BrowserThread::PostTask(
BrowserThread::UI, FROM_HERE,
- base::Bind(
- &SendGeolocationPermissionResponse,
- render_process_id_, render_view_id, bridge_id, true));
+ base::Bind(&SendGeolocationPermissionResponse, id, true));
}
}
@@ -163,13 +157,13 @@
int bridge_id,
const GURL& requesting_frame) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
- DVLOG(1) << __FUNCTION__ << " " << render_process_id_ << ":"
- << render_view_id << ":" << bridge_id;
- if (!geolocation_permission_context_)
- return;
- geolocation_permission_context_->CancelGeolocationPermissionRequest(
- render_process_id_, render_view_id, bridge_id,
- requesting_frame);
+ const GeolocationPermissionRequestID id(render_process_id_, render_view_id,
+ bridge_id);
+ DVLOG(1) << __FUNCTION__ << " " << id.ToString();
+ if (geolocation_permission_context_) {
+ geolocation_permission_context_->CancelGeolocationPermissionRequest(
+ id, requesting_frame);
+ }
}
void GeolocationDispatcherHostImpl::OnStartUpdating(
@@ -218,6 +212,10 @@
}
} // namespace
+
+// GeolocationDispatcherHost --------------------------------------------------
+
+// static
GeolocationDispatcherHost* GeolocationDispatcherHost::New(
int render_process_id,
GeolocationPermissionContext* geolocation_permission_context) {
@@ -225,3 +223,11 @@
render_process_id,
geolocation_permission_context);
}
+
+GeolocationDispatcherHost::GeolocationDispatcherHost() {
+}
+
+GeolocationDispatcherHost::~GeolocationDispatcherHost() {
+}
+
+} // namespace content

Powered by Google App Engine
This is Rietveld 408576698