| Index: third_party/WebKit/Source/modules/sensor/AmbientLightSensorDispatcher.h
 | 
| diff --git a/third_party/WebKit/Source/modules/sensor/AmbientLightSensorDispatcher.h b/third_party/WebKit/Source/modules/sensor/AmbientLightSensorDispatcher.h
 | 
| new file mode 100644
 | 
| index 0000000000000000000000000000000000000000..86cddab32c222ac97c2b7c615f89bdf30d0b7a4b
 | 
| --- /dev/null
 | 
| +++ b/third_party/WebKit/Source/modules/sensor/AmbientLightSensorDispatcher.h
 | 
| @@ -0,0 +1,50 @@
 | 
| +// Copyright 2016 The Chromium Authors. All rights reserved.
 | 
| +// Use of this source code is governed by a BSD-style license that can be
 | 
| +// found in the LICENSE file.
 | 
| +
 | 
| +#ifndef AmbientLightSensorDispatcher_h
 | 
| +#define AmbientLightSensorDispatcher_h
 | 
| +
 | 
| +#include "core/frame/PlatformEventDispatcher.h"
 | 
| +#include "device/sensor/als_reading.mojom-blink.h"
 | 
| +#include "device/sensor/sensor.mojom-blink.h"
 | 
| +#include "modules/ModulesExport.h"
 | 
| +#include "modules/sensor/AmbientLightSensor.h"
 | 
| +#include "modules/sensor/als_reading.h"
 | 
| +#include "wtf/OwnPtr.h"
 | 
| +
 | 
| +namespace blink {
 | 
| +
 | 
| +class MODULES_EXPORT AmbientLightSensorDispatcher final : public GarbageCollectedFinalized<AmbientLightSensorDispatcher>, public PlatformEventDispatcher {
 | 
| +    USING_GARBAGE_COLLECTED_MIXIN(AmbientLightSensorDispatcher);
 | 
| +    WTF_MAKE_NONCOPYABLE(AmbientLightSensorDispatcher);
 | 
| +
 | 
| +public:
 | 
| +    static AmbientLightSensorDispatcher& instance();
 | 
| +
 | 
| +    const AmbientLightSensorReadingProxy* latestData() const
 | 
| +    {
 | 
| +        return m_hasLatestData ? &m_alsReading : nullptr;
 | 
| +    }
 | 
| +
 | 
| +private:
 | 
| +    AmbientLightSensorDispatcher();
 | 
| +
 | 
| +    void queryNextReading();
 | 
| +    void onDidChange(device::blink::AmbientLightSensorReadingPtr);
 | 
| +    void updateSensorReading(const AmbientLightSensorReadingProxy&);
 | 
| +    void startReading();
 | 
| +    void stopReading();
 | 
| +
 | 
| +    // Inherited from PlatformEventDispatcher.
 | 
| +    void startListening() override;
 | 
| +    void stopListening() override;
 | 
| +
 | 
| +    device::blink::AmbientLightSensorPtr m_lightSensor;
 | 
| +    AmbientLightSensorReadingProxy m_alsReading;
 | 
| +    bool m_hasLatestData;
 | 
| +};
 | 
| +
 | 
| +} // namespace blink
 | 
| +
 | 
| +#endif // AmbientLightSensorDispatcher_h
 | 
| 
 |