| 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 "jni/VrShellDelegate_jni.h" | 9 #include "jni/VrShellDelegate_jni.h" |
| 10 | 10 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 VrShellDelegate::~VrShellDelegate() { | 48 VrShellDelegate::~VrShellDelegate() { |
| 49 GvrDelegateProvider::SetInstance(nullptr); | 49 GvrDelegateProvider::SetInstance(nullptr); |
| 50 } | 50 } |
| 51 | 51 |
| 52 VrShellDelegate* VrShellDelegate::getNativeDelegate( | 52 VrShellDelegate* VrShellDelegate::getNativeDelegate( |
| 53 JNIEnv* env, jobject jdelegate) { | 53 JNIEnv* env, jobject jdelegate) { |
| 54 long native_delegate = Java_VrShellDelegate_getNativePointer(env, jdelegate); | 54 long native_delegate = Java_VrShellDelegate_getNativePointer(env, jdelegate); |
| 55 return reinterpret_cast<VrShellDelegate*>(native_delegate); | 55 return reinterpret_cast<VrShellDelegate*>(native_delegate); |
| 56 } | 56 } |
| 57 | 57 |
| 58 bool VrShellDelegate::ExitWebVRIfNecessary(JNIEnv* env, jobject obj) { | 58 void VrShellDelegate::ExitWebVRIfNecessary(JNIEnv* env, jobject obj) { |
| 59 if (!device_provider_) | 59 if (!device_provider_) |
| 60 return false; | 60 return; |
| 61 | 61 |
| 62 device_provider_->OnGvrDelegateRemoved(); | 62 device_provider_->OnGvrDelegateRemoved(); |
| 63 return true; | |
| 64 } | 63 } |
| 65 | 64 |
| 66 bool VrShellDelegate::RequestWebVRPresent( | 65 bool VrShellDelegate::RequestWebVRPresent( |
| 67 device::GvrDeviceProvider* device_provider) { | 66 device::GvrDeviceProvider* device_provider) { |
| 68 // Only set one device provider at a time | 67 // Only set one device provider at a time |
| 69 DCHECK(!device_provider_); | 68 DCHECK(!device_provider_); |
| 70 device_provider_ = device_provider; | 69 device_provider_ = device_provider; |
| 71 | 70 |
| 72 // If/When VRShell is ready for use it will call OnVrShellReady. | 71 // If/When VRShell is ready for use it will call OnVrShellReady. |
| 73 JNIEnv* env = AttachCurrentThread(); | 72 JNIEnv* env = AttachCurrentThread(); |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 | 118 |
| 120 bool RegisterVrShellDelegate(JNIEnv* env) { | 119 bool RegisterVrShellDelegate(JNIEnv* env) { |
| 121 return RegisterNativesImpl(env); | 120 return RegisterNativesImpl(env); |
| 122 } | 121 } |
| 123 | 122 |
| 124 jlong Init(JNIEnv* env, const JavaParamRef<jobject>& obj) { | 123 jlong Init(JNIEnv* env, const JavaParamRef<jobject>& obj) { |
| 125 return reinterpret_cast<intptr_t>(new VrShellDelegate(env, obj)); | 124 return reinterpret_cast<intptr_t>(new VrShellDelegate(env, obj)); |
| 126 } | 125 } |
| 127 | 126 |
| 128 } // namespace vr_shell | 127 } // namespace vr_shell |
| OLD | NEW |