Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(677)

Unified Diff: content/renderer/media/midi_message_filter.h

Issue 2422163002: Web MIDI: use midi_service.mojom for media::midi::PortState (Closed)
Patch Set: gn --check fix Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/common/media/midi_messages.h ('k') | content/renderer/media/midi_message_filter.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/media/midi_message_filter.h
diff --git a/content/renderer/media/midi_message_filter.h b/content/renderer/media/midi_message_filter.h
index f86d6e928a46d8bc1ea8a8c4ed6aa88e25e67681..aabca4fb9dd36d03c1067011d8fa17fabb6e89c0 100644
--- a/content/renderer/media/midi_message_filter.h
+++ b/content/renderer/media/midi_message_filter.h
@@ -54,12 +54,13 @@ class CONTENT_EXPORT MidiMessageFilter : public IPC::MessageFilter {
return io_task_runner_.get();
}
- static blink::WebMIDIAccessorClient::MIDIPortState ToBlinkState(
- midi::MidiPortState state) {
+ static midi::mojom::PortState ToBlinkState(midi::mojom::PortState state) {
// "open" status is separately managed by blink per MIDIAccess instance.
- if (state == midi::MIDI_PORT_OPENED)
- state = midi::MIDI_PORT_CONNECTED;
- return static_cast<blink::WebMIDIAccessorClient::MIDIPortState>(state);
+ // TODO(toyoshim): Pass through the state as is, and have a logic to convert
+ // this state to JavaScript exposing state in Blink side.
+ if (state == midi::mojom::PortState::OPENED)
+ return midi::mojom::PortState::CONNECTED;
+ return state;
}
protected:
@@ -98,8 +99,8 @@ class CONTENT_EXPORT MidiMessageFilter : public IPC::MessageFilter {
// These functions are called to notify the recipient that a device that is
// notified via OnAddInputPort() or OnAddOutputPort() gets disconnected, or
// connected again.
- void OnSetInputPortState(uint32_t port, midi::MidiPortState state);
- void OnSetOutputPortState(uint32_t port, midi::MidiPortState state);
+ void OnSetInputPortState(uint32_t port, midi::mojom::PortState state);
+ void OnSetOutputPortState(uint32_t port, midi::mojom::PortState state);
// Called when the browser process has sent MIDI data containing one or
// more messages.
@@ -117,9 +118,8 @@ class CONTENT_EXPORT MidiMessageFilter : public IPC::MessageFilter {
void HandleAddInputPort(midi::MidiPortInfo info);
void HandleAddOutputPort(midi::MidiPortInfo info);
- void HandleSetInputPortState(uint32_t port, midi::MidiPortState state);
- void HandleSetOutputPortState(uint32_t port,
- midi::MidiPortState state);
+ void HandleSetInputPortState(uint32_t port, midi::mojom::PortState state);
+ void HandleSetOutputPortState(uint32_t port, midi::mojom::PortState state);
void HandleDataReceived(uint32_t port,
const std::vector<uint8_t>& data,
« no previous file with comments | « content/common/media/midi_messages.h ('k') | content/renderer/media/midi_message_filter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698