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

Unified Diff: media/midi/midi_input_port_android.h

Issue 1177973003: [Web MIDI] Use Android MIDI API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/midi/midi_device_android.cc ('k') | media/midi/midi_input_port_android.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/midi/midi_input_port_android.h
diff --git a/media/midi/midi_input_port_android.h b/media/midi/midi_input_port_android.h
new file mode 100644
index 0000000000000000000000000000000000000000..448c158903dda2f483850ff2206d9222759929ab
--- /dev/null
+++ b/media/midi/midi_input_port_android.h
@@ -0,0 +1,51 @@
+// Copyright 2015 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_MIDI_INPUT_PORT_ANDROID_H_
+#define MEDIA_MIDI_MIDI_INPUT_PORT_ANDROID_H_
+
+#include <jni.h>
+
+#include "base/android/scoped_java_ref.h"
+#include "base/time/time.h"
+
+namespace media {
+namespace midi {
+
+class MidiInputPortAndroid final {
+ public:
+ class Delegate {
+ public:
+ virtual ~Delegate() {}
+ virtual void OnReceivedData(MidiInputPortAndroid* port,
+ const uint8* data,
+ size_t size,
+ base::TimeTicks time) = 0;
+ };
+ MidiInputPortAndroid(JNIEnv* env, jobject raw, Delegate* delegate);
+ ~MidiInputPortAndroid();
+
+ // Returns true when the operation succeeds.
+ bool Open();
+ void Close();
+
+ // Called by the Java world.
+ void OnData(JNIEnv* env,
+ jobject caller,
+ jbyteArray data,
+ jint offset,
+ jint size,
+ jlong timestamp);
+
+ static bool Register(JNIEnv* env);
+
+ private:
+ base::android::ScopedJavaGlobalRef<jobject> raw_port_;
+ Delegate* const delegate_;
+};
+
+} // namespace midi
+} // namespace media
+
+#endif // MEDIA_MIDI_MIDI_INPUT_PORT_ANDROID_H_
« no previous file with comments | « media/midi/midi_device_android.cc ('k') | media/midi/midi_input_port_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698