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_BROWSER_RENDERER_HOST_MEDIA_MIDI_HOST_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_MEDIA_MIDI_HOST_H_ |
6 #define CONTENT_BROWSER_RENDERER_HOST_MEDIA_MIDI_HOST_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_MEDIA_MIDI_HOST_H_ |
7 | 7 |
| 8 #include <vector> |
| 9 |
8 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
9 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
10 #include "content/common/content_export.h" | 12 #include "content/common/content_export.h" |
11 #include "content/public/browser/browser_message_filter.h" | 13 #include "content/public/browser/browser_message_filter.h" |
12 #include "content/public/browser/browser_thread.h" | 14 #include "content/public/browser/browser_thread.h" |
13 #include "media/midi/midi_manager.h" | 15 #include "media/midi/midi_manager.h" |
14 | 16 |
15 namespace media { | 17 namespace media { |
16 class MIDIManager; | 18 class MIDIManager; |
17 } | 19 } |
18 | 20 |
19 namespace content { | 21 namespace content { |
20 | 22 |
21 class CONTENT_EXPORT MIDIHost | 23 class CONTENT_EXPORT MIDIHost |
22 : public BrowserMessageFilter, | 24 : public BrowserMessageFilter, |
23 public media::MIDIManagerClient { | 25 public media::MIDIManagerClient { |
24 public: | 26 public: |
25 // Called from UI thread from the owner of this object. | 27 // Called from UI thread from the owner of this object. |
26 MIDIHost(media::MIDIManager* midi_manager); | 28 MIDIHost(media::MIDIManager* midi_manager); |
27 | 29 |
28 // BrowserMessageFilter implementation. | 30 // BrowserMessageFilter implementation. |
29 virtual void OnChannelClosing() OVERRIDE; | 31 virtual void OnChannelClosing() OVERRIDE; |
30 virtual void OnDestruct() const OVERRIDE; | 32 virtual void OnDestruct() const OVERRIDE; |
31 virtual bool OnMessageReceived(const IPC::Message& message, | 33 virtual bool OnMessageReceived(const IPC::Message& message, |
32 bool* message_was_ok) OVERRIDE; | 34 bool* message_was_ok) OVERRIDE; |
33 | 35 |
34 // MIDIManagerClient implementation. | 36 // MIDIManagerClient implementation. |
35 virtual void ReceiveMIDIData( | 37 virtual void ReceiveMIDIData( |
36 int port_index, | 38 uint32 port, |
37 const uint8* data, | 39 const uint8* data, |
38 size_t length, | 40 size_t length, |
39 double timestamp) OVERRIDE; | 41 double timestamp) OVERRIDE; |
40 virtual void AccumulateMIDIBytesSent(size_t n) OVERRIDE; | 42 virtual void AccumulateMIDIBytesSent(size_t n) OVERRIDE; |
41 | 43 |
42 // Start session to access MIDI hardware. | 44 // Start session to access MIDI hardware. |
43 void OnStartSession(int client_id); | 45 void OnStartSession(int client_id); |
44 | 46 |
45 // Data to be sent to a MIDI output port. | 47 // Data to be sent to a MIDI output port. |
46 void OnSendData(int port, | 48 void OnSendData(uint32 port, |
47 const std::vector<uint8>& data, | 49 const std::vector<uint8>& data, |
48 double timestamp); | 50 double timestamp); |
49 | 51 |
50 private: | 52 private: |
51 friend class base::DeleteHelper<MIDIHost>; | 53 friend class base::DeleteHelper<MIDIHost>; |
52 friend class BrowserThread; | 54 friend class BrowserThread; |
53 | 55 |
54 virtual ~MIDIHost(); | 56 virtual ~MIDIHost(); |
55 | 57 |
56 // |midi_manager_| talks to the platform-specific MIDI APIs. | 58 // |midi_manager_| talks to the platform-specific MIDI APIs. |
(...skipping 13 matching lines...) Expand all Loading... |
70 | 72 |
71 // Protects access to |sent_bytes_in_flight_|. | 73 // Protects access to |sent_bytes_in_flight_|. |
72 base::Lock in_flight_lock_; | 74 base::Lock in_flight_lock_; |
73 | 75 |
74 DISALLOW_COPY_AND_ASSIGN(MIDIHost); | 76 DISALLOW_COPY_AND_ASSIGN(MIDIHost); |
75 }; | 77 }; |
76 | 78 |
77 } // namespace content | 79 } // namespace content |
78 | 80 |
79 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_MIDI_HOST_H_ | 81 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_MIDI_HOST_H_ |
OLD | NEW |