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_MEDIA_MIDI_HOST_H_ | 5 #ifndef CONTENT_BROWSER_MEDIA_MIDI_HOST_H_ |
6 #define CONTENT_BROWSER_MEDIA_MIDI_HOST_H_ | 6 #define CONTENT_BROWSER_MEDIA_MIDI_HOST_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 void OnSendData(uint32_t port, | 63 void OnSendData(uint32_t port, |
64 const std::vector<uint8_t>& data, | 64 const std::vector<uint8_t>& data, |
65 double timestamp); | 65 double timestamp); |
66 | 66 |
67 void OnEndSession(); | 67 void OnEndSession(); |
68 | 68 |
69 protected: | 69 protected: |
70 ~MidiHost() override; | 70 ~MidiHost() override; |
71 | 71 |
72 private: | 72 private: |
73 FRIEND_TEST_ALL_PREFIXES(MidiHostTest, IsValidWebMIDIData); | |
74 friend class base::DeleteHelper<MidiHost>; | 73 friend class base::DeleteHelper<MidiHost>; |
75 friend class BrowserThread; | 74 friend class BrowserThread; |
76 | 75 |
77 // Returns true if |data| fulfills the requirements of MidiOutput.send API | |
78 // defined in the Web MIDI spec. | |
79 // - |data| must be any number of complete MIDI messages (data abbreviation | |
80 // called "running status" is disallowed). | |
81 // - 1-byte MIDI realtime messages can be placed at any position of |data|. | |
82 static bool IsValidWebMIDIData(const std::vector<uint8_t>& data); | |
83 | |
84 int renderer_process_id_; | 76 int renderer_process_id_; |
85 | 77 |
86 // Represents if the renderer has a permission to send/receive MIDI SysEX | 78 // Represents if the renderer has a permission to send/receive MIDI SysEX |
87 // messages. | 79 // messages. |
88 bool has_sys_ex_permission_; | 80 bool has_sys_ex_permission_; |
89 | 81 |
90 // Represents if a session is requested to start. | 82 // Represents if a session is requested to start. |
91 bool is_session_requested_; | 83 bool is_session_requested_; |
92 | 84 |
93 // |midi_manager_| talks to the platform-specific MIDI APIs. | 85 // |midi_manager_| talks to the platform-specific MIDI APIs. |
(...skipping 25 matching lines...) Expand all Loading... |
119 | 111 |
120 // Protects access to |output_port_count_|. | 112 // Protects access to |output_port_count_|. |
121 base::Lock output_port_count_lock_; | 113 base::Lock output_port_count_lock_; |
122 | 114 |
123 DISALLOW_COPY_AND_ASSIGN(MidiHost); | 115 DISALLOW_COPY_AND_ASSIGN(MidiHost); |
124 }; | 116 }; |
125 | 117 |
126 } // namespace content | 118 } // namespace content |
127 | 119 |
128 #endif // CONTENT_BROWSER_MEDIA_MIDI_HOST_H_ | 120 #endif // CONTENT_BROWSER_MEDIA_MIDI_HOST_H_ |
OLD | NEW |