Index: media/base/android/java/src/org/chromium/media/DialogSurfaceCallback.java |
diff --git a/media/base/android/java/src/org/chromium/media/DialogSurfaceCallback.java b/media/base/android/java/src/org/chromium/media/DialogSurfaceCallback.java |
new file mode 100644 |
index 0000000000000000000000000000000000000000..95c93081b2df6a4c8d46decf4d542981a52cf2d2 |
--- /dev/null |
+++ b/media/base/android/java/src/org/chromium/media/DialogSurfaceCallback.java |
@@ -0,0 +1,42 @@ |
+// Copyright 2016 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. |
+ |
+package org.chromium.media; |
+ |
+import android.view.Surface; |
+ |
+import org.chromium.base.annotations.CalledByNative; |
+import org.chromium.base.annotations.JNINamespace; |
+ |
+/** |
+ * Callback helper for native. This works with our JNI implementation to hop |
+ * to the right thread for callbacks, and handle async deletion of the native |
+ * object. It directly implemens the aidl interface also. |
+ */ |
+@JNINamespace("media") |
+class DialogSurfaceCallback extends IDialogSurfaceCallback.Stub { |
+ private final long mNativeId; |
+ |
+ public DialogSurfaceCallback(long nativeId) { |
+ mNativeId = nativeId; |
+ } |
+ |
+ @CalledByNative |
+ public static DialogSurfaceCallback create(long nativeId) { |
+ return new DialogSurfaceCallback(nativeId); |
+ } |
+ |
+ @Override |
+ public void onCreated(Surface surface) { |
+ nativeOnDialogSurfaceCallbackCreated(mNativeId, surface); |
+ } |
+ |
+ @Override |
+ public void onDestroyed() { |
+ nativeOnDialogSurfaceCallbackDestroyed(mNativeId); |
+ } |
+ |
+ private static native void nativeOnDialogSurfaceCallbackCreated(long id, Surface surface); |
+ private static native void nativeOnDialogSurfaceCallbackDestroyed(long id); |
+}; |