Chromium Code Reviews| 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" |
| 11 #include "content/browser/frame_host/render_frame_host_impl.h" | 11 #include "content/browser/frame_host/render_frame_host_impl.h" |
| 12 #include "content/browser/renderer_host/render_message_filter.h" | 12 #include "content/browser/renderer_host/render_message_filter.h" |
| 13 #include "content/browser/renderer_host/render_process_host_impl.h" | 13 #include "content/browser/renderer_host/render_process_host_impl.h" |
| 14 #include "content/browser/renderer_host/render_view_host_impl.h" | 14 #include "content/browser/renderer_host/render_view_host_impl.h" |
| 15 #include "content/browser/web_contents/web_contents_impl.h" | 15 #include "content/browser/web_contents/web_contents_impl.h" |
| 16 #include "content/public/browser/browser_context.h" | 16 #include "content/public/browser/browser_context.h" |
| 17 #include "content/public/browser/content_browser_client.h" | 17 #include "content/public/browser/content_browser_client.h" |
| 18 #include "content/public/common/geoposition.h" | 18 #include "content/public/common/geoposition.h" |
| 19 #include "content/common/geolocation_messages.h" | 19 #include "content/common/geolocation_messages.h" |
| 20 | 20 |
| 21 namespace content { | 21 namespace content { |
| 22 namespace { | 22 namespace { |
| 23 | 23 |
| 24 const char kGeolocationPermission[] = "geolocation"; | |
| 25 | |
| 24 // Geoposition error codes for reporting in UMA. | 26 // Geoposition error codes for reporting in UMA. |
| 25 enum GeopositionErrorCode { | 27 enum GeopositionErrorCode { |
| 26 // NOTE: Do not renumber these as that would confuse interpretation of | 28 // NOTE: Do not renumber these as that would confuse interpretation of |
| 27 // previously logged data. When making changes, also update the enum list | 29 // previously logged data. When making changes, also update the enum list |
| 28 // in tools/metrics/histograms/histograms.xml to keep it in sync. | 30 // in tools/metrics/histograms/histograms.xml to keep it in sync. |
| 29 | 31 |
| 30 // There was no error. | 32 // There was no error. |
| 31 GEOPOSITION_ERROR_CODE_NONE = 0, | 33 GEOPOSITION_ERROR_CODE_NONE = 0, |
| 32 | 34 |
| 33 // User denied use of geolocation. | 35 // User denied use of geolocation. |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 123 void GeolocationDispatcherHost::OnLocationUpdate( | 125 void GeolocationDispatcherHost::OnLocationUpdate( |
| 124 const Geoposition& geoposition) { | 126 const Geoposition& geoposition) { |
| 125 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 127 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 126 | 128 |
| 127 RecordGeopositionErrorCode(geoposition.error_code); | 129 RecordGeopositionErrorCode(geoposition.error_code); |
| 128 if (paused_) | 130 if (paused_) |
| 129 return; | 131 return; |
| 130 | 132 |
| 131 for (std::map<RenderFrameHost*, bool>::iterator i = updating_frames_.begin(); | 133 for (std::map<RenderFrameHost*, bool>::iterator i = updating_frames_.begin(); |
| 132 i != updating_frames_.end(); ++i) { | 134 i != updating_frames_.end(); ++i) { |
| 135 GetContentClient()->browser()->UseContentSettingPermission( | |
| 136 web_contents(), | |
| 137 i->first->GetLastCommittedURL().GetOrigin(), | |
| 138 i->first->GetLastCommittedURL().GetOrigin(), | |
|
Michael van Ouwerkerk
2014/07/02 18:51:15
If I understand correctly, this should be the url
Daniel Nishi
2014/07/07 17:46:40
Done. We traverse the parents now.
| |
| 139 kGeolocationPermission); | |
| 133 i->first->Send(new GeolocationMsg_PositionUpdated( | 140 i->first->Send(new GeolocationMsg_PositionUpdated( |
| 134 i->first->GetRoutingID(), geoposition)); | 141 i->first->GetRoutingID(), geoposition)); |
| 135 } | 142 } |
| 136 } | 143 } |
| 137 | 144 |
| 138 void GeolocationDispatcherHost::OnRequestPermission( | 145 void GeolocationDispatcherHost::OnRequestPermission( |
| 139 RenderFrameHost* render_frame_host, | 146 RenderFrameHost* render_frame_host, |
| 140 int bridge_id, | 147 int bridge_id, |
| 141 const GURL& requesting_frame, | 148 const GURL& requesting_frame, |
| 142 bool user_gesture) { | 149 bool user_gesture) { |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 248 | 255 |
| 249 pending_permissions_.erase(pending_permissions_.begin() + i); | 256 pending_permissions_.erase(pending_permissions_.begin() + i); |
| 250 return; | 257 return; |
| 251 } | 258 } |
| 252 } | 259 } |
| 253 | 260 |
| 254 NOTREACHED(); | 261 NOTREACHED(); |
| 255 } | 262 } |
| 256 | 263 |
| 257 } // namespace content | 264 } // namespace content |
| OLD | NEW |