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

Side by Side 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: moved jni out of content/app Created 4 years, 4 months 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 unified diff | Download patch
OLDNEW
(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.app.Activity;
8 import android.os.IBinder;
9
10 import org.chromium.media.IDialogSurfaceActivityMapper;
11
12 /**
13 * Implementation of IDialogSurfaceActivityMapper.
14 * Provided by ChildProcessLauncher to DialogSurfaceManager.
15 */
16 public class DialogSurfaceActivityMapper extends IDialogSurfaceActivityMapper.St ub {
17 /**
18 * Return a window token for the (rendererPid, renderFrameId) pair.
19 * @param rendererPid the PID of the renderer that we're looking up.
20 * @param renderFrameId the ID of the render frame within that PID.
21 */
22 public IBinder getWindowToken(int rendererPid, int renderFrameId) {
23 final Activity activity = getActivity(rendererPid, renderFrameId);
24 if (activity == null) return null;
25
26 return activity.getWindow().getDecorView().getRootView().getWindowToken( );
27 }
28
29 /**
30 * Return the activity for (rendererPid, renderFrameId), or null.
31 * @param rendererPid the PID of the renderer that we're looking up.
32 * @param renderFrameId the ID of the render frame within that PID.
33 */
34 private Activity getActivity(int rendererPid, int renderFrameId) {
35 ContentViewCore cvc = nativeGetContentViewCore(rendererPid, renderFrameI d);
36 if (cvc == null) return null;
37
38 // Note that this weakref's referent can be null for webview.
39 return cvc.getWindowAndroid().getActivity().get();
40 }
41
42 private static native ContentViewCore nativeGetContentViewCore(
43 int renderPid, int renderFrameId);
watk 2016/07/26 21:34:30 rendererPid
liberato (no reviews please) 2016/07/26 22:49:15 Done.
44 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698