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.
6 #include "modules/device_light/DeviceLightDispatcher.h"
8 #include "modules/device_light/DeviceLightController.h"
9 #include "public/platform/Platform.h"
13 DeviceLightDispatcher& DeviceLightDispatcher::instance()
15 DEFINE_STATIC_LOCAL(DeviceLightDispatcher, deviceLightDispatcher, ());
16 return deviceLightDispatcher;
19 DeviceLightDispatcher::DeviceLightDispatcher()
20 : m_lastDeviceLightData(-1)
24 DeviceLightDispatcher::~DeviceLightDispatcher()
28 void DeviceLightDispatcher::startListening()
30 blink::Platform::current()->setDeviceLightListener(this);
33 void DeviceLightDispatcher::stopListening()
35 blink::Platform::current()->setDeviceLightListener(0);
36 m_lastDeviceLightData = -1;
39 void DeviceLightDispatcher::didChangeDeviceLight(double value)
41 m_lastDeviceLightData = value;
45 double DeviceLightDispatcher::latestDeviceLightData() const
47 return m_lastDeviceLightData;
50 } // namespace WebCore