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

Side by Side Diff: third_party/WebKit/Source/modules/sensor/SensorProviderProxy.h

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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 #ifndef SensorProviderProxy_h 5 #ifndef SensorProviderProxy_h
6 #define SensorProviderProxy_h 6 #define SensorProviderProxy_h
7 7
8 #include "core/frame/LocalFrame.h" 8 #include "core/frame/LocalFrame.h"
9 #include "device/generic_sensor/public/interfaces/sensor.mojom-blink.h" 9 #include "device/generic_sensor/public/interfaces/sensor.mojom-blink.h"
10 #include "device/generic_sensor/public/interfaces/sensor_provider.mojom-blink.h" 10 #include "device/generic_sensor/public/interfaces/sensor_provider.mojom-blink.h"
11 #include "platform/Supplementable.h" 11 #include "platform/Supplementable.h"
12 #include "platform/heap/Handle.h" 12 #include "platform/heap/Handle.h"
13 #include "public/platform/modules/permissions/permission.mojom-blink.h"
13 14
14 namespace blink { 15 namespace blink {
15 16
17 class SecurityOrigin;
16 class SensorProxy; 18 class SensorProxy;
17 19
18 // This class wraps 'SensorProvider' mojo interface and it manages 20 // This class wraps 'SensorProvider' mojo interface and it manages
19 // 'SensorProxy' instances. 21 // 'SensorProxy' instances.
20 class SensorProviderProxy final 22 class SensorProviderProxy final
21 : public GarbageCollectedFinalized<SensorProviderProxy>, 23 : public GarbageCollectedFinalized<SensorProviderProxy>,
22 public Supplement<LocalFrame> { 24 public Supplement<LocalFrame> {
23 USING_GARBAGE_COLLECTED_MIXIN(SensorProviderProxy); 25 USING_GARBAGE_COLLECTED_MIXIN(SensorProviderProxy);
24 WTF_MAKE_NONCOPYABLE(SensorProviderProxy); 26 WTF_MAKE_NONCOPYABLE(SensorProviderProxy);
25 27
26 public: 28 public:
27 static SensorProviderProxy* From(LocalFrame*); 29 static SensorProviderProxy* From(LocalFrame*);
28 30
29 ~SensorProviderProxy(); 31 ~SensorProviderProxy();
30 32
31 SensorProxy* CreateSensorProxy(device::mojom::blink::SensorType, Page*); 33 SensorProxy* CreateSensorProxy(device::mojom::blink::SensorType,
34 Page*,
35 RefPtr<SecurityOrigin>);
32 36
33 SensorProxy* GetSensorProxy(device::mojom::blink::SensorType); 37 SensorProxy* GetSensorProxy(device::mojom::blink::SensorType);
34 38
39 void resetPermissionService();
40
35 DECLARE_VIRTUAL_TRACE(); 41 DECLARE_VIRTUAL_TRACE();
36 42
37 private: 43 private:
38 friend class SensorProxy; // To call getSensorProvider(). 44 friend class SensorProxy; // To call getSensorProvider().
39 45
40 explicit SensorProviderProxy(LocalFrame&); 46 explicit SensorProviderProxy(LocalFrame&);
41 static const char* SupplementName(); 47 static const char* SupplementName();
42 void InitializeIfNeeded(LocalFrame*); 48 void InitializeIfNeeded(LocalFrame*);
43 bool IsInitialized() const { return sensor_provider_; } 49 bool IsInitialized() const { return sensor_provider_; }
44 50
45 device::mojom::blink::SensorProvider* GetSensorProvider() const { 51 device::mojom::blink::SensorProvider* GetSensorProvider() const {
46 return sensor_provider_.get(); 52 return sensor_provider_.get();
47 } 53 }
48 54
49 void OnSensorProviderConnectionError(); 55 void OnSensorProviderConnectionError();
50 56
51 using SensorsSet = HeapHashSet<WeakMember<SensorProxy>>; 57 using SensorsSet = HeapHashSet<WeakMember<SensorProxy>>;
52 SensorsSet sensor_proxies_; 58 SensorsSet sensor_proxies_;
53 59
54 device::mojom::blink::SensorProviderPtr sensor_provider_; 60 device::mojom::blink::SensorProviderPtr sensor_provider_;
61 mojom::blink::PermissionServicePtr permission_service_;
55 }; 62 };
56 63
57 } // namespace blink 64 } // namespace blink
58 65
59 #endif // SensorProviderProxy_h 66 #endif // SensorProviderProxy_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/modules/sensor/Sensor.cpp ('k') | third_party/WebKit/Source/modules/sensor/SensorProviderProxy.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698