Home | History | Annotate | Download | only in device_light
      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 #ifndef DeviceLightDispatcher_h
      6 #define DeviceLightDispatcher_h
      7 
      8 #include "core/frame/PlatformEventDispatcher.h"
      9 #include "public/platform/WebDeviceLightListener.h"
     10 #include "wtf/RefPtr.h"
     11 
     12 namespace blink {
     13 
     14 class DeviceLightController;
     15 
     16 // This class listens to device light data and notifies all registered controllers.
     17 class DeviceLightDispatcher FINAL : public PlatformEventDispatcher, public WebDeviceLightListener {
     18 public:
     19     static DeviceLightDispatcher& instance();
     20 
     21     double latestDeviceLightData() const;
     22 
     23     // Inherited from WebDeviceLightListener.
     24     virtual void didChangeDeviceLight(double) OVERRIDE;
     25 
     26 private:
     27     DeviceLightDispatcher();
     28     virtual ~DeviceLightDispatcher();
     29 
     30     // Inherited from PlatformEventDispatcher.
     31     virtual void startListening() OVERRIDE;
     32     virtual void stopListening() OVERRIDE;
     33 
     34     double m_lastDeviceLightData;
     35 };
     36 
     37 } // namespace blink
     38 
     39 #endif // DeviceLightDispatcher_h
     40