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

Unified Diff: third_party/WebKit/Source/modules/sensor/Sensor.cpp

Issue 2458453002: [sensors] Add Permission guard to the generic sensor apis.
Patch Set: rebase + blink reformat Created 3 years, 8 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
Index: third_party/WebKit/Source/modules/sensor/Sensor.cpp
diff --git a/third_party/WebKit/Source/modules/sensor/Sensor.cpp b/third_party/WebKit/Source/modules/sensor/Sensor.cpp
index 9f3de1ce7116d82559c6c0eec76461218cb750b4..c58ad80a69318477cb1a2976916c8b6bdfe2c1c1 100644
--- a/third_party/WebKit/Source/modules/sensor/Sensor.cpp
+++ b/third_party/WebKit/Source/modules/sensor/Sensor.cpp
@@ -161,8 +161,12 @@ void Sensor::InitSensorProxyIfNeeded() {
auto provider = SensorProviderProxy::From(document->GetFrame());
sensor_proxy_ = provider->GetSensorProxy(type_);
- if (!sensor_proxy_)
- sensor_proxy_ = provider->CreateSensorProxy(type_, document->GetPage());
+ if (!sensor_proxy_) {
+ RefPtr<SecurityOrigin> origin = GetExecutionContext()->GetSecurityOrigin();
+ DCHECK(origin);
+ sensor_proxy_ = provider->CreateSensorProxy(type_, document->GetPage(),
+ std::move(origin));
+ }
}
void Sensor::ContextDestroyed(ExecutionContext*) {
« no previous file with comments | « third_party/WebKit/Source/modules/sensor/DEPS ('k') | third_party/WebKit/Source/modules/sensor/SensorProviderProxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698