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 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
179 void GeolocationDispatcherHost::OnStartUpdating( | 181 void GeolocationDispatcherHost::OnStartUpdating( |
180 RenderFrameHost* render_frame_host, | 182 RenderFrameHost* render_frame_host, |
181 const GURL& requesting_frame, | 183 const GURL& requesting_frame, |
182 bool enable_high_accuracy) { | 184 bool enable_high_accuracy) { |
183 // StartUpdating() can be invoked as a result of high-accuracy mode | 185 // StartUpdating() can be invoked as a result of high-accuracy mode |
184 // being enabled / disabled. No need to record the dispatcher again. | 186 // being enabled / disabled. No need to record the dispatcher again. |
185 UMA_HISTOGRAM_BOOLEAN( | 187 UMA_HISTOGRAM_BOOLEAN( |
186 "Geolocation.GeolocationDispatcherHostImpl.EnableHighAccuracy", | 188 "Geolocation.GeolocationDispatcherHostImpl.EnableHighAccuracy", |
187 enable_high_accuracy); | 189 enable_high_accuracy); |
188 | 190 |
191 GetContentClient()->browser()->UseContentSettingPermission( | |
Michael van Ouwerkerk
2014/07/01 11:02:23
If this is meant to track actual successful usage
Daniel Nishi
2014/07/01 18:37:48
I've moved the call into OnLocationUpdate in the f
| |
192 web_contents(), | |
193 requesting_frame, | |
194 web_contents()->GetLastCommittedURL().GetOrigin(), | |
195 kGeolocationPermission); | |
196 | |
189 updating_frames_[render_frame_host] = enable_high_accuracy; | 197 updating_frames_[render_frame_host] = enable_high_accuracy; |
190 RefreshGeolocationOptions(); | 198 RefreshGeolocationOptions(); |
191 } | 199 } |
192 | 200 |
193 void GeolocationDispatcherHost::OnStopUpdating( | 201 void GeolocationDispatcherHost::OnStopUpdating( |
194 RenderFrameHost* render_frame_host) { | 202 RenderFrameHost* render_frame_host) { |
195 updating_frames_.erase(render_frame_host); | 203 updating_frames_.erase(render_frame_host); |
196 RefreshGeolocationOptions(); | 204 RefreshGeolocationOptions(); |
197 } | 205 } |
198 | 206 |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
248 | 256 |
249 pending_permissions_.erase(pending_permissions_.begin() + i); | 257 pending_permissions_.erase(pending_permissions_.begin() + i); |
250 return; | 258 return; |
251 } | 259 } |
252 } | 260 } |
253 | 261 |
254 NOTREACHED(); | 262 NOTREACHED(); |
255 } | 263 } |
256 | 264 |
257 } // namespace content | 265 } // namespace content |
OLD | NEW |