| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CONTENT_RENDERER_MEDIA_MIDI_MESSAGE_FILTER_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_MIDI_MESSAGE_FILTER_H_ |
| 6 #define CONTENT_RENDERER_MEDIA_MIDI_MESSAGE_FILTER_H_ | 6 #define CONTENT_RENDERER_MEDIA_MIDI_MESSAGE_FILTER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 class CONTENT_EXPORT MIDIMessageFilter | 25 class CONTENT_EXPORT MIDIMessageFilter |
| 26 : public IPC::ChannelProxy::MessageFilter { | 26 : public IPC::ChannelProxy::MessageFilter { |
| 27 public: | 27 public: |
| 28 explicit MIDIMessageFilter( | 28 explicit MIDIMessageFilter( |
| 29 const scoped_refptr<base::MessageLoopProxy>& io_message_loop); | 29 const scoped_refptr<base::MessageLoopProxy>& io_message_loop); |
| 30 | 30 |
| 31 // Each client registers for MIDI access here. | 31 // Each client registers for MIDI access here. |
| 32 // If permission is granted, then the client's | 32 // If permission is granted, then the client's |
| 33 // addInputPort() and addOutputPort() methods will be called, | 33 // addInputPort() and addOutputPort() methods will be called, |
| 34 // giving the client access to receive and send data. | 34 // giving the client access to receive and send data. |
| 35 void RequestAccess(WebKit::WebMIDIAccessorClient* client, int access); | 35 void RequestAccess(const std::string& origin, |
| 36 WebKit::WebMIDIAccessorClient* client, |
| 37 int access); |
| 36 void RemoveClient(WebKit::WebMIDIAccessorClient* client); | 38 void RemoveClient(WebKit::WebMIDIAccessorClient* client); |
| 37 | 39 |
| 38 // A client will only be able to call this method if it has a suitable | 40 // A client will only be able to call this method if it has a suitable |
| 39 // output port (from addOutputPort()). | 41 // output port (from addOutputPort()). |
| 40 void SendMIDIData(int port, | 42 void SendMIDIData(int port, |
| 41 const uint8* data, | 43 const uint8* data, |
| 42 size_t length, | 44 size_t length, |
| 43 double timestamp); | 45 double timestamp); |
| 44 | 46 |
| 45 // IO message loop associated with this message filter. | 47 // IO message loop associated with this message filter. |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 void HandleAccessApproved(int client_id, | 79 void HandleAccessApproved(int client_id, |
| 78 int access, | 80 int access, |
| 79 bool success, | 81 bool success, |
| 80 media::MIDIPortInfoList inputs, | 82 media::MIDIPortInfoList inputs, |
| 81 media::MIDIPortInfoList outputs); | 83 media::MIDIPortInfoList outputs); |
| 82 | 84 |
| 83 void HandleDataReceived(int port, | 85 void HandleDataReceived(int port, |
| 84 const std::vector<uint8>& data, | 86 const std::vector<uint8>& data, |
| 85 double timestamp); | 87 double timestamp); |
| 86 | 88 |
| 87 void RequestAccessOnIOThread(int client_id, int access); | 89 void RequestAccessOnIOThread(const std::string& origin, |
| 90 int client_id, |
| 91 int access); |
| 88 | 92 |
| 89 void SendMIDIDataOnIOThread(int port, | 93 void SendMIDIDataOnIOThread(int port, |
| 90 const std::vector<uint8>& data, | 94 const std::vector<uint8>& data, |
| 91 double timestamp); | 95 double timestamp); |
| 92 | 96 |
| 93 WebKit::WebMIDIAccessorClient* GetClientFromId(int client_id); | 97 WebKit::WebMIDIAccessorClient* GetClientFromId(int client_id); |
| 94 | 98 |
| 95 // IPC channel for Send(); must only be accessed on |io_message_loop_|. | 99 // IPC channel for Send(); must only be accessed on |io_message_loop_|. |
| 96 IPC::Channel* channel_; | 100 IPC::Channel* channel_; |
| 97 | 101 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 110 | 114 |
| 111 // Dishes out client ids. | 115 // Dishes out client ids. |
| 112 int next_available_id_; | 116 int next_available_id_; |
| 113 | 117 |
| 114 DISALLOW_COPY_AND_ASSIGN(MIDIMessageFilter); | 118 DISALLOW_COPY_AND_ASSIGN(MIDIMessageFilter); |
| 115 }; | 119 }; |
| 116 | 120 |
| 117 } // namespace content | 121 } // namespace content |
| 118 | 122 |
| 119 #endif // CONTENT_RENDERER_MEDIA_MIDI_MESSAGE_FILTER_H_ | 123 #endif // CONTENT_RENDERER_MEDIA_MIDI_MESSAGE_FILTER_H_ |
| OLD | NEW |