| Index: Source/core/platform/midi/MIDIAccessorChromium.h
|
| diff --git a/Source/modules/device_orientation/DeviceMotionDispatcher.h b/Source/core/platform/midi/MIDIAccessorChromium.h
|
| similarity index 56%
|
| copy from Source/modules/device_orientation/DeviceMotionDispatcher.h
|
| copy to Source/core/platform/midi/MIDIAccessorChromium.h
|
| index 54f05670ef6fe0d570f7a0080ab0211472303855..69aa5b4d8acc83fa5f8eae9655ac46decdbe22af 100644
|
| --- a/Source/modules/device_orientation/DeviceMotionDispatcher.h
|
| +++ b/Source/core/platform/midi/MIDIAccessorChromium.h
|
| @@ -28,52 +28,37 @@
|
| * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
| */
|
|
|
| -#ifndef DeviceMotionDispatcher_h
|
| -#define DeviceMotionDispatcher_h
|
| +#ifndef MIDIAccessorChromium_h
|
| +#define MIDIAccessorChromium_h
|
|
|
| -#include "DeviceMotionData.h"
|
| -#include "wtf/RefPtr.h"
|
| -#include "wtf/Vector.h"
|
| -#include "public/platform/WebDeviceMotionListener.h"
|
| +#include "core/platform/midi/MIDIAccessor.h"
|
| +#include "wtf/OwnPtr.h"
|
| +#include "public/platform/WebMIDIAccessor.h"
|
| +#include "public/platform/WebString.h"
|
|
|
| -namespace WebKit {
|
| -class WebDeviceMotionData;
|
| -}
|
| +namespace WebCore {
|
|
|
| -namespace WebCore {
|
| -
|
| -class DeviceMotionController;
|
| -class DeviceMotionData;
|
| -
|
| -// This class listens to device motion data and dispatches it to all
|
| -// listening controllers.
|
| -class DeviceMotionDispatcher : public WebKit::WebDeviceMotionListener {
|
| +class MIDIAccessorChromium : public MIDIAccessor, public WebKit::WebMIDIAccessor::Client {
|
| public:
|
| - static DeviceMotionDispatcher& instance();
|
| -
|
| - void addController(DeviceMotionController*);
|
| - void removeController(DeviceMotionController*);
|
| + MIDIAccessorChromium(MIDIAccessorClient*);
|
| + virtual ~MIDIAccessorChromium() { }
|
|
|
| - // Note that the returned object is owned by this class.
|
| - // FIXME: make the return value const, see crbug.com/233174.
|
| - DeviceMotionData* latestDeviceMotionData();
|
| + // MIDIAccessor
|
| + virtual void requestAccess(int access) OVERRIDE;
|
| + virtual void sendMIDIData(unsigned portIndex, const unsigned char* data, size_t length, double timeStamp) OVERRIDE;
|
|
|
| - // This method is called every time new device motion data is available.
|
| - virtual void didChangeDeviceMotion(const WebKit::WebDeviceMotionData&) OVERRIDE;
|
| + // WebKit::WebMIDIAccessor::Client
|
| + virtual void addInputPort(const WebKit::WebString& id, const WebKit::WebString& manufacturer, const WebKit::WebString& name, const WebKit::WebString& version) OVERRIDE;
|
| + virtual void addOutputPort(const WebKit::WebString& id, const WebKit::WebString& manufacturer, const WebKit::WebString& name, const WebKit::WebString& version) OVERRIDE;
|
| + virtual void accessApproved(bool approved) OVERRIDE;
|
| + virtual void receiveMIDIData(unsigned portIndex, const unsigned char* data, size_t length, double timeStamp) OVERRIDE;
|
|
|
| private:
|
| - DeviceMotionDispatcher();
|
| - ~DeviceMotionDispatcher();
|
| -
|
| - void startListening();
|
| - void stopListening();
|
| -
|
| - void purgeControllers();
|
| + MIDIAccessorClient* m_client;
|
|
|
| - RefPtr<DeviceMotionData> m_lastDeviceMotionData;
|
| - Vector<DeviceMotionController*> m_controllers;
|
| + OwnPtr<WebKit::WebMIDIAccessor> m_accessor;
|
| };
|
|
|
| } // namespace WebCore
|
|
|
| -#endif // DeviceMotionDispatcher_h
|
| +#endif // MIDIAccessorChromium_h
|
|
|