| 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 | 8 |
| 9 import com.google.vr.ndk.base.GvrLayout; | 9 import com.google.vr.ndk.base.GvrLayout; |
| 10 | 10 |
| 11 /** | 11 /** |
| 12 * Creates an active GvrContext from a detached GvrLayout. This is used by magic
window mode. | 12 * Creates an active GvrContext from a detached GvrLayout. This is used by magic
window mode. |
| 13 */ | 13 */ |
| 14 public class NonPresentingGvrContextImpl implements NonPresentingGvrContext { | 14 public class NonPresentingGvrContextImpl implements NonPresentingGvrContext { |
| 15 private GvrLayout mGvrLayout; | 15 private GvrLayout mGvrLayout; |
| 16 | 16 |
| 17 public NonPresentingGvrContextImpl(Activity activity) { | 17 public NonPresentingGvrContextImpl(Activity activity) { |
| 18 mGvrLayout = new GvrLayout(activity); | 18 mGvrLayout = new GvrLayout(activity); |
| 19 } | 19 } |
| 20 | 20 |
| 21 @Override | 21 @Override |
| 22 public long getNativeGvrContext() { | 22 public long getNativeGvrContext() { |
| 23 return mGvrLayout.getGvrApi().getNativeGvrContext(); | 23 return mGvrLayout.getGvrApi().getNativeGvrContext(); |
| 24 } | 24 } |
| 25 | 25 |
| 26 @Override | 26 @Override |
| 27 public void resume() { | |
| 28 mGvrLayout.getGvrApi().resumeTracking(); | |
| 29 } | |
| 30 | |
| 31 @Override | |
| 32 public void pause() { | |
| 33 // We can't pause/resume the GvrLayout, because doing so will force us t
o enter VR. However, | |
| 34 // we should be safe not pausing it as we never add it to the view hiera
rchy, or give it a | |
| 35 // presentation view, so there's nothing to pause but the tracking. | |
| 36 mGvrLayout.getGvrApi().pauseTracking(); | |
| 37 } | |
| 38 | |
| 39 @Override | |
| 40 public void shutdown() { | 27 public void shutdown() { |
| 41 mGvrLayout.shutdown(); | 28 mGvrLayout.shutdown(); |
| 42 } | 29 } |
| 43 } | 30 } |
| OLD | NEW |