| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/browser/geolocation/geolocation_dispatcher_host.h" | 5 #include "content/browser/geolocation/geolocation_dispatcher_host.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <set> | 8 #include <set> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 | 26 |
| 27 void NotifyArbitratorPermissionGranted() { | 27 void NotifyArbitratorPermissionGranted() { |
| 28 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 28 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 29 GeolocationProvider::GetInstance()->OnPermissionGranted(); | 29 GeolocationProvider::GetInstance()->OnPermissionGranted(); |
| 30 } | 30 } |
| 31 | 31 |
| 32 void SendGeolocationPermissionResponse(int render_process_id, | 32 void SendGeolocationPermissionResponse(int render_process_id, |
| 33 int render_view_id, | 33 int render_view_id, |
| 34 int bridge_id, | 34 int bridge_id, |
| 35 bool allowed) { | 35 bool allowed) { |
| 36 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 36 RenderViewHostImpl* r = RenderViewHostImpl::FromID( | 37 RenderViewHostImpl* r = RenderViewHostImpl::FromID( |
| 37 render_process_id, render_view_id); | 38 render_process_id, render_view_id); |
| 38 if (!r) | 39 if (!r) |
| 39 return; | 40 return; |
| 40 r->Send(new GeolocationMsg_PermissionSet(render_view_id, bridge_id, allowed)); | 41 r->Send(new GeolocationMsg_PermissionSet(render_view_id, bridge_id, allowed)); |
| 41 | 42 |
| 42 if (allowed) { | 43 if (allowed) { |
| 43 BrowserThread::PostTask( | 44 BrowserThread::PostTask( |
| 44 BrowserThread::IO, FROM_HERE, | 45 BrowserThread::IO, FROM_HERE, |
| 45 base::Bind(&NotifyArbitratorPermissionGranted)); | 46 base::Bind(&NotifyArbitratorPermissionGranted)); |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 DVLOG(1) << __FUNCTION__ << " " << render_process_id_ << ":" | 143 DVLOG(1) << __FUNCTION__ << " " << render_process_id_ << ":" |
| 143 << render_view_id << ":" << bridge_id; | 144 << render_view_id << ":" << bridge_id; |
| 144 if (geolocation_permission_context_) { | 145 if (geolocation_permission_context_) { |
| 145 geolocation_permission_context_->RequestGeolocationPermission( | 146 geolocation_permission_context_->RequestGeolocationPermission( |
| 146 render_process_id_, render_view_id, bridge_id, | 147 render_process_id_, render_view_id, bridge_id, |
| 147 requesting_frame, | 148 requesting_frame, |
| 148 base::Bind( | 149 base::Bind( |
| 149 &SendGeolocationPermissionResponse, | 150 &SendGeolocationPermissionResponse, |
| 150 render_process_id_, render_view_id, bridge_id)); | 151 render_process_id_, render_view_id, bridge_id)); |
| 151 } else { | 152 } else { |
| 152 SendGeolocationPermissionResponse( | 153 BrowserThread::PostTask( |
| 153 render_process_id_, render_view_id, bridge_id, true); | 154 BrowserThread::UI, FROM_HERE, |
| 155 base::Bind( |
| 156 &SendGeolocationPermissionResponse, |
| 157 render_process_id_, render_view_id, bridge_id, true)); |
| 154 } | 158 } |
| 155 } | 159 } |
| 156 | 160 |
| 157 void GeolocationDispatcherHostImpl::OnCancelPermissionRequest( | 161 void GeolocationDispatcherHostImpl::OnCancelPermissionRequest( |
| 158 int render_view_id, | 162 int render_view_id, |
| 159 int bridge_id, | 163 int bridge_id, |
| 160 const GURL& requesting_frame) { | 164 const GURL& requesting_frame) { |
| 161 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 165 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 162 DVLOG(1) << __FUNCTION__ << " " << render_process_id_ << ":" | 166 DVLOG(1) << __FUNCTION__ << " " << render_process_id_ << ":" |
| 163 << render_view_id << ":" << bridge_id; | 167 << render_view_id << ":" << bridge_id; |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 } | 218 } |
| 215 } // namespace | 219 } // namespace |
| 216 | 220 |
| 217 GeolocationDispatcherHost* GeolocationDispatcherHost::New( | 221 GeolocationDispatcherHost* GeolocationDispatcherHost::New( |
| 218 int render_process_id, | 222 int render_process_id, |
| 219 GeolocationPermissionContext* geolocation_permission_context) { | 223 GeolocationPermissionContext* geolocation_permission_context) { |
| 220 return new GeolocationDispatcherHostImpl( | 224 return new GeolocationDispatcherHostImpl( |
| 221 render_process_id, | 225 render_process_id, |
| 222 geolocation_permission_context); | 226 geolocation_permission_context); |
| 223 } | 227 } |
| OLD | NEW |