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

Side by Side Diff: third_party/WebKit/Source/modules/device_light/DeviceLightDispatcher.cpp

Issue 2823753002: Remove device light API
Patch Set: Restore DeviceLightEvent to LayoutTests/external/wpt/dom/nodes/Document-createEvent.html 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
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "modules/device_light/DeviceLightDispatcher.h"
6
7 #include "modules/device_light/DeviceLightController.h"
8 #include "public/platform/Platform.h"
9
10 namespace blink {
11
12 DeviceLightDispatcher& DeviceLightDispatcher::instance() {
13 DEFINE_STATIC_LOCAL(DeviceLightDispatcher, deviceLightDispatcher,
14 (new DeviceLightDispatcher));
15 return deviceLightDispatcher;
16 }
17
18 DeviceLightDispatcher::DeviceLightDispatcher() : m_lastDeviceLightData(-1) {}
19
20 DeviceLightDispatcher::~DeviceLightDispatcher() {}
21
22 DEFINE_TRACE(DeviceLightDispatcher) {
23 PlatformEventDispatcher::trace(visitor);
24 }
25
26 void DeviceLightDispatcher::startListening() {
27 Platform::current()->startListening(WebPlatformEventTypeDeviceLight, this);
28 }
29
30 void DeviceLightDispatcher::stopListening() {
31 Platform::current()->stopListening(WebPlatformEventTypeDeviceLight);
32 m_lastDeviceLightData = -1;
33 }
34
35 void DeviceLightDispatcher::didChangeDeviceLight(double value) {
36 m_lastDeviceLightData = value;
37 notifyControllers();
38 }
39
40 double DeviceLightDispatcher::latestDeviceLightData() const {
41 return m_lastDeviceLightData;
42 }
43
44 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698