| 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 20 matching lines...) Expand all Loading... |
| 31 #ifndef WebMIDIAccessorClient_h | 31 #ifndef WebMIDIAccessorClient_h |
| 32 #define WebMIDIAccessorClient_h | 32 #define WebMIDIAccessorClient_h |
| 33 | 33 |
| 34 #include "media/midi/midi_service.mojom-shared.h" | 34 #include "media/midi/midi_service.mojom-shared.h" |
| 35 #include "public/platform/WebString.h" | 35 #include "public/platform/WebString.h" |
| 36 | 36 |
| 37 namespace blink { | 37 namespace blink { |
| 38 | 38 |
| 39 class WebMIDIAccessorClient { | 39 class WebMIDIAccessorClient { |
| 40 public: | 40 public: |
| 41 enum MIDIPortState { | |
| 42 MIDIPortStateDisconnected, | |
| 43 MIDIPortStateConnected, | |
| 44 }; | |
| 45 | |
| 46 // didAddInputPort() and didAddOutputPort() can be called before and after | 41 // didAddInputPort() and didAddOutputPort() can be called before and after |
| 47 // didStartSession() is called. But |id| should be unique in each function. | 42 // didStartSession() is called. But |id| should be unique in each function. |
| 48 virtual void didAddInputPort(const WebString& id, | 43 virtual void didAddInputPort(const WebString& id, |
| 49 const WebString& manufacturer, | 44 const WebString& manufacturer, |
| 50 const WebString& name, | 45 const WebString& name, |
| 51 const WebString& version, | 46 const WebString& version, |
| 52 MIDIPortState) = 0; | 47 midi::mojom::PortState) = 0; |
| 53 virtual void didAddOutputPort(const WebString& id, | 48 virtual void didAddOutputPort(const WebString& id, |
| 54 const WebString& manufacturer, | 49 const WebString& manufacturer, |
| 55 const WebString& name, | 50 const WebString& name, |
| 56 const WebString& version, | 51 const WebString& version, |
| 57 MIDIPortState) = 0; | 52 midi::mojom::PortState) = 0; |
| 58 // didSetInputPortState() and didSetOutputPortState() should not be called | 53 // didSetInputPortState() and didSetOutputPortState() should not be called |
| 59 // until didStartSession() is called. | 54 // until didStartSession() is called. |
| 60 virtual void didSetInputPortState(unsigned portIndex, MIDIPortState) = 0; | 55 virtual void didSetInputPortState(unsigned portIndex, |
| 61 virtual void didSetOutputPortState(unsigned portIndex, MIDIPortState) = 0; | 56 midi::mojom::PortState) = 0; |
| 57 virtual void didSetOutputPortState(unsigned portIndex, |
| 58 midi::mojom::PortState) = 0; |
| 62 | 59 |
| 63 virtual void didStartSession(midi::mojom::Result) = 0; | 60 virtual void didStartSession(midi::mojom::Result) = 0; |
| 64 | 61 |
| 65 // |timeStamp| is in milliseconds according to the Web MIDI API. | 62 // |timeStamp| is in milliseconds according to the Web MIDI API. |
| 66 virtual void didReceiveMIDIData(unsigned portIndex, | 63 virtual void didReceiveMIDIData(unsigned portIndex, |
| 67 const unsigned char* data, | 64 const unsigned char* data, |
| 68 size_t length, | 65 size_t length, |
| 69 double timeStamp) = 0; | 66 double timeStamp) = 0; |
| 70 | 67 |
| 71 protected: | 68 protected: |
| 72 virtual ~WebMIDIAccessorClient() {} | 69 virtual ~WebMIDIAccessorClient() {} |
| 73 }; | 70 }; |
| 74 | 71 |
| 75 } // namespace blink | 72 } // namespace blink |
| 76 | 73 |
| 77 #endif // WebMIDIAccessorClient_h | 74 #endif // WebMIDIAccessorClient_h |
| OLD | NEW |