Chromium Code Reviews| Index: Source/modules/geolocation/Geolocation.cpp |
| diff --git a/Source/modules/geolocation/Geolocation.cpp b/Source/modules/geolocation/Geolocation.cpp |
| index 1aa1d4fc255d5b42a0100056165fa55209e8a4d5..67b0d0ec95ac23c457b6a8fc6006cf56573aba17 100644 |
| --- a/Source/modules/geolocation/Geolocation.cpp |
| +++ b/Source/modules/geolocation/Geolocation.cpp |
| @@ -29,6 +29,7 @@ |
| #include "modules/geolocation/Geolocation.h" |
| #include "core/dom/Document.h" |
| +#include "core/frame/UseCounter.h" |
| #include "modules/geolocation/Coordinates.h" |
| #include "modules/geolocation/GeolocationController.h" |
| #include "modules/geolocation/GeolocationError.h" |
| @@ -137,11 +138,30 @@ Geoposition* Geolocation::lastPosition() |
| return m_lastPosition.get(); |
| } |
| +void Geolocation::RecordOriginTypeAccess() |
| +{ |
| + ASSERT(frame()); |
| + |
| + Document* document = frame()->document(); |
| + if (!document) |
|
Peter Beverloo
2014/10/02 14:58:24
When would there not be a document if we have the
mlamouri (slow - plz ping)
2014/10/02 15:44:54
Done.
|
| + return; |
| + |
| + // It is required but canAccessFeatureRequiringSecureOrigin() but isn't |
| + // actually used. This could be used later if a warning is shown in the |
| + // developer console. |
| + String insecureOriginMsg; |
| + UseCounter::Feature counter = document->securityOrigin()->canAccessFeatureRequiringSecureOrigin(insecureOriginMsg) |
| + ? UseCounter::GeolocationSecureOrigin : UseCounter::GeolocationInsecureOrigin; |
| + UseCounter::count(document, counter); |
|
Peter Beverloo
2014/10/02 14:58:24
I would much prefer this code to use SecurityOrigi
Mike West
2014/10/02 15:04:11
We're using canAccessFeature* for security checks
|
| +} |
| + |
| void Geolocation::getCurrentPosition(PositionCallback* successCallback, PositionErrorCallback* errorCallback, const Dictionary& options) |
| { |
| if (!frame()) |
| return; |
| + RecordOriginTypeAccess(); |
| + |
| GeoNotifier* notifier = GeoNotifier::create(this, successCallback, errorCallback, PositionOptions::create(options)); |
| startRequest(notifier); |
| @@ -153,6 +173,8 @@ int Geolocation::watchPosition(PositionCallback* successCallback, PositionErrorC |
| if (!frame()) |
| return 0; |
| + RecordOriginTypeAccess(); |
| + |
| GeoNotifier* notifier = GeoNotifier::create(this, successCallback, errorCallback, PositionOptions::create(options)); |
| startRequest(notifier); |