| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "media/midi/midi_manager_usb.h" | 5 #include "media/midi/midi_manager_usb.h" |
| 6 | 6 |
| 7 #include "base/callback.h" | 7 #include "base/callback.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 return; | 69 return; |
| 70 input_stream_->OnReceivedData(device, | 70 input_stream_->OnReceivedData(device, |
| 71 endpoint_number, | 71 endpoint_number, |
| 72 data, | 72 data, |
| 73 size, | 73 size, |
| 74 time); | 74 time); |
| 75 } | 75 } |
| 76 | 76 |
| 77 void MidiManagerUsb::OnDeviceAttached(scoped_ptr<UsbMidiDevice> device) { | 77 void MidiManagerUsb::OnDeviceAttached(scoped_ptr<UsbMidiDevice> device) { |
| 78 int device_id = static_cast<int>(devices_.size()); | 78 int device_id = static_cast<int>(devices_.size()); |
| 79 devices_.push_back(device.release()); | 79 devices_.push_back(device.Pass()); |
| 80 AddPorts(devices_.back(), device_id); | 80 AddPorts(devices_.back(), device_id); |
| 81 } | 81 } |
| 82 | 82 |
| 83 void MidiManagerUsb::OnDeviceDetached(size_t index) { | 83 void MidiManagerUsb::OnDeviceDetached(size_t index) { |
| 84 if (index >= devices_.size()) { | 84 if (index >= devices_.size()) { |
| 85 return; | 85 return; |
| 86 } | 86 } |
| 87 UsbMidiDevice* device = devices_[index]; | 87 UsbMidiDevice* device = devices_[index]; |
| 88 for (size_t i = 0; i < output_streams_.size(); ++i) { | 88 for (size_t i = 0; i < output_streams_.size(); ++i) { |
| 89 if (output_streams_[i]->jack().device == device) { | 89 if (output_streams_[i]->jack().device == device) { |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 input_stream_->Add(jacks[j]); | 154 input_stream_->Add(jacks[j]); |
| 155 AddInputPort(MidiPortInfo(id, manufacturer, product_name, version, | 155 AddInputPort(MidiPortInfo(id, manufacturer, product_name, version, |
| 156 MIDI_PORT_OPENED)); | 156 MIDI_PORT_OPENED)); |
| 157 } | 157 } |
| 158 } | 158 } |
| 159 return true; | 159 return true; |
| 160 } | 160 } |
| 161 | 161 |
| 162 } // namespace midi | 162 } // namespace midi |
| 163 } // namespace media | 163 } // namespace media |
| OLD | NEW |