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

Unified Diff: content/public/android/java/src/org/chromium/content/browser/DialogSurfaceActivityMapper.java

Issue 2178973004: DialogSurfaceManager implementation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: removed whitespace changes Created 4 years, 1 month 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
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..046f0565720542094618600a24bde58914d0b430
--- /dev/null
+++ b/content/public/android/java/src/org/chromium/content/browser/DialogSurfaceActivityMapper.java
@@ -0,0 +1,59 @@
+// 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.UnguessableToken;
+import org.chromium.base.annotations.CalledByNative;
+import org.chromium.base.annotations.JNINamespace;
+import org.chromium.media.IDialogSurfaceActivityMapper;
+import org.chromium.media.IDialogSurfaceHolder;
+import org.chromium.ui.base.WindowAndroid;
+
+/**
+ * Implementation of IDialogSurfaceActivityMapper.
+ * Provided by ChildProcessLauncher to DialogSurfaceManager.
+ */
+@JNINamespace("content")
+public class DialogSurfaceActivityMapper extends IDialogSurfaceActivityMapper.Stub {
+ private static final String TAG = "cr_DialogSurfaceAM";
+
+ @Override
+ public void postWindowToken(UnguessableToken frameToken, IDialogSurfaceHolder holder) {
+ nativeCallBackWithContentViewCore(frameToken, 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();
boliu 2016/11/14 16:39:24 not needed
liberato (no reviews please) 2016/12/20 17:16:38 Done.
+ WindowAndroid windowAndroid = cvc.getWindowAndroid();
+ if (windowAndroid != null) {
+ token = windowAndroid.getWindowToken();
+ }
+ }
+
+ try {
+ holder.onWindowToken(token);
+ } catch (RemoteException e) {
+ Log.d(TAG, "Unable to post window token to DialogSurfaceHolder", e);
+ }
+ }
+
+ // Look up the ContentViewCore for |frameToken|, and call back
+ // onContentViewCore with it and |holder|. The callback will happen on the
+ // browser UI thread.
+ private static native void nativeCallBackWithContentViewCore(UnguessableToken frameToken,
+ DialogSurfaceActivityMapper mapper, IDialogSurfaceHolder holder);
+}

Powered by Google App Engine
This is Rietveld 408576698