Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(565)

Unified Diff: Source/modules/geolocation/Geolocation.cpp

Issue 620003005: Record whether Geolocation is accessed from a secure origin. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@screen_orientation_use_counter
Patch Set: nits Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/modules/geolocation/Geolocation.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/geolocation/Geolocation.cpp
diff --git a/Source/modules/geolocation/Geolocation.cpp b/Source/modules/geolocation/Geolocation.cpp
index 1aa1d4fc255d5b42a0100056165fa55209e8a4d5..1a5375907ac4ef06a4d2c50dd4acef12b77b4088 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,29 @@ Geoposition* Geolocation::lastPosition()
return m_lastPosition.get();
}
+void Geolocation::recordOriginTypeAccess() const
+{
+ ASSERT(frame());
+
+ Document* doc = document();
Michael van Ouwerkerk 2014/10/02 15:47:26 Please don't use abbreviations for variables witho
+ ASSERT(doc);
+
+ // It is required but canAccessFeatureRequiringSecureOrigin() but isn't
Michael van Ouwerkerk 2014/10/02 15:47:26 but but?
Peter Beverloo 2014/10/02 15:49:24 s/canAccessFeatureRequiringSecureOrigin()/insecure
+ // actually used. This could be used later if a warning is shown in the
+ // developer console.
+ String insecureOriginMsg;
+ UseCounter::Feature counter = doc->securityOrigin()->canAccessFeatureRequiringSecureOrigin(insecureOriginMsg)
+ ? UseCounter::GeolocationSecureOrigin : UseCounter::GeolocationInsecureOrigin;
+ UseCounter::count(doc, counter);
+}
+
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 +172,8 @@ int Geolocation::watchPosition(PositionCallback* successCallback, PositionErrorC
if (!frame())
return 0;
+ recordOriginTypeAccess();
+
GeoNotifier* notifier = GeoNotifier::create(this, successCallback, errorCallback, PositionOptions::create(options));
startRequest(notifier);
« no previous file with comments | « Source/modules/geolocation/Geolocation.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698