| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 | 33 |
| 34 #include "public/platform/WebMIDIAccessor.h" | 34 #include "public/platform/WebMIDIAccessor.h" |
| 35 #include "public/platform/WebMIDIAccessorClient.h" | 35 #include "public/platform/WebMIDIAccessorClient.h" |
| 36 #include "wtf/OwnPtr.h" | 36 #include "wtf/OwnPtr.h" |
| 37 #include "wtf/PassOwnPtr.h" | 37 #include "wtf/PassOwnPtr.h" |
| 38 | 38 |
| 39 namespace blink { | 39 namespace blink { |
| 40 | 40 |
| 41 class MIDIAccessorClient; | 41 class MIDIAccessorClient; |
| 42 | 42 |
| 43 class MIDIAccessor FINAL : public WebMIDIAccessorClient { | 43 class MIDIAccessor final : public WebMIDIAccessorClient { |
| 44 public: | 44 public: |
| 45 static PassOwnPtr<MIDIAccessor> create(MIDIAccessorClient*); | 45 static PassOwnPtr<MIDIAccessor> create(MIDIAccessorClient*); |
| 46 | 46 |
| 47 virtual ~MIDIAccessor() { } | 47 virtual ~MIDIAccessor() { } |
| 48 | 48 |
| 49 void startSession(); | 49 void startSession(); |
| 50 void sendMIDIData(unsigned portIndex, const unsigned char* data, size_t leng
th, double timeStamp); | 50 void sendMIDIData(unsigned portIndex, const unsigned char* data, size_t leng
th, double timeStamp); |
| 51 // MIDIAccessInitializer and MIDIAccess are both MIDIAccessClient. | 51 // MIDIAccessInitializer and MIDIAccess are both MIDIAccessClient. |
| 52 // MIDIAccessInitializer is the first client and MIDIAccess takes over it | 52 // MIDIAccessInitializer is the first client and MIDIAccess takes over it |
| 53 // once the initialization successfully finishes. | 53 // once the initialization successfully finishes. |
| 54 void setClient(MIDIAccessorClient* client) { m_client = client; } | 54 void setClient(MIDIAccessorClient* client) { m_client = client; } |
| 55 | 55 |
| 56 // WebMIDIAccessorClient | 56 // WebMIDIAccessorClient |
| 57 virtual void didAddInputPort(const WebString& id, const WebString& manufactu
rer, const WebString& name, const WebString& version) OVERRIDE; | 57 virtual void didAddInputPort(const WebString& id, const WebString& manufactu
rer, const WebString& name, const WebString& version) override; |
| 58 virtual void didAddOutputPort(const WebString& id, const WebString& manufact
urer, const WebString& name, const WebString& version) OVERRIDE; | 58 virtual void didAddOutputPort(const WebString& id, const WebString& manufact
urer, const WebString& name, const WebString& version) override; |
| 59 virtual void didStartSession(bool success, const WebString& error, const Web
String& message) OVERRIDE; | 59 virtual void didStartSession(bool success, const WebString& error, const Web
String& message) override; |
| 60 virtual void didReceiveMIDIData(unsigned portIndex, const unsigned char* dat
a, size_t length, double timeStamp) OVERRIDE; | 60 virtual void didReceiveMIDIData(unsigned portIndex, const unsigned char* dat
a, size_t length, double timeStamp) override; |
| 61 | 61 |
| 62 private: | 62 private: |
| 63 explicit MIDIAccessor(MIDIAccessorClient*); | 63 explicit MIDIAccessor(MIDIAccessorClient*); |
| 64 | 64 |
| 65 MIDIAccessorClient* m_client; | 65 MIDIAccessorClient* m_client; |
| 66 OwnPtr<WebMIDIAccessor> m_accessor; | 66 OwnPtr<WebMIDIAccessor> m_accessor; |
| 67 }; | 67 }; |
| 68 | 68 |
| 69 } // namespace blink | 69 } // namespace blink |
| 70 | 70 |
| 71 #endif // MIDIAccessor_h | 71 #endif // MIDIAccessor_h |
| OLD | NEW |