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