| Index: chrome/browser/geolocation/chrome_geolocation_permission_context.cc
|
| diff --git a/chrome/browser/geolocation/chrome_geolocation_permission_context.cc b/chrome/browser/geolocation/chrome_geolocation_permission_context.cc
|
| index 6b3eb194fe6acadabffa0c994fc6329b340f242f..6b56989a82de52be511630af2f3d00b9dc64c667 100644
|
| --- a/chrome/browser/geolocation/chrome_geolocation_permission_context.cc
|
| +++ b/chrome/browser/geolocation/chrome_geolocation_permission_context.cc
|
| @@ -114,11 +114,11 @@ void GeolocationPermissionRequest::PermissionDenied() {
|
| }
|
|
|
| void GeolocationPermissionRequest::Cancelled() {
|
| - context_->NotifyPermissionSet(id_, requesting_frame_, callback_, false);
|
| }
|
|
|
| void GeolocationPermissionRequest::RequestFinished() {
|
| - delete this;
|
| + // Deletes 'this'.
|
| + context_->RequestFinished(this);
|
| }
|
|
|
|
|
| @@ -210,7 +210,6 @@ void ChromeGeolocationPermissionContext::CancelGeolocationPermissionRequest(
|
| guest->CancelGeolocationPermissionRequest(bridge_id);
|
| return;
|
| }
|
| - // TODO(gbillock): cancel permission bubble request.
|
| int render_process_id = web_contents->GetRenderProcessHost()->GetID();
|
| int render_view_id = web_contents->GetRenderViewHost()->GetRoutingID();
|
| CancelPendingInfobarRequest(PermissionRequestID(
|
| @@ -243,9 +242,13 @@ void ChromeGeolocationPermissionContext::DecidePermission(
|
| PermissionBubbleManager* mgr =
|
| PermissionBubbleManager::FromWebContents(web_contents);
|
| if (mgr) {
|
| - mgr->AddRequest(new GeolocationPermissionRequest(
|
| + scoped_ptr<GeolocationPermissionRequest> request_ptr(
|
| + new GeolocationPermissionRequest(
|
| this, id, requesting_frame, user_gesture, callback,
|
| profile_->GetPrefs()->GetString(prefs::kAcceptLanguages)));
|
| + GeolocationPermissionRequest* request = request_ptr.get();
|
| + pending_requests_.add(id.ToString(), request_ptr.Pass());
|
| + mgr->AddRequest(request);
|
| }
|
| } else {
|
| // setting == ask. Prompt the user.
|
| @@ -270,6 +273,19 @@ void ChromeGeolocationPermissionContext::CreateInfoBarRequest(
|
| base::Unretained(this), id, requesting_frame, callback));
|
| }
|
|
|
| +void ChromeGeolocationPermissionContext::RequestFinished(
|
| + GeolocationPermissionRequest* request) {
|
| + base::ScopedPtrHashMap<std::string,
|
| + GeolocationPermissionRequest>::iterator it;
|
| + for (it = pending_requests_.begin(); it != pending_requests_.end(); it++) {
|
| + if (it->second == request) {
|
| + pending_requests_.take_and_erase(it);
|
| + return;
|
| + }
|
| + }
|
| +}
|
| +
|
| +
|
| void ChromeGeolocationPermissionContext::ShutdownOnUIThread() {
|
| DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
|
| permission_queue_controller_.reset();
|
| @@ -326,6 +342,18 @@ void ChromeGeolocationPermissionContext::CancelPendingInfobarRequest(
|
| if (shutting_down_)
|
| return;
|
|
|
| - // TODO(gbillock): handle permission bubble cancellation.
|
| + if (PermissionBubbleManager::Enabled()) {
|
| + GeolocationPermissionRequest* cancelling =
|
| + pending_requests_.get(id.ToString());
|
| + content::WebContents* web_contents = tab_util::GetWebContentsByID(
|
| + id.render_process_id(), id.render_view_id());
|
| + if (cancelling != NULL && web_contents != NULL &&
|
| + PermissionBubbleManager::FromWebContents(web_contents) != NULL) {
|
| + PermissionBubbleManager::FromWebContents(web_contents)->
|
| + CancelRequest(cancelling);
|
| + }
|
| + return;
|
| + }
|
| +
|
| QueueController()->CancelInfoBarRequest(id);
|
| }
|
|
|