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 #ifndef MEDIA_MIDI_MIDI_MANAGER_USB_H_ | 5 #ifndef MEDIA_MIDI_MIDI_MANAGER_USB_H_ |
6 #define MEDIA_MIDI_MIDI_MANAGER_USB_H_ | 6 #define MEDIA_MIDI_MIDI_MANAGER_USB_H_ |
7 | 7 |
8 #include <utility> | 8 #include <utility> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 } | 63 } |
64 const UsbMidiInputStream* input_stream() const { return input_stream_.get(); } | 64 const UsbMidiInputStream* input_stream() const { return input_stream_.get(); } |
65 | 65 |
66 // Initializes this object. | 66 // Initializes this object. |
67 // When the initialization finishes, |callback| will be called with the | 67 // When the initialization finishes, |callback| will be called with the |
68 // result. | 68 // result. |
69 // When this factory is destroyed during the operation, the operation | 69 // When this factory is destroyed during the operation, the operation |
70 // will be canceled silently (i.e. |callback| will not be called). | 70 // will be canceled silently (i.e. |callback| will not be called). |
71 // The function is public just for unit tests. Do not call this function | 71 // The function is public just for unit tests. Do not call this function |
72 // outside code for testing. | 72 // outside code for testing. |
73 void Initialize(base::Callback<void(MidiResult result)> callback); | 73 void Initialize(base::Callback<void(Result result)> callback); |
74 | 74 |
75 private: | 75 private: |
76 void OnEnumerateDevicesDone(bool result, UsbMidiDevice::Devices* devices); | 76 void OnEnumerateDevicesDone(bool result, UsbMidiDevice::Devices* devices); |
77 bool AddPorts(UsbMidiDevice* device, int device_id); | 77 bool AddPorts(UsbMidiDevice* device, int device_id); |
78 | 78 |
79 scoped_ptr<UsbMidiDevice::Factory> device_factory_; | 79 scoped_ptr<UsbMidiDevice::Factory> device_factory_; |
80 ScopedVector<UsbMidiDevice> devices_; | 80 ScopedVector<UsbMidiDevice> devices_; |
81 ScopedVector<UsbMidiOutputStream> output_streams_; | 81 ScopedVector<UsbMidiOutputStream> output_streams_; |
82 scoped_ptr<UsbMidiInputStream> input_stream_; | 82 scoped_ptr<UsbMidiInputStream> input_stream_; |
83 | 83 |
84 base::Callback<void(MidiResult result)> initialize_callback_; | 84 base::Callback<void(Result result)> initialize_callback_; |
85 | 85 |
86 // A map from <endpoint_number, cable_number> to the index of input jacks. | 86 // A map from <endpoint_number, cable_number> to the index of input jacks. |
87 base::hash_map<std::pair<int, int>, size_t> input_jack_dictionary_; | 87 base::hash_map<std::pair<int, int>, size_t> input_jack_dictionary_; |
88 | 88 |
89 scoped_ptr<MidiScheduler> scheduler_; | 89 scoped_ptr<MidiScheduler> scheduler_; |
90 | 90 |
91 DISALLOW_COPY_AND_ASSIGN(MidiManagerUsb); | 91 DISALLOW_COPY_AND_ASSIGN(MidiManagerUsb); |
92 }; | 92 }; |
93 | 93 |
94 } // namespace midi | 94 } // namespace midi |
95 } // namespace media | 95 } // namespace media |
96 | 96 |
97 #endif // MEDIA_MIDI_MIDI_MANAGER_USB_H_ | 97 #endif // MEDIA_MIDI_MIDI_MANAGER_USB_H_ |
OLD | NEW |