| 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 | 53 |
| 54 // GeolocationDispatcherHost | 54 // GeolocationDispatcherHost |
| 55 virtual bool OnMessageReceived(const IPC::Message& msg, | 55 virtual bool OnMessageReceived(const IPC::Message& msg, |
| 56 bool* msg_was_ok) OVERRIDE; | 56 bool* msg_was_ok) OVERRIDE; |
| 57 | 57 |
| 58 private: | 58 private: |
| 59 virtual ~GeolocationDispatcherHostImpl(); | 59 virtual ~GeolocationDispatcherHostImpl(); |
| 60 | 60 |
| 61 void OnRequestPermission(int render_view_id, | 61 void OnRequestPermission(int render_view_id, |
| 62 int bridge_id, | 62 int bridge_id, |
| 63 const GURL& requesting_frame); | 63 const GURL& requesting_frame, |
| 64 bool user_gesture); |
| 64 void OnCancelPermissionRequest(int render_view_id, | 65 void OnCancelPermissionRequest(int render_view_id, |
| 65 int bridge_id, | 66 int bridge_id, |
| 66 const GURL& requesting_frame); | 67 const GURL& requesting_frame); |
| 67 void OnStartUpdating(int render_view_id, | 68 void OnStartUpdating(int render_view_id, |
| 68 const GURL& requesting_frame, | 69 const GURL& requesting_frame, |
| 69 bool enable_high_accuracy); | 70 bool enable_high_accuracy); |
| 70 void OnStopUpdating(int render_view_id); | 71 void OnStopUpdating(int render_view_id); |
| 71 | 72 |
| 72 | 73 |
| 73 virtual void PauseOrResume(int render_view_id, bool should_pause) OVERRIDE; | 74 virtual void PauseOrResume(int render_view_id, bool should_pause) OVERRIDE; |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 geolocation_renderers_.begin(); | 153 geolocation_renderers_.begin(); |
| 153 it != geolocation_renderers_.end(); ++it) { | 154 it != geolocation_renderers_.end(); ++it) { |
| 154 if (!(it->second.is_paused)) | 155 if (!(it->second.is_paused)) |
| 155 Send(new GeolocationMsg_PositionUpdated(it->first, geoposition)); | 156 Send(new GeolocationMsg_PositionUpdated(it->first, geoposition)); |
| 156 } | 157 } |
| 157 } | 158 } |
| 158 | 159 |
| 159 void GeolocationDispatcherHostImpl::OnRequestPermission( | 160 void GeolocationDispatcherHostImpl::OnRequestPermission( |
| 160 int render_view_id, | 161 int render_view_id, |
| 161 int bridge_id, | 162 int bridge_id, |
| 162 const GURL& requesting_frame) { | 163 const GURL& requesting_frame, |
| 164 bool user_gesture) { |
| 163 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 165 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 164 DVLOG(1) << __FUNCTION__ << " " << render_process_id_ << ":" | 166 DVLOG(1) << __FUNCTION__ << " " << render_process_id_ << ":" |
| 165 << render_view_id << ":" << bridge_id; | 167 << render_view_id << ":" << bridge_id; |
| 166 if (geolocation_permission_context_.get()) { | 168 if (geolocation_permission_context_.get()) { |
| 167 geolocation_permission_context_->RequestGeolocationPermission( | 169 geolocation_permission_context_->RequestGeolocationPermission( |
| 168 render_process_id_, | 170 render_process_id_, |
| 169 render_view_id, | 171 render_view_id, |
| 170 bridge_id, | 172 bridge_id, |
| 171 requesting_frame, | 173 requesting_frame, |
| 174 user_gesture, |
| 172 base::Bind(&SendGeolocationPermissionResponse, | 175 base::Bind(&SendGeolocationPermissionResponse, |
| 173 render_process_id_, | 176 render_process_id_, |
| 174 render_view_id, | 177 render_view_id, |
| 175 bridge_id)); | 178 bridge_id)); |
| 176 } else { | 179 } else { |
| 177 BrowserThread::PostTask( | 180 BrowserThread::PostTask( |
| 178 BrowserThread::UI, FROM_HERE, | 181 BrowserThread::UI, FROM_HERE, |
| 179 base::Bind(&SendGeolocationPermissionResponse, render_process_id_, | 182 base::Bind(&SendGeolocationPermissionResponse, render_process_id_, |
| 180 render_view_id, bridge_id, true)); | 183 render_view_id, bridge_id, true)); |
| 181 } | 184 } |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 296 } | 299 } |
| 297 | 300 |
| 298 GeolocationDispatcherHost::GeolocationDispatcherHost() | 301 GeolocationDispatcherHost::GeolocationDispatcherHost() |
| 299 : BrowserMessageFilter(GeolocationMsgStart) { | 302 : BrowserMessageFilter(GeolocationMsgStart) { |
| 300 } | 303 } |
| 301 | 304 |
| 302 GeolocationDispatcherHost::~GeolocationDispatcherHost() { | 305 GeolocationDispatcherHost::~GeolocationDispatcherHost() { |
| 303 } | 306 } |
| 304 | 307 |
| 305 } // namespace content | 308 } // namespace content |
| OLD | NEW |