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 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 int bridge_id, | 149 int bridge_id, |
150 const GURL& requesting_frame, | 150 const GURL& requesting_frame, |
151 bool user_gesture) { | 151 bool user_gesture) { |
152 int render_process_id = render_frame_host->GetProcess()->GetID(); | 152 int render_process_id = render_frame_host->GetProcess()->GetID(); |
153 int render_frame_id = render_frame_host->GetRoutingID(); | 153 int render_frame_id = render_frame_host->GetRoutingID(); |
154 | 154 |
155 PendingPermission pending_permission( | 155 PendingPermission pending_permission( |
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()->RequestPermission( |
| 160 content::PERMISSION_GEOLOCATION, |
160 web_contents(), | 161 web_contents(), |
161 bridge_id, | 162 bridge_id, |
162 requesting_frame, | 163 requesting_frame, |
163 user_gesture, | 164 user_gesture, |
164 base::Bind(&GeolocationDispatcherHost::SendGeolocationPermissionResponse, | 165 base::Bind(&GeolocationDispatcherHost::SendGeolocationPermissionResponse, |
165 weak_factory_.GetWeakPtr(), | 166 weak_factory_.GetWeakPtr(), |
166 render_process_id, render_frame_id, bridge_id)); | 167 render_process_id, render_frame_id, bridge_id)); |
167 } | 168 } |
168 | 169 |
169 void GeolocationDispatcherHost::OnCancelPermissionRequest( | 170 void GeolocationDispatcherHost::OnCancelPermissionRequest( |
170 RenderFrameHost* render_frame_host, | 171 RenderFrameHost* render_frame_host, |
171 int bridge_id, | 172 int bridge_id, |
172 const GURL& requesting_frame) { | 173 const GURL& requesting_frame) { |
173 int render_process_id = render_frame_host->GetProcess()->GetID(); | 174 int render_process_id = render_frame_host->GetProcess()->GetID(); |
174 int render_frame_id = render_frame_host->GetRoutingID(); | 175 int render_frame_id = render_frame_host->GetRoutingID(); |
175 for (size_t i = 0; i < pending_permissions_.size(); ++i) { | 176 for (size_t i = 0; i < pending_permissions_.size(); ++i) { |
176 if (pending_permissions_[i].render_process_id == render_process_id && | 177 if (pending_permissions_[i].render_process_id == render_process_id && |
177 pending_permissions_[i].render_frame_id == render_frame_id && | 178 pending_permissions_[i].render_frame_id == render_frame_id && |
178 pending_permissions_[i].bridge_id == bridge_id) { | 179 pending_permissions_[i].bridge_id == bridge_id) { |
179 GetContentClient()->browser()->CancelGeolocationPermissionRequest( | 180 GetContentClient()->browser()->CancelPermissionRequest( |
180 web_contents(), bridge_id, requesting_frame); | 181 content::PERMISSION_GEOLOCATION, |
| 182 web_contents(), bridge_id, requesting_frame); |
181 | 183 |
182 pending_permissions_.erase(pending_permissions_.begin() + i); | 184 pending_permissions_.erase(pending_permissions_.begin() + i); |
183 return; | 185 return; |
184 } | 186 } |
185 } | 187 } |
186 } | 188 } |
187 | 189 |
188 void GeolocationDispatcherHost::OnStartUpdating( | 190 void GeolocationDispatcherHost::OnStartUpdating( |
189 RenderFrameHost* render_frame_host, | 191 RenderFrameHost* render_frame_host, |
190 const GURL& requesting_frame, | 192 const GURL& requesting_frame, |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 | 259 |
258 pending_permissions_.erase(pending_permissions_.begin() + i); | 260 pending_permissions_.erase(pending_permissions_.begin() + i); |
259 return; | 261 return; |
260 } | 262 } |
261 } | 263 } |
262 | 264 |
263 NOTREACHED(); | 265 NOTREACHED(); |
264 } | 266 } |
265 | 267 |
266 } // namespace content | 268 } // namespace content |
OLD | NEW |