Chromium Code Reviews| Index: media/base/android/java/src/org/chromium/media/DialogSurfaceManagerWrapper.java |
| diff --git a/media/base/android/java/src/org/chromium/media/DialogSurfaceManagerWrapper.java b/media/base/android/java/src/org/chromium/media/DialogSurfaceManagerWrapper.java |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..0aa71f060490472a860dfa0e569800bfcf3e2c66 |
| --- /dev/null |
| +++ b/media/base/android/java/src/org/chromium/media/DialogSurfaceManagerWrapper.java |
| @@ -0,0 +1,56 @@ |
| +// 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 IDialogSurfaceManager, to provide JNI bindings for arbitrariy |
|
watk
2016/06/10 21:46:38
arbitrary
liberato (no reviews please)
2016/06/10 22:50:05
Done.
|
| + * implementations of IDialogSurfaceManager. In practice, there is one: the |
| + * IBinder stub we get from the browser. However, if one creates a local |
| + * manager such as in the GPU process, then this will work too. |
| + * |
| + * When one gets an IDialogSurfaceManager, whether remote from the browser or |
| + * local (if supported), it can be used by native classes by wrapping it in a |
| + * DialogSurfaceManagerWrapper instance. |
| + * |
| + * While it's not strictly needed, the wrapper implements IDialogSurfaceManager |
| + * too. It's helpful, since it makes changes to the interface into compile- |
| + * time errors. |
| + * |
| + * Note that all of that is wrapped in the C++ bindings for this class, so see |
| + * the docs in dialog_surface_manager.h if you'd like to use this in C++. |
| + */ |
| +@JNINamespace("media") |
| +class DialogSurfaceManagerWrapper implements IDialogSurfaceManager { |
| + private final IDialogSurfaceManager mManager; |
| + |
| + private DialogSurfaceManagerWrapper(IDialogSurfaceManager manager) { |
| + mManager = manager; |
| + } |
| + |
| + @CalledByNative |
| + private static DialogSurfaceManagerWrapper wrap(IBinder manager) { |
| + return new DialogSurfaceManagerWrapper(DialogSurfaceManager.asInterface(manager)); |
| + } |
| + |
| + @Override |
| + @CalledByNative |
| + public IDialogSurfaceController createSurface(IDialogSurfaceCallback callback, int x, int y, |
| + int width, int height) throws RemoteException { |
| + return mManager.createSurface(callback, x, y, width, height); |
| + } |
| + |
| + // We don't really implement a binderable interface, though I suppose that |
| + // we could return mManager.asBinder(). |
| + @Override |
| + public IBinder asBinder() { |
| + return null; |
| + } |
| +} |