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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/ChromeVrActivity.java

Issue 2252103002: Introduce ChromeVR to Chrome on Android (behind a build flag) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebaes and address 2 in 3 reviews 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 side-by-side diff with in-line comments
Download patch
Index: chrome/android/java/src/org/chromium/chrome/browser/ChromeVrActivity.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ChromeVrActivity.java b/chrome/android/java/src/org/chromium/chrome/browser/ChromeVrActivity.java
new file mode 100644
index 0000000000000000000000000000000000000000..be403eea9d5b719308c1d83b5138f6bdc3b7a404
--- /dev/null
+++ b/chrome/android/java/src/org/chromium/chrome/browser/ChromeVrActivity.java
@@ -0,0 +1,77 @@
+// 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.chrome.browser;
+
+import android.graphics.PixelFormat;
+import android.graphics.SurfaceTexture;
+import android.view.View;
+import android.view.Window;
+import android.view.WindowManager;
+
+import org.chromium.chrome.browser.vr_shell.VrShell;
+
+/**
+ * A subclass of ChromeTabbedActivity, used in Daydream VR mode.
+ */
+public class ChromeVrActivity extends ChromeTabbedActivity {
Maria 2016/08/24 00:06:07 It would help if there is a design doc you could s
Maria 2016/08/24 00:06:07 We actually try not to put Chrome before the activ
bshe 2016/08/24 13:47:40 Done.
bshe 2016/08/24 13:47:40 Good point. I dont have a design doc for it. We do
Maria 2016/08/24 17:35:02 Plan SGTM
+ private VrShell mVrShellView;
+
+ @Override
+ public void onResume() {
+ super.onResume();
+ mVrShellView.onResume();
+ }
+
+ @Override
+ public void onPause() {
+ super.onPause();
+ mVrShellView.onPause();
+ }
+
+ @Override
+ public void onDestroyInternal() {
+ super.onDestroyInternal();
+ if (mVrShellView != null) {
+ mVrShellView.shutdown();
+ mVrShellView = null;
+ }
+ }
+
+ @Override
+ public void initializeCompositor() {
+ super.initializeCompositor();
+ mVrShellView.onNativeLibraryReady();
+ }
+
+ @Override
+ public void postInflationStartup() {
+ super.postInflationStartup();
+ addVrViews();
+ setupVrModeWindowFlags();
+ }
+
+ public void replaceCompositorSurface(SurfaceTexture surfaceTexture) {
+ if (getCompositorViewHolder() != null) {
+ getCompositorViewHolder().replaceCompositorSurface(surfaceTexture);
+ }
+ }
+
+ private void addVrViews() {
+ mVrShellView = new VrShell(this);
+ WindowManager.LayoutParams params = new WindowManager.LayoutParams(
+ WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.MATCH_PARENT,
+ WindowManager.LayoutParams.TYPE_APPLICATION, 0, PixelFormat.OPAQUE);
+ this.addContentView(mVrShellView, params);
+ }
+
+ private void setupVrModeWindowFlags() {
+ Window window = getWindow();
+ window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
+ window.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE
+ | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
+ | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_FULLSCREEN
+ | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698