| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_DEVICE_ANDROID_H_ | 5 #ifndef MEDIA_MIDI_MIDI_DEVICE_ANDROID_H_ |
| 6 #define MEDIA_MIDI_MIDI_DEVICE_ANDROID_H_ | 6 #define MEDIA_MIDI_MIDI_DEVICE_ANDROID_H_ |
| 7 | 7 |
| 8 #include <jni.h> | 8 #include <jni.h> |
| 9 #include <memory> |
| 9 #include <string> | 10 #include <string> |
| 11 #include <vector> |
| 10 | 12 |
| 11 #include "base/android/scoped_java_ref.h" | 13 #include "base/android/scoped_java_ref.h" |
| 12 #include "base/memory/scoped_vector.h" | |
| 13 #include "media/midi/midi_input_port_android.h" | 14 #include "media/midi/midi_input_port_android.h" |
| 14 | 15 |
| 15 namespace midi { | 16 namespace midi { |
| 16 | 17 |
| 17 class MidiOutputPortAndroid; | 18 class MidiOutputPortAndroid; |
| 18 | 19 |
| 19 class MidiDeviceAndroid final { | 20 class MidiDeviceAndroid final { |
| 20 public: | 21 public: |
| 21 MidiDeviceAndroid(JNIEnv* env, | 22 MidiDeviceAndroid(JNIEnv* env, |
| 22 jobject raw_device, | 23 jobject raw_device, |
| 23 MidiInputPortAndroid::Delegate* delegate); | 24 MidiInputPortAndroid::Delegate* delegate); |
| 24 ~MidiDeviceAndroid(); | 25 ~MidiDeviceAndroid(); |
| 25 | 26 |
| 26 std::string GetManufacturer(); | 27 std::string GetManufacturer(); |
| 27 std::string GetProductName(); | 28 std::string GetProductName(); |
| 28 std::string GetDeviceVersion(); | 29 std::string GetDeviceVersion(); |
| 29 | 30 |
| 30 const ScopedVector<MidiInputPortAndroid>& input_ports() const { | 31 const std::vector<std::unique_ptr<MidiInputPortAndroid>>& input_ports() |
| 32 const { |
| 31 return input_ports_; | 33 return input_ports_; |
| 32 } | 34 } |
| 33 const ScopedVector<MidiOutputPortAndroid>& output_ports() const { | 35 const std::vector<std::unique_ptr<MidiOutputPortAndroid>>& output_ports() |
| 36 const { |
| 34 return output_ports_; | 37 return output_ports_; |
| 35 } | 38 } |
| 36 bool HasRawDevice(JNIEnv* env, jobject raw_device) const { | 39 bool HasRawDevice(JNIEnv* env, jobject raw_device) const { |
| 37 return env->IsSameObject(raw_device_.obj(), raw_device); | 40 return env->IsSameObject(raw_device_.obj(), raw_device); |
| 38 } | 41 } |
| 39 | 42 |
| 40 private: | 43 private: |
| 41 base::android::ScopedJavaGlobalRef<jobject> raw_device_; | 44 base::android::ScopedJavaGlobalRef<jobject> raw_device_; |
| 42 ScopedVector<MidiInputPortAndroid> input_ports_; | 45 std::vector<std::unique_ptr<MidiInputPortAndroid>> input_ports_; |
| 43 ScopedVector<MidiOutputPortAndroid> output_ports_; | 46 std::vector<std::unique_ptr<MidiOutputPortAndroid>> output_ports_; |
| 44 }; | 47 }; |
| 45 | 48 |
| 46 } // namespace midi | 49 } // namespace midi |
| 47 | 50 |
| 48 #endif // MEDIA_MIDI_MIDI_DEVICE_ANDROID_H_ | 51 #endif // MEDIA_MIDI_MIDI_DEVICE_ANDROID_H_ |
| OLD | NEW |