OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 package org.chromium.content.browser; | |
6 | |
7 import android.os.IBinder; | |
8 import android.os.RemoteException; | |
9 import android.view.ViewGroup; | |
10 | |
11 import org.chromium.base.Log; | |
12 import org.chromium.base.UnguessableToken; | |
13 import org.chromium.base.annotations.CalledByNative; | |
14 import org.chromium.base.annotations.JNINamespace; | |
15 import org.chromium.media.IDialogSurfaceActivityMapper; | |
16 import org.chromium.media.IDialogSurfaceHolder; | |
17 import org.chromium.ui.base.WindowAndroid; | |
18 | |
19 /** | |
20 * Implementation of IDialogSurfaceActivityMapper. | |
21 * Provided by ChildProcessLauncher to DialogSurfaceManager. | |
22 */ | |
23 @JNINamespace("content") | |
24 public class DialogSurfaceActivityMapper extends IDialogSurfaceActivityMapper.St ub { | |
25 private static final String TAG = "cr_DialogSurfaceAM"; | |
26 | |
27 @Override | |
28 public void postWindowToken(UnguessableToken frameToken, IDialogSurfaceHolde r holder) { | |
29 nativeCallBackWithContentViewCore(frameToken, this, holder); | |
30 } | |
31 | |
32 /** | |
33 * Receive a callback from native with a previously requested ContentViewCor e. | |
34 */ | |
35 @CalledByNative | |
36 private void onContentViewCore(IDialogSurfaceHolder holder, ContentViewCore cvc) { | |
37 IBinder token = null; | |
38 | |
39 if (cvc != null) { | |
40 ViewGroup viewGroup = cvc.getContainerView(); | |
boliu
2016/11/14 16:39:24
not needed
liberato (no reviews please)
2016/12/20 17:16:38
Done.
| |
41 WindowAndroid windowAndroid = cvc.getWindowAndroid(); | |
42 if (windowAndroid != null) { | |
43 token = windowAndroid.getWindowToken(); | |
44 } | |
45 } | |
46 | |
47 try { | |
48 holder.onWindowToken(token); | |
49 } catch (RemoteException e) { | |
50 Log.d(TAG, "Unable to post window token to DialogSurfaceHolder", e); | |
51 } | |
52 } | |
53 | |
54 // Look up the ContentViewCore for |frameToken|, and call back | |
55 // onContentViewCore with it and |holder|. The callback will happen on the | |
56 // browser UI thread. | |
57 private static native void nativeCallBackWithContentViewCore(UnguessableToke n frameToken, | |
58 DialogSurfaceActivityMapper mapper, IDialogSurfaceHolder holder); | |
59 } | |
OLD | NEW |