yhirano | bc742d8 | 2015-09-17 07:41:44 -0700 | [diff] [blame^] | 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 |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #ifndef MEDIA_MIDI_MIDI_DEVICE_ANDROID_H_ |
| 6 | #define MEDIA_MIDI_MIDI_DEVICE_ANDROID_H_ |
| 7 | |
| 8 | #include <jni.h> |
| 9 | #include <string> |
| 10 | |
| 11 | #include "base/android/scoped_java_ref.h" |
| 12 | #include "base/memory/scoped_vector.h" |
| 13 | #include "media/midi/midi_input_port_android.h" |
| 14 | |
| 15 | namespace media { |
| 16 | namespace midi { |
| 17 | |
| 18 | class MidiOutputPortAndroid; |
| 19 | |
| 20 | class MidiDeviceAndroid final { |
| 21 | public: |
| 22 | MidiDeviceAndroid(JNIEnv* env, |
| 23 | jobject raw_device, |
| 24 | MidiInputPortAndroid::Delegate* delegate); |
| 25 | ~MidiDeviceAndroid(); |
| 26 | |
| 27 | std::string GetManufacturer(); |
| 28 | std::string GetProductName(); |
| 29 | std::string GetDeviceVersion(); |
| 30 | |
| 31 | const ScopedVector<MidiInputPortAndroid>& input_ports() const { |
| 32 | return input_ports_; |
| 33 | } |
| 34 | const ScopedVector<MidiOutputPortAndroid>& output_ports() const { |
| 35 | return output_ports_; |
| 36 | } |
| 37 | bool HasRawDevice(JNIEnv* env, jobject raw_device) const { |
| 38 | return env->IsSameObject(raw_device_.obj(), raw_device); |
| 39 | } |
| 40 | |
| 41 | static bool Register(JNIEnv* env); |
| 42 | |
| 43 | private: |
| 44 | base::android::ScopedJavaGlobalRef<jobject> raw_device_; |
| 45 | ScopedVector<MidiInputPortAndroid> input_ports_; |
| 46 | ScopedVector<MidiOutputPortAndroid> output_ports_; |
| 47 | }; |
| 48 | |
| 49 | } // namespace midi |
| 50 | } // namespace media |
| 51 | |
| 52 | #endif // MEDIA_MIDI_MIDI_DEVICE_ANDROID_H_ |