forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathusb_midi_device_factory_android.h
55 lines (44 loc) · 1.63 KB
/
usb_midi_device_factory_android.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef MEDIA_MIDI_USB_MIDI_DEVICE_FACTORY_ANDROID_H_
#define MEDIA_MIDI_USB_MIDI_DEVICE_FACTORY_ANDROID_H_
#include <jni.h>
#include <vector>
#include "base/android/scoped_java_ref.h"
#include "base/callback.h"
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
#include "media/midi/usb_midi_device.h"
#include "media/midi/usb_midi_export.h"
namespace midi {
// This class enumerates UsbMidiDevices.
class USB_MIDI_EXPORT UsbMidiDeviceFactoryAndroid
: public UsbMidiDevice::Factory {
public:
UsbMidiDeviceFactoryAndroid();
~UsbMidiDeviceFactoryAndroid() override;
// UsbMidiDevice::Factory implementation.
void EnumerateDevices(UsbMidiDeviceDelegate* delegate,
Callback callback) override;
void OnUsbMidiDeviceRequestDone(
JNIEnv* env,
const base::android::JavaParamRef<jobject>& caller,
const base::android::JavaParamRef<jobjectArray>& devices);
void OnUsbMidiDeviceAttached(
JNIEnv* env,
const base::android::JavaParamRef<jobject>& caller,
const base::android::JavaParamRef<jobject>& device);
void OnUsbMidiDeviceDetached(
JNIEnv* env,
const base::android::JavaParamRef<jobject>& caller,
jint index);
private:
base::android::ScopedJavaGlobalRef<jobject> raw_factory_;
// Not owned.
UsbMidiDeviceDelegate* delegate_;
Callback callback_;
DISALLOW_COPY_AND_ASSIGN(UsbMidiDeviceFactoryAndroid);
};
} // namespace midi
#endif // MEDIA_MIDI_USB_MIDI_DEVICE_FACTORY_ANDROID_H_