OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CONTENT_BROWSER_RENDERER_HOST_MEDIA_MIDI_HOST_H_ | |
6 #define CONTENT_BROWSER_RENDERER_HOST_MEDIA_MIDI_HOST_H_ | |
7 | |
8 #include "base/memory/ref_counted.h" | |
9 #include "base/memory/scoped_ptr.h" | |
10 #include "content/common/content_export.h" | |
11 #include "content/public/browser/browser_message_filter.h" | |
12 #include "content/public/browser/browser_thread.h" | |
13 #include "media/midi/midi_manager.h" | |
14 | |
15 namespace media { | |
16 class MIDIManager; | |
17 } | |
18 | |
19 namespace content { | |
20 | |
21 class CONTENT_EXPORT MIDIHost | |
22 : public BrowserMessageFilter, | |
23 public media::MIDIManagerClient { | |
24 public: | |
25 // Called from UI thread from the owner of this object. | |
26 MIDIHost(media::MIDIManager* midi_manager); | |
27 | |
28 // BrowserMessageFilter implementation. | |
29 virtual void OnChannelClosing() OVERRIDE; | |
30 virtual void OnDestruct() const OVERRIDE; | |
31 virtual bool OnMessageReceived(const IPC::Message& message, | |
32 bool* message_was_ok) OVERRIDE; | |
33 | |
34 // MIDIManagerClient implementation. | |
35 virtual void ReceiveMIDIData( | |
36 int port_index, | |
37 const uint8* data, | |
38 size_t length, | |
39 double timestamp) OVERRIDE; | |
40 | |
41 // Request access to MIDI hardware. | |
42 void OnRequestAccess(int client_id, int access); | |
43 | |
44 // Data to be sent to a MIDI output port. | |
45 void OnSendData(int port, | |
46 const std::vector<uint8>& data, | |
47 double timestamp); | |
48 | |
49 private: | |
50 friend class base::DeleteHelper<MIDIHost>; | |
51 friend class BrowserThread; | |
52 | |
53 virtual ~MIDIHost(); | |
54 | |
55 media::MIDIManager* const midi_manager_; | |
56 | |
57 DISALLOW_COPY_AND_ASSIGN(MIDIHost); | |
58 }; | |
59 | |
60 } // namespace content | |
61 | |
62 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_MIDI_HOST_H_ | |
OLD | NEW |