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 15 matching lines...) Expand all Loading... |
26 } | 26 } |
27 | 27 |
28 void MidiManagerUsb::StartInitialization() { | 28 void MidiManagerUsb::StartInitialization() { |
29 Initialize( | 29 Initialize( |
30 base::Bind(&MidiManager::CompleteInitialization, base::Unretained(this))); | 30 base::Bind(&MidiManager::CompleteInitialization, base::Unretained(this))); |
31 } | 31 } |
32 | 32 |
33 void MidiManagerUsb::Initialize( | 33 void MidiManagerUsb::Initialize( |
34 base::Callback<void(MidiResult result)> callback) { | 34 base::Callback<void(MidiResult result)> callback) { |
35 initialize_callback_ = callback; | 35 initialize_callback_ = callback; |
36 scheduler_.reset(new MidiScheduler); | 36 scheduler_.reset(new MidiScheduler(this)); |
37 // This is safe because EnumerateDevices cancels the operation on destruction. | 37 // This is safe because EnumerateDevices cancels the operation on destruction. |
38 device_factory_->EnumerateDevices( | 38 device_factory_->EnumerateDevices( |
39 this, | 39 this, |
40 base::Bind(&MidiManagerUsb::OnEnumerateDevicesDone, | 40 base::Bind(&MidiManagerUsb::OnEnumerateDevicesDone, |
41 base::Unretained(this))); | 41 base::Unretained(this))); |
42 } | 42 } |
43 | 43 |
44 void MidiManagerUsb::DispatchSendMidiData(MidiManagerClient* client, | 44 void MidiManagerUsb::DispatchSendMidiData(MidiManagerClient* client, |
45 uint32_t port_index, | 45 uint32_t port_index, |
46 const std::vector<uint8>& data, | 46 const std::vector<uint8>& data, |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 port.id = base::StringPrintf("port-%d-%ld", | 157 port.id = base::StringPrintf("port-%d-%ld", |
158 device_id, | 158 device_id, |
159 static_cast<long>(j)); | 159 static_cast<long>(j)); |
160 AddInputPort(port); | 160 AddInputPort(port); |
161 } | 161 } |
162 } | 162 } |
163 return true; | 163 return true; |
164 } | 164 } |
165 | 165 |
166 } // namespace media | 166 } // namespace media |
OLD | NEW |