| 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_H_ | 5 #ifndef CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_H_ |
| 6 #define CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_H_ | 6 #define CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_H_ |
| 7 | 7 |
| 8 #include <jni.h> | 8 #include <jni.h> |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/android/jni_weak_ref.h" | 12 #include "base/android/jni_weak_ref.h" |
| 13 #include "base/macros.h" | 13 #include "base/macros.h" |
| 14 #include "chrome/browser/android/vr_shell/ui_elements.h" | 14 #include "chrome/browser/android/vr_shell/ui_elements.h" |
| 15 #include "device/vr/android/gvr/gvr_delegate.h" | 15 #include "device/vr/android/gvr/gvr_delegate.h" |
| 16 #include "third_party/gvr-android-sdk/src/ndk-beta/include/vr/gvr/capi/include/g
vr.h" | 16 #include "third_party/gvr-android-sdk/src/ndk-beta/include/vr/gvr/capi/include/g
vr.h" |
| 17 #include "third_party/gvr-android-sdk/src/ndk-beta/include/vr/gvr/capi/include/g
vr_types.h" | 17 #include "third_party/gvr-android-sdk/src/ndk-beta/include/vr/gvr/capi/include/g
vr_types.h" |
| 18 | 18 |
| 19 namespace content { | 19 namespace content { |
| 20 class ContentViewCore; | 20 class ContentViewCore; |
| 21 } | 21 } |
| 22 | 22 |
| 23 namespace ui { | 23 namespace ui { |
| 24 class WindowAndroid; | 24 class WindowAndroid; |
| 25 } | 25 } |
| 26 | 26 |
| 27 namespace vr_shell { | 27 namespace vr_shell { |
| 28 | 28 |
| 29 class VrCompositor; | 29 class VrCompositor; |
| 30 class VrShellDelegate; |
| 30 class VrShellRenderer; | 31 class VrShellRenderer; |
| 31 | 32 |
| 32 | 33 |
| 33 class VrShell : public device::GvrDelegate { | 34 class VrShell : public device::GvrDelegate { |
| 34 public: | 35 public: |
| 35 VrShell(JNIEnv* env, jobject obj, | 36 VrShell(JNIEnv* env, jobject obj, |
| 36 content::ContentViewCore* content_view_core, | 37 content::ContentViewCore* content_view_core, |
| 37 ui::WindowAndroid* content_window); | 38 ui::WindowAndroid* content_window); |
| 38 | 39 |
| 39 void UpdateCompositorLayers(JNIEnv* env, | 40 void UpdateCompositorLayers(JNIEnv* env, |
| 40 const base::android::JavaParamRef<jobject>& obj); | 41 const base::android::JavaParamRef<jobject>& obj); |
| 41 void Destroy(JNIEnv* env, const base::android::JavaParamRef<jobject>& obj); | 42 void Destroy(JNIEnv* env, const base::android::JavaParamRef<jobject>& obj); |
| 43 void SetDelegate(JNIEnv* env, |
| 44 const base::android::JavaParamRef<jobject>& obj, |
| 45 const base::android::JavaParamRef<jobject>& delegate); |
| 42 void GvrInit(JNIEnv* env, | 46 void GvrInit(JNIEnv* env, |
| 43 const base::android::JavaParamRef<jobject>& obj, | 47 const base::android::JavaParamRef<jobject>& obj, |
| 44 jlong native_gvr_api); | 48 jlong native_gvr_api); |
| 45 void InitializeGl(JNIEnv* env, | 49 void InitializeGl(JNIEnv* env, |
| 46 const base::android::JavaParamRef<jobject>& obj, | 50 const base::android::JavaParamRef<jobject>& obj, |
| 47 jint texture_data_handle); | 51 jint texture_data_handle); |
| 48 void DrawFrame(JNIEnv* env, const base::android::JavaParamRef<jobject>& obj); | 52 void DrawFrame(JNIEnv* env, const base::android::JavaParamRef<jobject>& obj); |
| 49 void OnPause(JNIEnv* env, const base::android::JavaParamRef<jobject>& obj); | 53 void OnPause(JNIEnv* env, const base::android::JavaParamRef<jobject>& obj); |
| 50 void OnResume(JNIEnv* env, const base::android::JavaParamRef<jobject>& obj); | 54 void OnResume(JNIEnv* env, const base::android::JavaParamRef<jobject>& obj); |
| 55 void SetWebVrMode(JNIEnv* env, |
| 56 const base::android::JavaParamRef<jobject>& obj, |
| 57 bool enabled); |
| 51 | 58 |
| 52 // GvrDelegate | 59 // device::GvrDelegate implementation |
| 53 void RequestWebVRPresent() override; | |
| 54 void ExitWebVRPresent() override; | |
| 55 void SubmitWebVRFrame() override; | 60 void SubmitWebVRFrame() override; |
| 56 void UpdateWebVRTextureBounds( | 61 void UpdateWebVRTextureBounds( |
| 57 int eye, float left, float top, float width, float height) override; | 62 int eye, float left, float top, float width, float height) override; |
| 58 gvr::GvrApi* gvr_api() override; | 63 gvr::GvrApi* gvr_api() override; |
| 59 | 64 |
| 60 void ContentSurfaceDestroyed( | 65 void ContentSurfaceDestroyed( |
| 61 JNIEnv* env, | 66 JNIEnv* env, |
| 62 const base::android::JavaParamRef<jobject>& object); | 67 const base::android::JavaParamRef<jobject>& object); |
| 63 void ContentSurfaceChanged( | 68 void ContentSurfaceChanged( |
| 64 JNIEnv* env, | 69 JNIEnv* env, |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 gvr::Mat4f projection_matrix_; | 107 gvr::Mat4f projection_matrix_; |
| 103 | 108 |
| 104 gvr::Mat4f head_pose_; | 109 gvr::Mat4f head_pose_; |
| 105 gvr::Vec3f forward_vector_; | 110 gvr::Vec3f forward_vector_; |
| 106 | 111 |
| 107 gvr::Sizei render_size_; | 112 gvr::Sizei render_size_; |
| 108 | 113 |
| 109 std::unique_ptr<VrCompositor> content_compositor_view_; | 114 std::unique_ptr<VrCompositor> content_compositor_view_; |
| 110 content::ContentViewCore* content_cvc_; | 115 content::ContentViewCore* content_cvc_; |
| 111 | 116 |
| 117 VrShellDelegate* delegate_; |
| 112 std::unique_ptr<VrShellRenderer> vr_shell_renderer_; | 118 std::unique_ptr<VrShellRenderer> vr_shell_renderer_; |
| 113 base::android::ScopedJavaGlobalRef<jobject> j_vr_shell_; | 119 base::android::ScopedJavaGlobalRef<jobject> j_vr_shell_; |
| 114 | 120 |
| 115 gvr::Quatf controller_quat_; | 121 gvr::Quatf controller_quat_; |
| 116 bool controller_active_ = false; | 122 bool controller_active_ = false; |
| 117 gvr::Vec3f look_at_vector_; | 123 gvr::Vec3f look_at_vector_; |
| 118 | 124 |
| 119 bool webvr_mode_ = false; | 125 bool webvr_mode_ = false; |
| 120 | 126 |
| 121 DISALLOW_COPY_AND_ASSIGN(VrShell); | 127 DISALLOW_COPY_AND_ASSIGN(VrShell); |
| 122 }; | 128 }; |
| 123 | 129 |
| 124 bool RegisterVrShell(JNIEnv* env); | 130 bool RegisterVrShell(JNIEnv* env); |
| 125 | 131 |
| 126 } // namespace vr_shell | 132 } // namespace vr_shell |
| 127 | 133 |
| 128 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_H_ | 134 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_H_ |
| OLD | NEW |