Index: media/base/android/java/src/org/chromium/media/AndroidOverlayProviderProxy.java |
diff --git a/media/base/android/java/src/org/chromium/media/AndroidOverlayProviderProxy.java b/media/base/android/java/src/org/chromium/media/AndroidOverlayProviderProxy.java |
new file mode 100644 |
index 0000000000000000000000000000000000000000..2682fa4b85691e5eace47f9b1eb3f7fe51601faf |
--- /dev/null |
+++ b/media/base/android/java/src/org/chromium/media/AndroidOverlayProviderProxy.java |
@@ -0,0 +1,46 @@ |
+// 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.os.IBinder; |
+import android.os.RemoteException; |
+ |
+import org.chromium.base.annotations.CalledByNative; |
+import org.chromium.base.annotations.JNINamespace; |
+ |
+/** |
+ * Wrapper for IAndroidOverlayProvider, to provide JNI bindings for arbitrary |
+ * implementations of IAndroidOverlayProvider. In practice, there is one: the |
+ * IBinder stub we get from the browser. However, if one creates a local |
+ * provider such as in the GPU process, then this will work too. |
+ * |
+ * When one gets an IAndroidOverlayProvider, whether remote from the browser or |
+ * local (if supported), it can be used by native classes by wrapping it in a |
+ * AndroidOverlayProviderWrapper instance. |
+ * |
+ * Note that all of that is wrapped in the C++ bindings for this class, so see |
+ * the docs in android_overlay_provider.h if you'd like to use this in C++. |
+ * There's no need to use it in Java. |
+ */ |
+@JNINamespace("media") |
+class AndroidOverlayProviderProxy { |
+ private final IAndroidOverlayProvider mProvider; |
+ |
+ private AndroidOverlayProviderProxy(IAndroidOverlayProvider provider) { |
+ mProvider = provider; |
+ } |
+ |
+ @CalledByNative |
+ private static AndroidOverlayProviderProxy wrap(IBinder provider) { |
+ return new AndroidOverlayProviderProxy(IAndroidOverlayProvider.Stub.asInterface(provider)); |
+ } |
+ |
+ @CalledByNative |
+ public IAndroidOverlay createOverlay(int rendererPid, int renderFrameId, |
+ IAndroidOverlayCallback callback, int x, int y, int width, int height) |
+ throws RemoteException { |
boliu
2017/02/08 00:01:59
any exception thrown by @CalledByNative methods wi
|
+ return mProvider.createOverlay(rendererPid, renderFrameId, callback, x, y, width, height); |
+ } |
+} |