| 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 #ifndef CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_DELEGATE_H_ | 5 #ifndef CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_DELEGATE_H_ |
| 6 #define CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_DELEGATE_H_ | 6 #define CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_DELEGATE_H_ |
| 7 | 7 |
| 8 #include <jni.h> | 8 #include <jni.h> |
| 9 | 9 |
| 10 #include "base/android/jni_weak_ref.h" | 10 #include "base/android/jni_weak_ref.h" |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "device/vr/android/gvr/gvr_delegate.h" | 12 #include "device/vr/android/gvr/gvr_delegate.h" |
| 13 | 13 |
| 14 namespace vr_shell { | 14 namespace vr_shell { |
| 15 | 15 |
| 16 class VrShell; | 16 class VrShell; |
| 17 | 17 |
| 18 class VrShellDelegate : public device::GvrDelegateProvider { | 18 class VrShellDelegate : public device::GvrDelegateProvider { |
| 19 public: | 19 public: |
| 20 VrShellDelegate(JNIEnv* env, jobject obj); | 20 VrShellDelegate(JNIEnv* env, jobject obj); |
| 21 virtual ~VrShellDelegate(); | 21 virtual ~VrShellDelegate(); |
| 22 | 22 |
| 23 static VrShellDelegate* getNativeDelegate(JNIEnv* env, jobject jdelegate); | 23 static VrShellDelegate* getNativeDelegate(JNIEnv* env, jobject jdelegate); |
| 24 | 24 |
| 25 // Called by the Java VrShellDelegate. Returns true if the GvrDeviceProvider | 25 // Called by the Java VrShellDelegate. Returns true if the GvrDeviceProvider |
| 26 // needs to handle shutdown first. | 26 // needs to handle shutdown first. |
| 27 bool ExitWebVRIfNecessary(JNIEnv* env, jobject obj); | 27 void ExitWebVRIfNecessary(JNIEnv* env, jobject obj); |
| 28 | 28 |
| 29 // device::vrDelegateProvider implementation | 29 // device::vrDelegateProvider implementation |
| 30 bool RequestWebVRPresent(device::GvrDeviceProvider* device_provider) override; | 30 bool RequestWebVRPresent(device::GvrDeviceProvider* device_provider) override; |
| 31 void ExitWebVRPresent() override; | 31 void ExitWebVRPresent() override; |
| 32 device::GvrDelegate* GetNonPresentingDelegate() override; | 32 device::GvrDelegate* GetNonPresentingDelegate() override; |
| 33 void DestroyNonPresentingDelegate() override; | 33 void DestroyNonPresentingDelegate() override; |
| 34 | 34 |
| 35 // Called from VRShell | 35 // Called from VRShell |
| 36 void OnVrShellReady(VrShell* vr_shell); | 36 void OnVrShellReady(VrShell* vr_shell); |
| 37 | 37 |
| 38 private: | 38 private: |
| 39 std::unique_ptr<device::GvrDelegate> non_presenting_delegate_; | 39 std::unique_ptr<device::GvrDelegate> non_presenting_delegate_; |
| 40 base::android::ScopedJavaGlobalRef<jobject> j_vr_shell_delegate_; | 40 base::android::ScopedJavaGlobalRef<jobject> j_vr_shell_delegate_; |
| 41 device::GvrDeviceProvider* device_provider_; | 41 device::GvrDeviceProvider* device_provider_; |
| 42 | 42 |
| 43 DISALLOW_COPY_AND_ASSIGN(VrShellDelegate); | 43 DISALLOW_COPY_AND_ASSIGN(VrShellDelegate); |
| 44 }; | 44 }; |
| 45 | 45 |
| 46 bool RegisterVrShellDelegate(JNIEnv* env); | 46 bool RegisterVrShellDelegate(JNIEnv* env); |
| 47 | 47 |
| 48 } // namespace vr_shell | 48 } // namespace vr_shell |
| 49 | 49 |
| 50 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_DELEGATE_H_ | 50 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_DELEGATE_H_ |
| OLD | NEW |