Drive: Add BatchableRequest subclass.
[chromium-blink-merge.git] / media / midi / usb_midi_device_android.h
blob19e65b80ba4af8e4820f0652f09ad4d7e02cd48a
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
3 // found in the LICENSE file.
5 #ifndef MEDIA_MIDI_USB_MIDI_DEVICE_ANDROID_H_
6 #define MEDIA_MIDI_USB_MIDI_DEVICE_ANDROID_H_
8 #include <jni.h>
9 #include <vector>
11 #include "base/android/scoped_java_ref.h"
12 #include "base/basictypes.h"
13 #include "base/callback.h"
14 #include "media/base/media_export.h"
15 #include "media/midi/usb_midi_device.h"
17 namespace media {
19 class MEDIA_EXPORT UsbMidiDeviceAndroid : public UsbMidiDevice {
20 public:
21 typedef base::android::ScopedJavaLocalRef<jobject> ObjectRef;
23 static scoped_ptr<Factory> CreateFactory();
25 UsbMidiDeviceAndroid(ObjectRef raw_device, UsbMidiDeviceDelegate* delegate);
26 ~UsbMidiDeviceAndroid() override;
28 // UsbMidiDevice implementation.
29 std::vector<uint8> GetDescriptor() override;
30 void Send(int endpoint_number, const std::vector<uint8>& data) override;
32 // Called by the Java world.
33 void OnData(JNIEnv* env,
34 jobject caller,
35 jint endpoint_number,
36 jbyteArray data);
38 static bool RegisterUsbMidiDevice(JNIEnv* env);
40 private:
41 // The actual device object.
42 base::android::ScopedJavaGlobalRef<jobject> raw_device_;
43 UsbMidiDeviceDelegate* delegate_;
45 DISALLOW_IMPLICIT_CONSTRUCTORS(UsbMidiDeviceAndroid);
48 } // namespace media
50 #endif // MEDIA_MIDI_USB_MIDI_DEVICE_ANDROID_H_