Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9)

Side by Side Diff: media/midi/usb_midi_device_android.h

Issue 1098913003: [WebMIDI] [Android] Set appropriate port properties. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « media/midi/usb_midi_device.h ('k') | media/midi/usb_midi_device_android.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 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_USB_MIDI_DEVICE_ANDROID_H_ 5 #ifndef MEDIA_MIDI_USB_MIDI_DEVICE_ANDROID_H_
6 #define MEDIA_MIDI_USB_MIDI_DEVICE_ANDROID_H_ 6 #define MEDIA_MIDI_USB_MIDI_DEVICE_ANDROID_H_
7 7
8 #include <jni.h> 8 #include <jni.h>
9 #include <string>
9 #include <vector> 10 #include <vector>
10 11
11 #include "base/android/scoped_java_ref.h" 12 #include "base/android/scoped_java_ref.h"
12 #include "base/basictypes.h" 13 #include "base/basictypes.h"
13 #include "base/callback.h" 14 #include "base/callback.h"
14 #include "media/base/media_export.h" 15 #include "media/base/media_export.h"
15 #include "media/midi/usb_midi_device.h" 16 #include "media/midi/usb_midi_device.h"
16 17
17 namespace media { 18 namespace media {
18 19
19 class MEDIA_EXPORT UsbMidiDeviceAndroid : public UsbMidiDevice { 20 class MEDIA_EXPORT UsbMidiDeviceAndroid : public UsbMidiDevice {
20 public: 21 public:
21 typedef base::android::ScopedJavaLocalRef<jobject> ObjectRef; 22 typedef base::android::ScopedJavaLocalRef<jobject> ObjectRef;
22 23
23 static scoped_ptr<Factory> CreateFactory(); 24 static scoped_ptr<Factory> CreateFactory();
24 25
25 UsbMidiDeviceAndroid(ObjectRef raw_device, UsbMidiDeviceDelegate* delegate); 26 UsbMidiDeviceAndroid(ObjectRef raw_device, UsbMidiDeviceDelegate* delegate);
26 ~UsbMidiDeviceAndroid() override; 27 ~UsbMidiDeviceAndroid() override;
27 28
28 // UsbMidiDevice implementation. 29 // UsbMidiDevice implementation.
29 std::vector<uint8> GetDescriptor() override; 30 std::vector<uint8> GetDescriptors() override;
31 std::string GetManufacturer() override;
32 std::string GetProductName() override;
33 std::string GetDeviceVersion() override;
30 void Send(int endpoint_number, const std::vector<uint8>& data) override; 34 void Send(int endpoint_number, const std::vector<uint8>& data) override;
31 35
32 // Called by the Java world. 36 // Called by the Java world.
33 void OnData(JNIEnv* env, 37 void OnData(JNIEnv* env,
34 jobject caller, 38 jobject caller,
35 jint endpoint_number, 39 jint endpoint_number,
36 jbyteArray data); 40 jbyteArray data);
37 41
38 static bool RegisterUsbMidiDevice(JNIEnv* env); 42 static bool RegisterUsbMidiDevice(JNIEnv* env);
39 43
40 private: 44 private:
45 void GetDescriptorsInternal();
46 void InitDeviceInfo();
47 std::vector<uint8> GetStringDescriptor(int index);
48 std::string GetString(int index, const std::string& backup);
49
41 // The actual device object. 50 // The actual device object.
42 base::android::ScopedJavaGlobalRef<jobject> raw_device_; 51 base::android::ScopedJavaGlobalRef<jobject> raw_device_;
43 UsbMidiDeviceDelegate* delegate_; 52 UsbMidiDeviceDelegate* delegate_;
44 53
54 std::vector<uint8> descriptors_;
55 std::string manufacturer_;
56 std::string product_;
57 std::string device_version_;
58
45 DISALLOW_IMPLICIT_CONSTRUCTORS(UsbMidiDeviceAndroid); 59 DISALLOW_IMPLICIT_CONSTRUCTORS(UsbMidiDeviceAndroid);
46 }; 60 };
47 61
48 } // namespace media 62 } // namespace media
49 63
50 #endif // MEDIA_MIDI_USB_MIDI_DEVICE_ANDROID_H_ 64 #endif // MEDIA_MIDI_USB_MIDI_DEVICE_ANDROID_H_
OLDNEW
« no previous file with comments | « media/midi/usb_midi_device.h ('k') | media/midi/usb_midi_device_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698