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 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 void OnDomContentsLoaded(); | 82 void OnDomContentsLoaded(); |
83 | 83 |
84 // device::GvrDelegate implementation | 84 // device::GvrDelegate implementation |
85 void SetWebVRSecureOrigin(bool secure_origin) override; | 85 void SetWebVRSecureOrigin(bool secure_origin) override; |
86 void SubmitWebVRFrame() override; | 86 void SubmitWebVRFrame() override; |
87 void UpdateWebVRTextureBounds( | 87 void UpdateWebVRTextureBounds( |
88 int eye, float left, float top, float width, float height) override; | 88 int eye, float left, float top, float width, float height) override; |
89 gvr::GvrApi* gvr_api() override; | 89 gvr::GvrApi* gvr_api() override; |
90 void SetGvrPoseForWebVr(const gvr::Mat4f& pose, uint32_t pose_num) override; | 90 void SetGvrPoseForWebVr(const gvr::Mat4f& pose, uint32_t pose_num) override; |
91 | 91 |
92 void ContentSurfaceChanged( | 92 void SurfacesChanged( |
93 JNIEnv* env, | 93 JNIEnv* env, |
94 const base::android::JavaParamRef<jobject>& object, | 94 const base::android::JavaParamRef<jobject>& object, |
95 jint width, | 95 const base::android::JavaParamRef<jobject>& content_surface, |
96 jint height, | 96 const base::android::JavaParamRef<jobject>& ui_surface); |
97 const base::android::JavaParamRef<jobject>& surface); | 97 |
98 void UiSurfaceChanged( | 98 void ContentBoundsChanged( |
99 JNIEnv* env, | 99 JNIEnv* env, |
100 const base::android::JavaParamRef<jobject>& object, | 100 const base::android::JavaParamRef<jobject>& object, |
101 jint width, | 101 jint width, jint height); |
102 jint height, | 102 |
103 const base::android::JavaParamRef<jobject>& surface); | 103 void UIBoundsChanged( |
| 104 JNIEnv* env, |
| 105 const base::android::JavaParamRef<jobject>& object, |
| 106 jint width, jint height); |
104 | 107 |
105 // Called from non-render thread to queue a callback onto the render thread. | 108 // Called from non-render thread to queue a callback onto the render thread. |
106 // The render thread checks for callbacks and processes them between frames. | 109 // The render thread checks for callbacks and processes them between frames. |
107 void QueueTask(base::Callback<void()>& callback); | 110 void QueueTask(base::Callback<void()>& callback); |
108 | 111 |
109 // Perform a UI action triggered by the javascript API. | 112 // Perform a UI action triggered by the javascript API. |
110 void DoUiAction(const UiAction action); | 113 void DoUiAction(const UiAction action); |
111 | 114 |
| 115 void SetContentCssSize(float width, float height, float dpr); |
| 116 void SetUiCssSize(float width, float height, float dpr); |
| 117 |
112 private: | 118 private: |
113 virtual ~VrShell(); | 119 virtual ~VrShell(); |
114 void LoadUIContent(); | 120 void LoadUIContent(); |
115 bool IsUiTextureReady(); | 121 bool IsUiTextureReady(); |
116 // Converts a pixel rectangle to (0..1) float texture coordinates. | 122 // Converts a pixel rectangle to (0..1) float texture coordinates. |
117 // Callers need to ensure that the texture width/height is | 123 // Callers need to ensure that the texture width/height is |
118 // initialized by checking IsUiTextureReady() first. | 124 // initialized by checking IsUiTextureReady() first. |
119 Rectf MakeUiGlCopyRect(Recti pixel_rect); | 125 Rectf MakeUiGlCopyRect(Recti pixel_rect); |
120 void DrawVrShell(const gvr::Mat4f& head_pose); | 126 void DrawVrShell(const gvr::Mat4f& head_pose); |
121 void DrawEye(const gvr::Mat4f& view_matrix, | 127 void DrawEye(const gvr::Mat4f& view_matrix, |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 base::WeakPtrFactory<VrShell> weak_ptr_factory_; | 192 base::WeakPtrFactory<VrShell> weak_ptr_factory_; |
187 | 193 |
188 DISALLOW_COPY_AND_ASSIGN(VrShell); | 194 DISALLOW_COPY_AND_ASSIGN(VrShell); |
189 }; | 195 }; |
190 | 196 |
191 bool RegisterVrShell(JNIEnv* env); | 197 bool RegisterVrShell(JNIEnv* env); |
192 | 198 |
193 } // namespace vr_shell | 199 } // namespace vr_shell |
194 | 200 |
195 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_H_ | 201 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_H_ |
OLD | NEW |