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

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/vr_shell/VrShell.java

Issue 2399533002: Pull in vr_shell code for webvr (Closed)
Patch Set: fix android_clang_dbg_receipt error Created 4 years, 2 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
1 // Copyright 2016 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package org.chromium.chrome.browser.vr_shell; 5 package org.chromium.chrome.browser.vr_shell;
6 6
7 import static android.opengl.GLES20.GL_NEAREST; 7 import static android.opengl.GLES20.GL_NEAREST;
8 import static android.opengl.GLES20.GL_TEXTURE_MAG_FILTER; 8 import static android.opengl.GLES20.GL_TEXTURE_MAG_FILTER;
9 import static android.opengl.GLES20.GL_TEXTURE_MIN_FILTER; 9 import static android.opengl.GLES20.GL_TEXTURE_MIN_FILTER;
10 import static android.opengl.GLES20.glBindTexture; 10 import static android.opengl.GLES20.glBindTexture;
11 import static android.opengl.GLES20.glGenTextures; 11 import static android.opengl.GLES20.glGenTextures;
12 import static android.opengl.GLES20.glTexParameteri; 12 import static android.opengl.GLES20.glTexParameteri;
13 13
14 import android.app.Activity; 14 import android.app.Activity;
15 import android.content.Context;
16 import android.graphics.SurfaceTexture; 15 import android.graphics.SurfaceTexture;
17 import android.graphics.SurfaceTexture.OnFrameAvailableListener; 16 import android.graphics.SurfaceTexture.OnFrameAvailableListener;
18 import android.opengl.GLES11Ext; 17 import android.opengl.GLES11Ext;
19 import android.opengl.GLSurfaceView; 18 import android.opengl.GLSurfaceView;
20 import android.os.StrictMode; 19 import android.os.StrictMode;
21 import android.view.MotionEvent; 20 import android.view.MotionEvent;
22 import android.view.Surface; 21 import android.view.Surface;
23 import android.view.View; 22 import android.view.View;
24 import android.view.ViewGroup; 23 import android.view.ViewGroup;
25 import android.widget.FrameLayout; 24 import android.widget.FrameLayout;
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 56
58 private final GLSurfaceView mGlSurfaceView; 57 private final GLSurfaceView mGlSurfaceView;
59 58
60 private long mNativeVrShell = 0; 59 private long mNativeVrShell = 0;
61 60
62 private int mContentTextureHandle; 61 private int mContentTextureHandle;
63 private int mUiTextureHandle; 62 private int mUiTextureHandle;
64 private FrameListener mContentFrameListener; 63 private FrameListener mContentFrameListener;
65 private FrameListener mUiFrameListener; 64 private FrameListener mUiFrameListener;
66 65
67 private ContentViewCoreContainer mContentViewCoreContainer; 66 private FrameLayout mContentViewCoreContainer;
68 67
69 // The tab that holds the main ContentViewCore. 68 // The tab that holds the main ContentViewCore.
70 private Tab mTab; 69 private Tab mTab;
71 70
72 // The ContentViewCore for the main content rect in VR. 71 // The ContentViewCore for the main content rect in VR.
73 private ContentViewCore mContentCVC; 72 private ContentViewCore mContentCVC;
74 73
75 // The non-VR container view for mContentCVC. 74 // The non-VR container view for mContentCVC.
76 private ViewGroup mOriginalContentViewParent; 75 private ViewGroup mOriginalContentViewParent;
77 76
78 // TODO(mthiesse): Instead of caching these values, make tab reparenting wor k for this case. 77 // TODO(mthiesse): Instead of caching these values, make tab reparenting wor k for this case.
79 private int mOriginalContentViewIndex; 78 private int mOriginalContentViewIndex;
80 private ViewGroup.LayoutParams mOriginalLayoutParams; 79 private ViewGroup.LayoutParams mOriginalLayoutParams;
81 private WindowAndroid mOriginalWindowAndroid; 80 private WindowAndroid mOriginalWindowAndroid;
82 81
83 private VrWindowAndroid mContentVrWindowAndroid; 82 private VrWindowAndroid mContentVrWindowAndroid;
84 83
85 private WebContents mUiContents; 84 private WebContents mUiContents;
86 private ContentViewCore mUiCVC; 85 private ContentViewCore mUiCVC;
87 private VrWindowAndroid mUiVrWindowAndroid; 86 private VrWindowAndroid mUiVrWindowAndroid;
88 87
89 private class ContentViewCoreContainer extends FrameLayout {
90 public ContentViewCoreContainer(Context context) {
91 super(context);
92 }
93
94 @Override
95 public boolean dispatchTouchEvent(MotionEvent event) {
96 return true;
97 }
98 }
99
100 @UsedByReflection("VrShellDelegate.java") 88 @UsedByReflection("VrShellDelegate.java")
101 public VrShell(Activity activity) { 89 public VrShell(Activity activity) {
102 super(activity); 90 super(activity);
103 mActivity = activity; 91 mActivity = activity;
104 mContentViewCoreContainer = new ContentViewCoreContainer(activity); 92 mContentViewCoreContainer = new FrameLayout(getContext()) {
93 @Override
94 public boolean dispatchTouchEvent(MotionEvent event) {
95 return true;
96 }
97 };
105 addView(mContentViewCoreContainer, 0, new FrameLayout.LayoutParams( 98 addView(mContentViewCoreContainer, 0, new FrameLayout.LayoutParams(
106 FrameLayout.LayoutParams.MATCH_PARENT, 99 FrameLayout.LayoutParams.MATCH_PARENT,
107 FrameLayout.LayoutParams.MATCH_PARENT)); 100 FrameLayout.LayoutParams.MATCH_PARENT));
108 mGlSurfaceView = new GLSurfaceView(getContext()); 101 mGlSurfaceView = new GLSurfaceView(getContext());
109 mGlSurfaceView.setEGLContextClientVersion(2); 102 mGlSurfaceView.setEGLContextClientVersion(2);
110 mGlSurfaceView.setEGLConfigChooser(8, 8, 8, 8, 0, 0); 103 mGlSurfaceView.setEGLConfigChooser(8, 8, 8, 8, 0, 0);
111 mGlSurfaceView.setPreserveEGLContextOnPause(true); 104 mGlSurfaceView.setPreserveEGLContextOnPause(true);
112 mGlSurfaceView.setRenderer(this); 105 mGlSurfaceView.setRenderer(this);
113 setPresentationView(mGlSurfaceView); 106 setPresentationView(mGlSurfaceView);
114 107
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 private native void nativeOnTriggerEvent(long nativeVrShell); 354 private native void nativeOnTriggerEvent(long nativeVrShell);
362 private native void nativeOnPause(long nativeVrShell); 355 private native void nativeOnPause(long nativeVrShell);
363 private native void nativeOnResume(long nativeVrShell); 356 private native void nativeOnResume(long nativeVrShell);
364 private native void nativeContentSurfaceChanged( 357 private native void nativeContentSurfaceChanged(
365 long nativeVrShell, int width, int height, Surface surface); 358 long nativeVrShell, int width, int height, Surface surface);
366 private native void nativeUiSurfaceChanged( 359 private native void nativeUiSurfaceChanged(
367 long nativeVrShell, int width, int height, Surface surface); 360 long nativeVrShell, int width, int height, Surface surface);
368 private native void nativeUpdateCompositorLayers(long nativeVrShell); 361 private native void nativeUpdateCompositorLayers(long nativeVrShell);
369 private native void nativeSetWebVrMode(long nativeVrShell, boolean enabled); 362 private native void nativeSetWebVrMode(long nativeVrShell, boolean enabled);
370 } 363 }
OLDNEW
« no previous file with comments | « chrome/android/java/src/org/chromium/chrome/browser/appmenu/AppMenuPropertiesDelegate.java ('k') | chrome/browser/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698