| 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 #include "chrome/browser/android/vr_shell/vr_shell_delegate.h" | 5 #include "chrome/browser/android/vr_shell/vr_shell_delegate.h" |
| 6 | 6 |
| 7 #include "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
| 8 #include "chrome/browser/android/vr_shell/vr_shell.h" | 8 #include "chrome/browser/android/vr_shell/vr_shell.h" |
| 9 #include "device/vr/android/gvr/gvr_device_provider.h" | 9 #include "device/vr/android/gvr/gvr_device_provider.h" |
| 10 #include "jni/VrShellDelegate_jni.h" | 10 #include "jni/VrShellDelegate_jni.h" |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 // Can only handle one request at a time. This is also extremely unlikely to | 87 // Can only handle one request at a time. This is also extremely unlikely to |
| 88 // happen in practice. | 88 // happen in practice. |
| 89 callback.Run(false); | 89 callback.Run(false); |
| 90 return; | 90 return; |
| 91 } | 91 } |
| 92 | 92 |
| 93 present_callback_ = std::move(callback); | 93 present_callback_ = std::move(callback); |
| 94 | 94 |
| 95 // If/When VRShell is ready for use it will call SetPresentResult. | 95 // If/When VRShell is ready for use it will call SetPresentResult. |
| 96 JNIEnv* env = AttachCurrentThread(); | 96 JNIEnv* env = AttachCurrentThread(); |
| 97 Java_VrShellDelegate_presentRequested(env, j_vr_shell_delegate_.obj(), true); | 97 Java_VrShellDelegate_presentRequested(env, j_vr_shell_delegate_.obj()); |
| 98 } | 98 } |
| 99 | 99 |
| 100 void VrShellDelegate::ExitWebVRPresent() { | 100 void VrShellDelegate::ExitWebVRPresent() { |
| 101 // VRShell is no longer needed by WebVR, allow it to shut down if it's not | 101 // VRShell is no longer needed by WebVR, allow it to shut down if it's not |
| 102 // being used elsewhere. | 102 // being used elsewhere. |
| 103 JNIEnv* env = AttachCurrentThread(); | 103 JNIEnv* env = AttachCurrentThread(); |
| 104 Java_VrShellDelegate_exitWebVR(env, j_vr_shell_delegate_.obj()); | 104 Java_VrShellDelegate_exitWebVR(env, j_vr_shell_delegate_.obj()); |
| 105 } | 105 } |
| 106 | 106 |
| 107 void VrShellDelegate::ForceExitVr() { | 107 void VrShellDelegate::ForceExitVr() { |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 | 144 |
| 145 bool RegisterVrShellDelegate(JNIEnv* env) { | 145 bool RegisterVrShellDelegate(JNIEnv* env) { |
| 146 return RegisterNativesImpl(env); | 146 return RegisterNativesImpl(env); |
| 147 } | 147 } |
| 148 | 148 |
| 149 jlong Init(JNIEnv* env, const JavaParamRef<jobject>& obj) { | 149 jlong Init(JNIEnv* env, const JavaParamRef<jobject>& obj) { |
| 150 return reinterpret_cast<intptr_t>(new VrShellDelegate(env, obj)); | 150 return reinterpret_cast<intptr_t>(new VrShellDelegate(env, obj)); |
| 151 } | 151 } |
| 152 | 152 |
| 153 } // namespace vr_shell | 153 } // namespace vr_shell |
| OLD | NEW |