OLD | NEW |
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 android.app.Activity; | 7 import android.app.Activity; |
8 import android.app.PendingIntent; | 8 import android.app.PendingIntent; |
9 import android.content.ComponentName; | 9 import android.content.ComponentName; |
10 import android.content.Intent; | 10 import android.content.Intent; |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 private NonPresentingGvrContext mNonPresentingGvrContext; | 76 private NonPresentingGvrContext mNonPresentingGvrContext; |
77 private VrDaydreamApi mVrDaydreamApi; | 77 private VrDaydreamApi mVrDaydreamApi; |
78 private VrCoreVersionChecker mVrCoreVersionChecker; | 78 private VrCoreVersionChecker mVrCoreVersionChecker; |
79 private boolean mInVr; | 79 private boolean mInVr; |
80 private int mRestoreSystemUiVisibilityFlag = -1; | 80 private int mRestoreSystemUiVisibilityFlag = -1; |
81 private int mRestoreOrientation = ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIE
D; | 81 private int mRestoreOrientation = ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIE
D; |
82 private long mNativeVrShellDelegate; | 82 private long mNativeVrShellDelegate; |
83 private Tab mTab; | 83 private Tab mTab; |
84 private boolean mRequestedWebVR; | 84 private boolean mRequestedWebVR; |
85 private long mLastVRExit; | 85 private long mLastVRExit; |
| 86 private boolean mListeningForWebVrActivate; |
86 | 87 |
87 public VrShellDelegate(ChromeTabbedActivity activity) { | 88 public VrShellDelegate(ChromeTabbedActivity activity) { |
88 mActivity = activity; | 89 mActivity = activity; |
89 mVrAvailable = maybeFindVrClasses() && isVrCoreCompatible() && createVrD
aydreamApi(); | 90 mVrAvailable = maybeFindVrClasses() && isVrCoreCompatible() && createVrD
aydreamApi(); |
90 if (mVrAvailable) { | 91 if (mVrAvailable) { |
91 mEnterVRIntent = mVrDaydreamApi.createVrIntent( | 92 mEnterVRIntent = mVrDaydreamApi.createVrIntent( |
92 new ComponentName(mActivity, VR_ACTIVITY_ALIAS)); | 93 new ComponentName(mActivity, VR_ACTIVITY_ALIAS)); |
93 } else { | 94 } else { |
94 mEnterVRIntent = null; | 95 mEnterVRIntent = null; |
95 } | 96 } |
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
380 } | 381 } |
381 return mNonPresentingGvrContext.getNativeGvrContext(); | 382 return mNonPresentingGvrContext.getNativeGvrContext(); |
382 } | 383 } |
383 | 384 |
384 @CalledByNative | 385 @CalledByNative |
385 private void shutdownNonPresentingNativeContext() { | 386 private void shutdownNonPresentingNativeContext() { |
386 mNonPresentingGvrContext.shutdown(); | 387 mNonPresentingGvrContext.shutdown(); |
387 mNonPresentingGvrContext = null; | 388 mNonPresentingGvrContext = null; |
388 } | 389 } |
389 | 390 |
| 391 @CalledByNative |
| 392 private void setListeningForWebVrActivate(boolean listening) { |
| 393 mListeningForWebVrActivate = listening; |
| 394 } |
| 395 |
390 /** | 396 /** |
391 * Exits VR Shell, performing all necessary cleanup. | 397 * Exits VR Shell, performing all necessary cleanup. |
392 */ | 398 */ |
393 private void shutdownVR(boolean returnTo2D) { | 399 private void shutdownVR(boolean returnTo2D) { |
394 if (!mInVr) return; | 400 if (!mInVr) return; |
395 mRequestedWebVR = false; | 401 mRequestedWebVR = false; |
396 if (returnTo2D) { | 402 if (returnTo2D) { |
397 mVrDaydreamApi.exitFromVr(EXIT_VR_RESULT, new Intent()); | 403 mVrDaydreamApi.exitFromVr(EXIT_VR_RESULT, new Intent()); |
398 } else { | 404 } else { |
399 mVrDaydreamApi.setVrModeEnabled(false); | 405 mVrDaydreamApi.setVrModeEnabled(false); |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
544 * @return Pointer to the native VrShellDelegate object. | 550 * @return Pointer to the native VrShellDelegate object. |
545 */ | 551 */ |
546 @CalledByNative | 552 @CalledByNative |
547 private long getNativePointer() { | 553 private long getNativePointer() { |
548 return mNativeVrShellDelegate; | 554 return mNativeVrShellDelegate; |
549 } | 555 } |
550 | 556 |
551 private native long nativeInit(); | 557 private native long nativeInit(); |
552 private native void nativeSetPresentResult(long nativeVrShellDelegate, boole
an result); | 558 private native void nativeSetPresentResult(long nativeVrShellDelegate, boole
an result); |
553 } | 559 } |
OLD | NEW |