| OLD | NEW | 
| (Empty) |  | 
 |   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 | 
 |   3 // found in the LICENSE file. | 
 |   4  | 
 |   5 #ifndef AmbientLightSensorDispatcher_h | 
 |   6 #define AmbientLightSensorDispatcher_h | 
 |   7  | 
 |   8 #include "core/frame/PlatformEventDispatcher.h" | 
 |   9 #include "device/sensor/sensor.mojom.h" | 
 |  10 #include "modules/ModulesExport.h" | 
 |  11 #include "modules/sensor/AmbientLightSensor.h" | 
 |  12 #include "modules/sensor/als_reading.h" | 
 |  13 #include "wtf/OwnPtr.h" | 
 |  14  | 
 |  15 namespace blink { | 
 |  16  | 
 |  17 class MODULES_EXPORT AmbientLightSensorDispatcher final : public GarbageCollecte
    dFinalized<AmbientLightSensorDispatcher>, public PlatformEventDispatcher { | 
 |  18     USING_GARBAGE_COLLECTED_MIXIN(AmbientLightSensorDispatcher); | 
 |  19     WTF_MAKE_NONCOPYABLE(AmbientLightSensorDispatcher); | 
 |  20  | 
 |  21 public: | 
 |  22     static AmbientLightSensorDispatcher& instance(); | 
 |  23  | 
 |  24     const AmbientLightSensorReadingProxy* latestData() const | 
 |  25     { | 
 |  26         return m_hasLatestData ? &m_alsReading : nullptr; | 
 |  27     } | 
 |  28  | 
 |  29 private: | 
 |  30     AmbientLightSensorDispatcher(); | 
 |  31  | 
 |  32     void queryNextReading(); | 
 |  33     void onDidChange(device::AmbientLightSensorReadingPtr); | 
 |  34     void updateSensorReading(const AmbientLightSensorReadingProxy&); | 
 |  35     void startReading(); | 
 |  36     void stopReading(); | 
 |  37  | 
 |  38     // Inherited from PlatformEventDispatcher. | 
 |  39     void startListening() override; | 
 |  40     void stopListening() override; | 
 |  41  | 
 |  42     device::AmbientLightSensorPtr m_lightSensor; | 
 |  43     AmbientLightSensorReadingProxy m_alsReading; | 
 |  44     bool m_hasLatestData; | 
 |  45 }; | 
 |  46  | 
 |  47 } // namespace blink | 
 |  48  | 
 |  49 #endif // AmbientLightSensorDispatcher_h | 
| OLD | NEW |