Chromium Code Reviews| Index: Source/modules/devicelight/DeviceLightDispatcher.h |
| diff --git a/Source/core/speech/SpeechInputResultList.h b/Source/modules/devicelight/DeviceLightDispatcher.h |
| similarity index 54% |
| copy from Source/core/speech/SpeechInputResultList.h |
| copy to Source/modules/devicelight/DeviceLightDispatcher.h |
| index 85eb6a6fb2e3bdd9a553b02d1d2cf51f4f506091..03da5f3c95346ad2bf3f9d4dd9a9460de8a15828 100644 |
| --- a/Source/core/speech/SpeechInputResultList.h |
| +++ b/Source/modules/devicelight/DeviceLightDispatcher.h |
| @@ -1,5 +1,5 @@ |
| /* |
| - * Copyright (C) 2010 Google Inc. All rights reserved. |
| + * Copyright (C) 2014 Intel Inc. All rights reserved. |
| * |
| * Redistribution and use in source and binary forms, with or without |
| * modification, are permitted provided that the following conditions |
| @@ -23,37 +23,42 @@ |
| * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| */ |
| -#ifndef SpeechInputResultList_h |
| -#define SpeechInputResultList_h |
| +#ifndef DeviceLightDispatcher_h |
| +#define DeviceLightDispatcher_h |
| -#if ENABLE(INPUT_SPEECH) |
| - |
| -#include "bindings/v8/ScriptWrappable.h" |
| -#include "core/speech/SpeechInputResult.h" |
| -#include "heap/Handle.h" |
| -#include "wtf/PassRefPtr.h" |
| -#include "wtf/RefCounted.h" |
| +// TODO(riju) make DeviceSensorEventDispatcher.h common to all Device Apis |
| +// by extracting it out of device_orientation |
| +#include "modules/device_orientation/DeviceSensorEventDispatcher.h" |
|
abarth-chromium
2014/03/04 18:59:32
Yeah, we'll need to do that before landing this CL
riju_
2014/03/05 15:47:27
Yes. I will do this in a separate CL to avoid conf
|
| +#include "public/platform/WebDeviceLightListener.h" |
| +#include "wtf/RefPtr.h" |
| namespace WebCore { |
| -class SpeechInputResultList : public RefCountedWillBeGarbageCollectedFinalized<SpeechInputResultList>, public ScriptWrappable { |
| +class DeviceLightController; |
| + |
| +// This class listens to device light data and dispatches it to all |
| +// listening controllers |
| +class DeviceLightDispatcher : public DeviceSensorEventDispatcher, public blink::WebDeviceLightListener { |
| public: |
| - static PassRefPtrWillBeRawPtr<SpeechInputResultList> create(const SpeechInputResultArray& results); |
| + static DeviceLightDispatcher& instance(); |
| - // Methods from the IDL. |
| - size_t length() { return m_results.size(); } |
| - SpeechInputResult* item(unsigned index); |
| + double latestDeviceLightData(); |
| - void trace(Visitor *); |
| + // This method is called every time new device light data is available. |
| + virtual void didChangeDeviceLight(const double&) OVERRIDE; |
| + void addDeviceLightController(DeviceLightController*); |
| + void removeDeviceLightController(DeviceLightController*); |
| private: |
| - explicit SpeechInputResultList(const SpeechInputResultArray& results); |
| + DeviceLightDispatcher(); |
| + ~DeviceLightDispatcher(); |
| - SpeechInputResultArray m_results; |
| + virtual void startListening() OVERRIDE; |
| + virtual void stopListening() OVERRIDE; |
| + |
| + double m_lastDeviceLightData; |
| }; |
| } // namespace WebCore |
| -#endif // ENABLE(INPUT_SPEECH) |
| - |
| -#endif // SpeechInputResultList_h |
| +#endif // DeviceLightDispatcher_h |