All instances of addresses as void* are changed to uintptr_t in
[chromium-blink-merge.git] / media / midi / usb_midi_device_factory_android.h
blob319ea629c1be7d762a4f2c7ad415cc2b1e514cf6
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_FACTORY_ANDROID_H_
6 #define MEDIA_MIDI_USB_MIDI_DEVICE_FACTORY_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 "base/memory/weak_ptr.h"
15 #include "media/midi/usb_midi_device.h"
16 #include "media/midi/usb_midi_export.h"
18 namespace media {
19 namespace midi {
21 // This class enumerates UsbMidiDevices.
22 class USB_MIDI_EXPORT UsbMidiDeviceFactoryAndroid
23 : public UsbMidiDevice::Factory {
24 public:
25 UsbMidiDeviceFactoryAndroid();
26 ~UsbMidiDeviceFactoryAndroid() override;
28 // UsbMidiDevice::Factory implementation.
29 void EnumerateDevices(UsbMidiDeviceDelegate* delegate,
30 Callback callback) override;
32 void OnUsbMidiDeviceRequestDone(JNIEnv* env,
33 jobject caller,
34 jobjectArray devices);
35 void OnUsbMidiDeviceAttached(JNIEnv* env, jobject caller, jobject device);
36 void OnUsbMidiDeviceDetached(JNIEnv* env, jobject caller, jint index);
38 static bool RegisterUsbMidiDeviceFactory(JNIEnv* env);
40 private:
41 base::android::ScopedJavaGlobalRef<jobject> raw_factory_;
42 // Not owned.
43 UsbMidiDeviceDelegate* delegate_;
44 Callback callback_;
46 DISALLOW_COPY_AND_ASSIGN(UsbMidiDeviceFactoryAndroid);
49 } // namespace midi
50 } // namespace media
52 #endif // MEDIA_MIDI_USB_MIDI_DEVICE_FACTORY_ANDROID_H_