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

Side by Side Diff: content/browser/media/midi_host.cc

Issue 2404443002: Web MIDI: use midi_service.mojom for media::midi::Result (Closed)
Patch Set: rebase 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 unified diff | Download patch
OLDNEW
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 #include "content/browser/media/midi_host.h" 5 #include "content/browser/media/midi_host.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/metrics/histogram_macros.h" 9 #include "base/metrics/histogram_macros.h"
10 #include "base/process/process.h" 10 #include "base/process/process.h"
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 if (midi_manager_) 134 if (midi_manager_)
135 midi_manager_->DispatchSendMidiData(this, port, data, timestamp); 135 midi_manager_->DispatchSendMidiData(this, port, data, timestamp);
136 } 136 }
137 137
138 void MidiHost::OnEndSession() { 138 void MidiHost::OnEndSession() {
139 is_session_requested_ = false; 139 is_session_requested_ = false;
140 if (midi_manager_) 140 if (midi_manager_)
141 midi_manager_->EndSession(this); 141 midi_manager_->EndSession(this);
142 } 142 }
143 143
144 void MidiHost::CompleteStartSession(midi::Result result) { 144 void MidiHost::CompleteStartSession(midi::mojom::Result result) {
145 DCHECK(is_session_requested_); 145 DCHECK(is_session_requested_);
146 if (result == midi::Result::OK) { 146 if (result == midi::mojom::Result::OK) {
147 // ChildSecurityPolicy is set just before OnStartSession by 147 // ChildSecurityPolicy is set just before OnStartSession by
148 // MidiDispatcherHost. So we can safely cache the policy. 148 // MidiDispatcherHost. So we can safely cache the policy.
149 has_sys_ex_permission_ = ChildProcessSecurityPolicyImpl::GetInstance()-> 149 has_sys_ex_permission_ = ChildProcessSecurityPolicyImpl::GetInstance()->
150 CanSendMidiSysExMessage(renderer_process_id_); 150 CanSendMidiSysExMessage(renderer_process_id_);
151 } 151 }
152 Send(new MidiMsg_SessionStarted(result)); 152 Send(new MidiMsg_SessionStarted(result));
153 } 153 }
154 154
155 void MidiHost::AddInputPort(const midi::MidiPortInfo& info) { 155 void MidiHost::AddInputPort(const midi::MidiPortInfo& info) {
156 base::AutoLock auto_lock(messages_queues_lock_); 156 base::AutoLock auto_lock(messages_queues_lock_);
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 } 262 }
263 waiting_data_length = midi::GetMidiMessageLength(current); 263 waiting_data_length = midi::GetMidiMessageLength(current);
264 if (waiting_data_length == 0) 264 if (waiting_data_length == 0)
265 return false; // Error: |current| should have been a valid status byte. 265 return false; // Error: |current| should have been a valid status byte.
266 --waiting_data_length; // Found status byte 266 --waiting_data_length; // Found status byte
267 } 267 }
268 return waiting_data_length == 0 && !in_sysex; 268 return waiting_data_length == 0 && !in_sysex;
269 } 269 }
270 270
271 } // namespace content 271 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698