| 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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 void SubmitWebVRFrame() override; | 101 void SubmitWebVRFrame() override; |
| 102 void UpdateWebVRTextureBounds(const gvr::Rectf& left_bounds, | 102 void UpdateWebVRTextureBounds(const gvr::Rectf& left_bounds, |
| 103 const gvr::Rectf& right_bounds) override; | 103 const gvr::Rectf& right_bounds) override; |
| 104 gvr::GvrApi* gvr_api() override; | 104 gvr::GvrApi* gvr_api() override; |
| 105 void SetGvrPoseForWebVr(const gvr::Mat4f& pose, uint32_t pose_num) override; | 105 void SetGvrPoseForWebVr(const gvr::Mat4f& pose, uint32_t pose_num) override; |
| 106 void SetWebVRRenderSurfaceSize(int width, int height) override; | 106 void SetWebVRRenderSurfaceSize(int width, int height) override; |
| 107 gvr::Sizei GetWebVRCompositorSurfaceSize() override; | 107 gvr::Sizei GetWebVRCompositorSurfaceSize() override; |
| 108 | 108 |
| 109 void SurfacesChanged(jobject content_surface, jobject ui_surface); | 109 void SurfacesChanged(jobject content_surface, jobject ui_surface); |
| 110 void GvrDelegateReady(); | 110 void GvrDelegateReady(); |
| 111 void AppButtonPressed(); |
| 111 | 112 |
| 112 void ContentBoundsChanged( | 113 void ContentBoundsChanged( |
| 113 JNIEnv* env, | 114 JNIEnv* env, |
| 114 const base::android::JavaParamRef<jobject>& object, | 115 const base::android::JavaParamRef<jobject>& object, |
| 115 jint width, jint height, jfloat dpr); | 116 jint width, jint height, jfloat dpr); |
| 116 | 117 |
| 117 void UIBoundsChanged( | 118 void UIBoundsChanged( |
| 118 JNIEnv* env, | 119 JNIEnv* env, |
| 119 const base::android::JavaParamRef<jobject>& object, | 120 const base::android::JavaParamRef<jobject>& object, |
| 120 jint width, jint height, jfloat dpr); | 121 jint width, jint height, jfloat dpr); |
| 121 | 122 |
| 122 // Called from non-render thread to queue a callback onto the render thread. | 123 // Called from non-render thread to queue a callback onto the render thread. |
| 123 // The render thread checks for callbacks and processes them between frames. | 124 // The render thread checks for callbacks and processes them between frames. |
| 124 void QueueTask(base::Callback<void()>& callback); | 125 void QueueTask(base::Callback<void()>& callback); |
| 125 | 126 |
| 126 // Perform a UI action triggered by the javascript API. | 127 // Perform a UI action triggered by the javascript API. |
| 127 void DoUiAction(const UiAction action); | 128 void DoUiAction(const UiAction action); |
| 128 | 129 |
| 129 void SetContentCssSize(float width, float height, float dpr); | 130 void SetContentCssSize(float width, float height, float dpr); |
| 130 void SetUiCssSize(float width, float height, float dpr); | 131 void SetUiCssSize(float width, float height, float dpr); |
| 131 | 132 |
| 132 void ContentFrameWasResized(bool width_changed); | 133 void ContentFrameWasResized(bool width_changed); |
| 133 | 134 |
| 134 void ForceExitVR(); | 135 void ForceExitVR(); |
| 135 | 136 |
| 136 private: | 137 private: |
| 137 ~VrShell() override; | 138 ~VrShell() override; |
| 138 void SetShowingOverscrollGlow(bool showing_glow); | 139 void SetShowingOverscrollGlow(bool showing_glow); |
| 140 void PostToGlThreadWhenReady(const base::Closure& task); |
| 139 | 141 |
| 140 // content::WebContentsObserver implementation. All called on UI thread. | 142 // content::WebContentsObserver implementation. All called on UI thread. |
| 141 void RenderViewHostChanged(content::RenderViewHost* old_host, | 143 void RenderViewHostChanged(content::RenderViewHost* old_host, |
| 142 content::RenderViewHost* new_host) override; | 144 content::RenderViewHost* new_host) override; |
| 143 void MainFrameWasResized(bool width_changed) override; | 145 void MainFrameWasResized(bool width_changed) override; |
| 144 void WebContentsDestroyed() override; | 146 void WebContentsDestroyed() override; |
| 145 | 147 |
| 146 std::unique_ptr<UiInterface> html_interface_; | 148 std::unique_ptr<UiInterface> html_interface_; |
| 147 | 149 |
| 148 std::unique_ptr<VrCompositor> content_compositor_; | 150 std::unique_ptr<VrCompositor> content_compositor_; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 165 base::WeakPtrFactory<VrShell> weak_ptr_factory_; | 167 base::WeakPtrFactory<VrShell> weak_ptr_factory_; |
| 166 | 168 |
| 167 DISALLOW_COPY_AND_ASSIGN(VrShell); | 169 DISALLOW_COPY_AND_ASSIGN(VrShell); |
| 168 }; | 170 }; |
| 169 | 171 |
| 170 bool RegisterVrShell(JNIEnv* env); | 172 bool RegisterVrShell(JNIEnv* env); |
| 171 | 173 |
| 172 } // namespace vr_shell | 174 } // namespace vr_shell |
| 173 | 175 |
| 174 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_H_ | 176 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_H_ |
| OLD | NEW |