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

Unified Diff: third_party/WebKit/Source/modules/sensor/SensorProxy.h

Issue 2458453002: [sensors] Add Permission guard to the generic sensor apis.
Patch Set: Fix comments Created 4 years, 1 month 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/SensorProxy.h
diff --git a/third_party/WebKit/Source/modules/sensor/SensorProxy.h b/third_party/WebKit/Source/modules/sensor/SensorProxy.h
index 4c32534e9ae1a38158f008f63bd99cfdfe4bff11..d880e3a3e3d275e0a7d6b357371b367e119116ab 100644
--- a/third_party/WebKit/Source/modules/sensor/SensorProxy.h
+++ b/third_party/WebKit/Source/modules/sensor/SensorProxy.h
@@ -12,12 +12,15 @@
#include "mojo/public/cpp/bindings/binding.h"
#include "platform/Supplementable.h"
#include "platform/heap/Handle.h"
+#include "public/platform/modules/permissions/permission.mojom-blink.h"
+#include "public/platform/modules/permissions/permission_status.mojom-blink.h"
namespace blink {
class SensorProviderProxy;
class SensorReading;
class SensorReadingFactory;
+class SecurityOrigin;
// This class wraps 'Sensor' mojo interface and used by multiple
// JS sensor instances of the same type (within a single frame).
@@ -80,6 +83,8 @@ class SensorProxy final : public GarbageCollectedFinalized<SensorProxy>,
private:
friend class SensorProviderProxy;
SensorProxy(device::mojom::blink::SensorType,
+ mojom::blink::PermissionService*,
+ RefPtr<SecurityOrigin>,
SensorProviderProxy*,
std::unique_ptr<SensorReadingFactory>);
@@ -87,6 +92,8 @@ class SensorProxy final : public GarbageCollectedFinalized<SensorProxy>,
void RaiseError() override;
void SensorReadingChanged() override;
+ void SensorPermissionChanged();
+
// Generic handler for a fatal error.
// String parameters are intentionally copied.
void handleSensorError(ExceptionCode = UnknownError,
@@ -98,6 +105,8 @@ class SensorProxy final : public GarbageCollectedFinalized<SensorProxy>,
bool tryReadFromBuffer(device::SensorReading& result);
+ void onPermissionUpdate(mojom::blink::PermissionStatus);
+
device::mojom::blink::SensorType m_type;
device::mojom::blink::ReportingMode m_mode;
Member<SensorProviderProxy> m_provider;
@@ -122,6 +131,10 @@ class SensorProxy final : public GarbageCollectedFinalized<SensorProxy>,
sizeof(ReadingBuffer) ==
device::mojom::blink::SensorInitParams::kReadBufferSizeForTests,
"Check reading buffer size for tests");
+
+ mojom::blink::PermissionStatus m_permissionStatus;
+ mojom::blink::PermissionService* m_permissionService;
+ RefPtr<SecurityOrigin> m_securityOrigin;
};
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698