Chromium Code Reviews| Index: content/public/android/java/src/org/chromium/content/browser/DialogSurfaceActivityMapper.java |
| diff --git a/content/public/android/java/src/org/chromium/content/browser/DialogSurfaceActivityMapper.java b/content/public/android/java/src/org/chromium/content/browser/DialogSurfaceActivityMapper.java |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..e61387447d30dbe648582ed85153b37010b090f3 |
| --- /dev/null |
| +++ b/content/public/android/java/src/org/chromium/content/browser/DialogSurfaceActivityMapper.java |
| @@ -0,0 +1,54 @@ |
| +// 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.content.browser; |
| + |
| +import android.os.IBinder; |
| +import android.os.RemoteException; |
| +import android.view.ViewGroup; |
| + |
| +import org.chromium.base.Log; |
| +import org.chromium.base.annotations.CalledByNative; |
| +import org.chromium.media.IDialogSurfaceActivityMapper; |
| +import org.chromium.media.IDialogSurfaceHolder; |
| + |
| +/** |
| + * Implementation of IDialogSurfaceActivityMapper. |
| + * Provided by ChildProcessLauncher to DialogSurfaceManager. |
| + */ |
| +public class DialogSurfaceActivityMapper extends IDialogSurfaceActivityMapper.Stub { |
|
boliu
2016/11/04 00:07:19
@JNINamespace("content") so native side can live i
liberato (no reviews please)
2016/11/11 21:52:35
Done.
|
| + private static final String TAG = "cr_DialogSurfaceAM"; |
| + |
| + @Override |
| + public void postWindowToken(int rendererPid, int renderFrameId, IDialogSurfaceHolder holder) { |
|
boliu
2016/11/04 00:07:19
I didn't find the caller of this binder call? want
liberato (no reviews please)
2016/11/11 21:52:35
i split this cl in half, and the caller isn't here
|
| + nativeCallBackWithContentViewCore(rendererPid, renderFrameId, this, holder); |
| + } |
| + |
| + /** |
| + * Receive a callback from native with a previously requested ContentViewCore. |
| + */ |
| + @CalledByNative |
| + private void onContentViewCore(IDialogSurfaceHolder holder, ContentViewCore cvc) { |
| + IBinder token = null; |
| + |
| + if (cvc != null) { |
| + ViewGroup viewGroup = cvc.getContainerView(); |
| + if (viewGroup != null) { |
| + token = viewGroup.getWindowToken(); |
| + } |
| + } |
| + |
| + try { |
| + holder.onWindowToken(token); |
| + } catch (RemoteException e) { |
| + Log.e(TAG, "Unable to post window token to DialogSurfaceHolder", e); |
|
boliu
2016/11/04 00:07:19
Log.d (to avoid bloating release binary)
liberato (no reviews please)
2016/11/11 21:52:35
Done.
|
| + } |
| + } |
| + |
| + // Look up the ContentViewCore for (rendererPid, renderFrameId), and call |
| + // back onContentViewCore with it and |holder|. The callback will happen |
| + // on the browser UI thread. |
| + private static native void nativeCallBackWithContentViewCore(int rendererPid, int renderFrameId, |
| + DialogSurfaceActivityMapper mapper, IDialogSurfaceHolder holder); |
| +} |