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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 | 96 |
97 // GeolocationDispatcherHost | 97 // GeolocationDispatcherHost |
98 virtual bool OnMessageReceived(const IPC::Message& msg, | 98 virtual bool OnMessageReceived(const IPC::Message& msg, |
99 bool* msg_was_ok) OVERRIDE; | 99 bool* msg_was_ok) OVERRIDE; |
100 | 100 |
101 private: | 101 private: |
102 virtual ~GeolocationDispatcherHostImpl(); | 102 virtual ~GeolocationDispatcherHostImpl(); |
103 | 103 |
104 void OnRequestPermission(int render_view_id, | 104 void OnRequestPermission(int render_view_id, |
105 int bridge_id, | 105 int bridge_id, |
106 const GURL& requesting_frame); | 106 const GURL& requesting_frame, |
| 107 bool user_gesture); |
107 void OnCancelPermissionRequest(int render_view_id, | 108 void OnCancelPermissionRequest(int render_view_id, |
108 int bridge_id, | 109 int bridge_id, |
109 const GURL& requesting_frame); | 110 const GURL& requesting_frame); |
110 void OnStartUpdating(int render_view_id, | 111 void OnStartUpdating(int render_view_id, |
111 const GURL& requesting_frame, | 112 const GURL& requesting_frame, |
112 bool enable_high_accuracy); | 113 bool enable_high_accuracy); |
113 void OnStopUpdating(int render_view_id); | 114 void OnStopUpdating(int render_view_id); |
114 | 115 |
115 | 116 |
116 virtual void PauseOrResume(int render_view_id, bool should_pause) OVERRIDE; | 117 virtual void PauseOrResume(int render_view_id, bool should_pause) OVERRIDE; |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 geolocation_renderers_.begin(); | 197 geolocation_renderers_.begin(); |
197 it != geolocation_renderers_.end(); ++it) { | 198 it != geolocation_renderers_.end(); ++it) { |
198 if (!(it->second.is_paused)) | 199 if (!(it->second.is_paused)) |
199 Send(new GeolocationMsg_PositionUpdated(it->first, geoposition)); | 200 Send(new GeolocationMsg_PositionUpdated(it->first, geoposition)); |
200 } | 201 } |
201 } | 202 } |
202 | 203 |
203 void GeolocationDispatcherHostImpl::OnRequestPermission( | 204 void GeolocationDispatcherHostImpl::OnRequestPermission( |
204 int render_view_id, | 205 int render_view_id, |
205 int bridge_id, | 206 int bridge_id, |
206 const GURL& requesting_frame) { | 207 const GURL& requesting_frame, |
| 208 bool user_gesture) { |
207 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 209 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
208 DVLOG(1) << __FUNCTION__ << " " << render_process_id_ << ":" | 210 DVLOG(1) << __FUNCTION__ << " " << render_process_id_ << ":" |
209 << render_view_id << ":" << bridge_id; | 211 << render_view_id << ":" << bridge_id; |
210 if (geolocation_permission_context_.get()) { | 212 if (geolocation_permission_context_.get()) { |
211 geolocation_permission_context_->RequestGeolocationPermission( | 213 geolocation_permission_context_->RequestGeolocationPermission( |
212 render_process_id_, | 214 render_process_id_, |
213 render_view_id, | 215 render_view_id, |
214 bridge_id, | 216 bridge_id, |
215 requesting_frame, | 217 requesting_frame, |
| 218 user_gesture, |
216 base::Bind(&SendGeolocationPermissionResponse, | 219 base::Bind(&SendGeolocationPermissionResponse, |
217 render_process_id_, | 220 render_process_id_, |
218 render_view_id, | 221 render_view_id, |
219 bridge_id)); | 222 bridge_id)); |
220 } else { | 223 } else { |
221 BrowserThread::PostTask( | 224 BrowserThread::PostTask( |
222 BrowserThread::UI, FROM_HERE, | 225 BrowserThread::UI, FROM_HERE, |
223 base::Bind(&SendGeolocationPermissionResponse, render_process_id_, | 226 base::Bind(&SendGeolocationPermissionResponse, render_process_id_, |
224 render_view_id, bridge_id, true)); | 227 render_view_id, bridge_id, true)); |
225 } | 228 } |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
340 } | 343 } |
341 | 344 |
342 GeolocationDispatcherHost::GeolocationDispatcherHost() | 345 GeolocationDispatcherHost::GeolocationDispatcherHost() |
343 : BrowserMessageFilter(GeolocationMsgStart) { | 346 : BrowserMessageFilter(GeolocationMsgStart) { |
344 } | 347 } |
345 | 348 |
346 GeolocationDispatcherHost::~GeolocationDispatcherHost() { | 349 GeolocationDispatcherHost::~GeolocationDispatcherHost() { |
347 } | 350 } |
348 | 351 |
349 } // namespace content | 352 } // namespace content |
OLD | NEW |