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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
70 private NonPresentingGvrContext mNonPresentingGvrContext; | 70 private NonPresentingGvrContext mNonPresentingGvrContext; |
71 private VrDaydreamApi mVrDaydreamApi; | 71 private VrDaydreamApi mVrDaydreamApi; |
72 private VrCoreVersionChecker mVrCoreVersionChecker; | 72 private VrCoreVersionChecker mVrCoreVersionChecker; |
73 private boolean mInVr; | 73 private boolean mInVr; |
74 private int mRestoreSystemUiVisibilityFlag = -1; | 74 private int mRestoreSystemUiVisibilityFlag = -1; |
75 private int mRestoreOrientation = ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIE D; | 75 private int mRestoreOrientation = ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIE D; |
76 private long mNativeVrShellDelegate; | 76 private long mNativeVrShellDelegate; |
77 private Tab mTab; | 77 private Tab mTab; |
78 private boolean mRequestedWebVR; | 78 private boolean mRequestedWebVR; |
79 private long mLastVRExit; | 79 private long mLastVRExit; |
80 private boolean mListeningForWebVrActivate; | |
80 | 81 |
81 public VrShellDelegate(ChromeTabbedActivity activity) { | 82 public VrShellDelegate(ChromeTabbedActivity activity) { |
82 mActivity = activity; | 83 mActivity = activity; |
83 mVrAvailable = maybeFindVrClasses() && isVrCoreCompatible(); | 84 mVrAvailable = maybeFindVrClasses() && isVrCoreCompatible(); |
84 createVrDaydreamApi(); | 85 createVrDaydreamApi(); |
85 mTabObserver = new EmptyTabObserver() { | 86 mTabObserver = new EmptyTabObserver() { |
86 @Override | 87 @Override |
87 public void onContentChanged(Tab tab) { | 88 public void onContentChanged(Tab tab) { |
88 if (tab.getNativePage() != null || tab.isShowingSadTab()) { | 89 if (tab.getNativePage() != null || tab.isShowingSadTab()) { |
89 // For now we don't handle native pages. crbug.com/661609 | 90 // For now we don't handle native pages. crbug.com/661609 |
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
359 } | 360 } |
360 return mNonPresentingGvrContext.getNativeGvrContext(); | 361 return mNonPresentingGvrContext.getNativeGvrContext(); |
361 } | 362 } |
362 | 363 |
363 @CalledByNative | 364 @CalledByNative |
364 private void shutdownNonPresentingNativeContext() { | 365 private void shutdownNonPresentingNativeContext() { |
365 mNonPresentingGvrContext.shutdown(); | 366 mNonPresentingGvrContext.shutdown(); |
366 mNonPresentingGvrContext = null; | 367 mNonPresentingGvrContext = null; |
367 } | 368 } |
368 | 369 |
370 @CalledByNative | |
371 private void setListeningForWebVrActivate(boolean listening) { | |
372 mListeningForWebVrActivate = listening; | |
dcheng
2016/11/17 19:08:04
is this write-only? Will it be used in a followup?
bajones
2016/11/17 19:23:28
Yes, the intent is to use it in a followup. (Needs
| |
373 } | |
374 | |
369 /** | 375 /** |
370 * Exits VR Shell, performing all necessary cleanup. | 376 * Exits VR Shell, performing all necessary cleanup. |
371 */ | 377 */ |
372 private void shutdownVR(boolean returnTo2D) { | 378 private void shutdownVR(boolean returnTo2D) { |
373 if (!mInVr) return; | 379 if (!mInVr) return; |
374 if (returnTo2D) { | 380 if (returnTo2D) { |
375 mVrDaydreamApi.exitFromVr(EXIT_VR_RESULT, new Intent()); | 381 mVrDaydreamApi.exitFromVr(EXIT_VR_RESULT, new Intent()); |
376 } else { | 382 } else { |
377 mVrDaydreamApi.setVrModeEnabled(false); | 383 mVrDaydreamApi.setVrModeEnabled(false); |
378 mLastVRExit = SystemClock.uptimeMillis(); | 384 mLastVRExit = SystemClock.uptimeMillis(); |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
530 /** | 536 /** |
531 * @return Pointer to the native VrShellDelegate object. | 537 * @return Pointer to the native VrShellDelegate object. |
532 */ | 538 */ |
533 @CalledByNative | 539 @CalledByNative |
534 private long getNativePointer() { | 540 private long getNativePointer() { |
535 return mNativeVrShellDelegate; | 541 return mNativeVrShellDelegate; |
536 } | 542 } |
537 | 543 |
538 private native long nativeInit(); | 544 private native long nativeInit(); |
539 } | 545 } |
OLD | NEW |