| Index: chrome/android/java/src/org/chromium/chrome/browser/vr_shell/NonPresentingGvrContext.java
|
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/vr_shell/NonPresentingGvrContext.java b/chrome/android/java/src/org/chromium/chrome/browser/vr_shell/NonPresentingGvrContext.java
|
| index 99f30f2f4319158454164eab9493e699b596329c..26f5e00d1cf7d14213811f4763eeba8b3feb4e9c 100644
|
| --- a/chrome/android/java/src/org/chromium/chrome/browser/vr_shell/NonPresentingGvrContext.java
|
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/vr_shell/NonPresentingGvrContext.java
|
| @@ -4,54 +4,28 @@
|
|
|
| package org.chromium.chrome.browser.vr_shell;
|
|
|
| -import android.app.Activity;
|
| -import android.os.StrictMode;
|
| -
|
| -import com.google.vr.ndk.base.GvrLayout;
|
| -
|
| -import org.chromium.base.Log;
|
| -import org.chromium.base.annotations.UsedByReflection;
|
| -
|
| /**
|
| - * Creates an active GvrContext from a detached GvrLayout. This is used by magic window mode.
|
| + * Abstracts away the NonPresentingGvrContext class, which may or may not be present at runtime
|
| + * depending on compile flags.
|
| */
|
| -@UsedByReflection("VrShellDelegate.java")
|
| -public class NonPresentingGvrContext implements NonPresentingGvrContextInterface {
|
| - private static final String TAG = "NPGvrContext";
|
| - private GvrLayout mGvrLayout;
|
| -
|
| - @UsedByReflection("VrShellDelegate.java")
|
| - public NonPresentingGvrContext(Activity activity) {
|
| - mGvrLayout = new GvrLayout(activity);
|
| - }
|
| -
|
| - @Override
|
| - public long getNativeGvrContext() {
|
| - long nativeGvrContext = 0;
|
| - StrictMode.ThreadPolicy oldPolicy = StrictMode.allowThreadDiskReads();
|
| - try {
|
| - nativeGvrContext = mGvrLayout.getGvrApi().getNativeGvrContext();
|
| - } catch (Exception ex) {
|
| - Log.e(TAG, "Unable to instantiate GvrApi", ex);
|
| - return 0;
|
| - } finally {
|
| - StrictMode.setThreadPolicy(oldPolicy);
|
| - }
|
| - return nativeGvrContext;
|
| - }
|
| -
|
| - @Override
|
| - public void resume() {
|
| - mGvrLayout.onResume();
|
| - }
|
| -
|
| - @Override
|
| - public void pause() {
|
| - mGvrLayout.onPause();
|
| - }
|
| -
|
| - @Override
|
| - public void shutdown() {
|
| - mGvrLayout.shutdown();
|
| - }
|
| +public interface NonPresentingGvrContext {
|
| + /**
|
| + * Returns the native gvr context.
|
| + */
|
| + long getNativeGvrContext();
|
| +
|
| + /**
|
| + * Must be called when activity resumes.
|
| + */
|
| + void resume();
|
| +
|
| + /**
|
| + * Must be called when activity pauses.
|
| + */
|
| + void pause();
|
| +
|
| + /**
|
| + * Shutdown the native gvr context.
|
| + */
|
| + void shutdown();
|
| }
|
|
|