| 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> |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 const content::WebContents* web_contents); | 71 const content::WebContents* web_contents); |
| 72 UiScene* GetScene(); | 72 UiScene* GetScene(); |
| 73 void OnDomContentsLoaded(); | 73 void OnDomContentsLoaded(); |
| 74 | 74 |
| 75 // device::GvrDelegate implementation | 75 // device::GvrDelegate implementation |
| 76 void SetWebVRSecureOrigin(bool secure_origin) override; | 76 void SetWebVRSecureOrigin(bool secure_origin) override; |
| 77 void SubmitWebVRFrame() override; | 77 void SubmitWebVRFrame() override; |
| 78 void UpdateWebVRTextureBounds( | 78 void UpdateWebVRTextureBounds( |
| 79 int eye, float left, float top, float width, float height) override; | 79 int eye, float left, float top, float width, float height) override; |
| 80 gvr::GvrApi* gvr_api() override; | 80 gvr::GvrApi* gvr_api() override; |
| 81 void SetGvrPoseForWebVr(const gvr::Mat4f& pose, uint32_t pose_num) override; |
| 81 | 82 |
| 82 void ContentSurfaceChanged( | 83 void ContentSurfaceChanged( |
| 83 JNIEnv* env, | 84 JNIEnv* env, |
| 84 const base::android::JavaParamRef<jobject>& object, | 85 const base::android::JavaParamRef<jobject>& object, |
| 85 jint width, | 86 jint width, |
| 86 jint height, | 87 jint height, |
| 87 const base::android::JavaParamRef<jobject>& surface); | 88 const base::android::JavaParamRef<jobject>& surface); |
| 88 void UiSurfaceChanged( | 89 void UiSurfaceChanged( |
| 89 JNIEnv* env, | 90 JNIEnv* env, |
| 90 const base::android::JavaParamRef<jobject>& object, | 91 const base::android::JavaParamRef<jobject>& object, |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 | 155 |
| 155 gvr::Vec3f target_point_; | 156 gvr::Vec3f target_point_; |
| 156 const ContentRectangle* target_element_ = nullptr; | 157 const ContentRectangle* target_element_ = nullptr; |
| 157 VrInputManager* current_input_target_ = nullptr; | 158 VrInputManager* current_input_target_ = nullptr; |
| 158 int ui_tex_width_ = 0; | 159 int ui_tex_width_ = 0; |
| 159 int ui_tex_height_ = 0; | 160 int ui_tex_height_ = 0; |
| 160 | 161 |
| 161 bool webvr_mode_ = false; | 162 bool webvr_mode_ = false; |
| 162 bool webvr_secure_origin_ = false; | 163 bool webvr_secure_origin_ = false; |
| 163 int64_t webvr_warning_end_nanos_ = 0; | 164 int64_t webvr_warning_end_nanos_ = 0; |
| 165 // The pose ring buffer size must be a power of two to avoid glitches when |
| 166 // the pose index wraps around. It should be large enough to handle the |
| 167 // current backlog of poses which is 2-3 frames. |
| 168 static constexpr int kPoseRingBufferSize = 8; |
| 169 std::vector<gvr::Mat4f> webvr_head_pose_; |
| 164 | 170 |
| 165 std::unique_ptr<VrController> controller_; | 171 std::unique_ptr<VrController> controller_; |
| 166 scoped_refptr<VrInputManager> content_input_manager_; | 172 scoped_refptr<VrInputManager> content_input_manager_; |
| 167 scoped_refptr<VrInputManager> ui_input_manager_; | 173 scoped_refptr<VrInputManager> ui_input_manager_; |
| 168 | 174 |
| 169 base::WeakPtrFactory<VrShell> weak_ptr_factory_; | 175 base::WeakPtrFactory<VrShell> weak_ptr_factory_; |
| 170 | 176 |
| 171 DISALLOW_COPY_AND_ASSIGN(VrShell); | 177 DISALLOW_COPY_AND_ASSIGN(VrShell); |
| 172 }; | 178 }; |
| 173 | 179 |
| 174 bool RegisterVrShell(JNIEnv* env); | 180 bool RegisterVrShell(JNIEnv* env); |
| 175 | 181 |
| 176 } // namespace vr_shell | 182 } // namespace vr_shell |
| 177 | 183 |
| 178 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_H_ | 184 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_H_ |
| OLD | NEW |