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 <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 render_frame_id, render_process_id, bridge_id); | 156 render_frame_id, render_process_id, bridge_id); |
157 pending_permissions_.push_back(pending_permission); | 157 pending_permissions_.push_back(pending_permission); |
158 | 158 |
159 GetContentClient()->browser()->RequestGeolocationPermission( | 159 GetContentClient()->browser()->RequestGeolocationPermission( |
160 web_contents(), | 160 web_contents(), |
161 bridge_id, | 161 bridge_id, |
162 requesting_frame, | 162 requesting_frame, |
163 user_gesture, | 163 user_gesture, |
164 base::Bind(&GeolocationDispatcherHost::SendGeolocationPermissionResponse, | 164 base::Bind(&GeolocationDispatcherHost::SendGeolocationPermissionResponse, |
165 weak_factory_.GetWeakPtr(), | 165 weak_factory_.GetWeakPtr(), |
166 render_process_id, render_frame_id, bridge_id), | 166 render_process_id, render_frame_id, bridge_id)); |
167 &pending_permissions_.back().cancel); | |
168 } | 167 } |
169 | 168 |
170 void GeolocationDispatcherHost::OnCancelPermissionRequest( | 169 void GeolocationDispatcherHost::OnCancelPermissionRequest( |
171 RenderFrameHost* render_frame_host, | 170 RenderFrameHost* render_frame_host, |
172 int bridge_id, | 171 int bridge_id, |
173 const GURL& requesting_frame) { | 172 const GURL& requesting_frame) { |
174 int render_process_id = render_frame_host->GetProcess()->GetID(); | 173 int render_process_id = render_frame_host->GetProcess()->GetID(); |
175 int render_frame_id = render_frame_host->GetRoutingID(); | 174 int render_frame_id = render_frame_host->GetRoutingID(); |
176 for (size_t i = 0; i < pending_permissions_.size(); ++i) { | 175 for (size_t i = 0; i < pending_permissions_.size(); ++i) { |
177 if (pending_permissions_[i].render_process_id == render_process_id && | 176 if (pending_permissions_[i].render_process_id == render_process_id && |
178 pending_permissions_[i].render_frame_id == render_frame_id && | 177 pending_permissions_[i].render_frame_id == render_frame_id && |
179 pending_permissions_[i].bridge_id == bridge_id) { | 178 pending_permissions_[i].bridge_id == bridge_id) { |
180 if (!pending_permissions_[i].cancel.is_null()) | 179 GetContentClient()->browser()->CancelGeolocationPermissionRequest( |
181 pending_permissions_[i].cancel.Run(); | 180 web_contents(), bridge_id, requesting_frame); |
| 181 |
182 pending_permissions_.erase(pending_permissions_.begin() + i); | 182 pending_permissions_.erase(pending_permissions_.begin() + i); |
183 return; | 183 return; |
184 } | 184 } |
185 } | 185 } |
186 } | 186 } |
187 | 187 |
188 void GeolocationDispatcherHost::OnStartUpdating( | 188 void GeolocationDispatcherHost::OnStartUpdating( |
189 RenderFrameHost* render_frame_host, | 189 RenderFrameHost* render_frame_host, |
190 const GURL& requesting_frame, | 190 const GURL& requesting_frame, |
191 bool enable_high_accuracy) { | 191 bool enable_high_accuracy) { |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 | 257 |
258 pending_permissions_.erase(pending_permissions_.begin() + i); | 258 pending_permissions_.erase(pending_permissions_.begin() + i); |
259 return; | 259 return; |
260 } | 260 } |
261 } | 261 } |
262 | 262 |
263 NOTREACHED(); | 263 NOTREACHED(); |
264 } | 264 } |
265 | 265 |
266 } // namespace content | 266 } // namespace content |
OLD | NEW |