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