| 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 |
| 11 #include <memory> | 11 #include <memory> |
| 12 #include <vector> | 12 #include <vector> |
| 13 | 13 |
| 14 #include "base/gtest_prod_util.h" | 14 #include "base/gtest_prod_util.h" |
| 15 #include "base/macros.h" | 15 #include "base/macros.h" |
| 16 #include "base/memory/ref_counted.h" | 16 #include "base/memory/ref_counted.h" |
| 17 #include "base/memory/scoped_vector.h" | 17 #include "base/memory/scoped_vector.h" |
| 18 #include "base/synchronization/lock.h" | 18 #include "base/synchronization/lock.h" |
| 19 #include "content/common/content_export.h" | 19 #include "content/common/content_export.h" |
| 20 #include "content/public/browser/browser_message_filter.h" | 20 #include "content/public/browser/browser_message_filter.h" |
| 21 #include "content/public/browser/browser_thread.h" | 21 #include "content/public/browser/browser_thread.h" |
| 22 #include "media/midi/midi_manager.h" | 22 #include "media/midi/midi_manager.h" |
| 23 #include "media/midi/midi_port_info.h" | 23 #include "media/midi/midi_port_info.h" |
| 24 #include "media/midi/midi_service.mojom.h" |
| 24 | 25 |
| 25 namespace midi { | 26 namespace midi { |
| 26 class MidiManager; | 27 class MidiManager; |
| 27 class MidiMessageQueue; | 28 class MidiMessageQueue; |
| 28 } // namespace midi | 29 } // namespace midi |
| 29 | 30 |
| 30 namespace content { | 31 namespace content { |
| 31 | 32 |
| 32 class CONTENT_EXPORT MidiHost : public BrowserMessageFilter, | 33 class CONTENT_EXPORT MidiHost : public BrowserMessageFilter, |
| 33 public midi::MidiManagerClient { | 34 public midi::MidiManagerClient { |
| 34 public: | 35 public: |
| 35 // Called from UI thread from the owner of this object. | 36 // Called from UI thread from the owner of this object. |
| 36 MidiHost(int renderer_process_id, midi::MidiManager* midi_manager); | 37 MidiHost(int renderer_process_id, midi::MidiManager* midi_manager); |
| 37 | 38 |
| 38 // BrowserMessageFilter implementation. | 39 // BrowserMessageFilter implementation. |
| 39 void OnChannelClosing() override; | 40 void OnChannelClosing() override; |
| 40 void OnDestruct() const override; | 41 void OnDestruct() const override; |
| 41 bool OnMessageReceived(const IPC::Message& message) override; | 42 bool OnMessageReceived(const IPC::Message& message) override; |
| 42 | 43 |
| 43 // MidiManagerClient implementation. | 44 // MidiManagerClient implementation. |
| 44 void CompleteStartSession(midi::Result result) override; | 45 void CompleteStartSession(midi::mojom::Result result) override; |
| 45 void AddInputPort(const midi::MidiPortInfo& info) override; | 46 void AddInputPort(const midi::MidiPortInfo& info) override; |
| 46 void AddOutputPort(const midi::MidiPortInfo& info) override; | 47 void AddOutputPort(const midi::MidiPortInfo& info) override; |
| 47 void SetInputPortState(uint32_t port, | 48 void SetInputPortState(uint32_t port, |
| 48 midi::MidiPortState state) override; | 49 midi::MidiPortState state) override; |
| 49 void SetOutputPortState(uint32_t port, | 50 void SetOutputPortState(uint32_t port, |
| 50 midi::MidiPortState state) override; | 51 midi::MidiPortState state) override; |
| 51 void ReceiveMidiData(uint32_t port, | 52 void ReceiveMidiData(uint32_t port, |
| 52 const uint8_t* data, | 53 const uint8_t* data, |
| 53 size_t length, | 54 size_t length, |
| 54 double timestamp) override; | 55 double timestamp) override; |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 | 119 |
| 119 // Protects access to |output_port_count_|. | 120 // Protects access to |output_port_count_|. |
| 120 base::Lock output_port_count_lock_; | 121 base::Lock output_port_count_lock_; |
| 121 | 122 |
| 122 DISALLOW_COPY_AND_ASSIGN(MidiHost); | 123 DISALLOW_COPY_AND_ASSIGN(MidiHost); |
| 123 }; | 124 }; |
| 124 | 125 |
| 125 } // namespace content | 126 } // namespace content |
| 126 | 127 |
| 127 #endif // CONTENT_BROWSER_MEDIA_MIDI_HOST_H_ | 128 #endif // CONTENT_BROWSER_MEDIA_MIDI_HOST_H_ |
| OLD | NEW |