| 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 <list> |
| 10 #include <memory> | 11 #include <memory> |
| 11 | 12 |
| 12 #include "base/android/jni_weak_ref.h" | 13 #include "base/android/jni_weak_ref.h" |
| 13 #include "base/callback.h" | 14 #include "base/callback.h" |
| 14 #include "base/macros.h" | 15 #include "base/macros.h" |
| 15 #include "base/memory/weak_ptr.h" | 16 #include "base/memory/weak_ptr.h" |
| 16 #include "base/single_thread_task_runner.h" | 17 #include "base/single_thread_task_runner.h" |
| 17 #include "content/public/browser/web_contents_observer.h" | 18 #include "content/public/browser/web_contents_observer.h" |
| 18 #include "device/vr/android/gvr/gvr_delegate.h" | 19 #include "device/vr/android/gvr/gvr_delegate.h" |
| 19 #include "third_party/gvr-android-sdk/src/libraries/headers/vr/gvr/capi/include/
gvr.h" | 20 #include "third_party/gvr-android-sdk/src/libraries/headers/vr/gvr/capi/include/
gvr.h" |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 void Destroy(JNIEnv* env, const base::android::JavaParamRef<jobject>& obj); | 71 void Destroy(JNIEnv* env, const base::android::JavaParamRef<jobject>& obj); |
| 71 void OnTriggerEvent(JNIEnv* env, | 72 void OnTriggerEvent(JNIEnv* env, |
| 72 const base::android::JavaParamRef<jobject>& obj); | 73 const base::android::JavaParamRef<jobject>& obj); |
| 73 void OnPause(JNIEnv* env, | 74 void OnPause(JNIEnv* env, |
| 74 const base::android::JavaParamRef<jobject>& obj); | 75 const base::android::JavaParamRef<jobject>& obj); |
| 75 void OnResume(JNIEnv* env, | 76 void OnResume(JNIEnv* env, |
| 76 const base::android::JavaParamRef<jobject>& obj); | 77 const base::android::JavaParamRef<jobject>& obj); |
| 77 void SetWebVrMode(JNIEnv* env, | 78 void SetWebVrMode(JNIEnv* env, |
| 78 const base::android::JavaParamRef<jobject>& obj, | 79 const base::android::JavaParamRef<jobject>& obj, |
| 79 bool enabled); | 80 bool enabled); |
| 81 void SetWebVrSurface(JNIEnv* env, |
| 82 const base::android::JavaParamRef<jobject>& obj, |
| 83 const base::android::JavaParamRef<jobject>& surface, |
| 84 jint textureHandle); |
| 80 | 85 |
| 81 void ContentWebContentsDestroyed(); | 86 void ContentWebContentsDestroyed(); |
| 82 // Called when our WebContents have been hidden. Usually a sign that something | 87 // Called when our WebContents have been hidden. Usually a sign that something |
| 83 // like another tab placed in front of it. | 88 // like another tab placed in front of it. |
| 84 void ContentWasHidden(); | 89 void ContentWasHidden(); |
| 85 | 90 |
| 86 // html/js UI hooks. | 91 // html/js UI hooks. |
| 87 static base::WeakPtr<VrShell> GetWeakPtr( | 92 static base::WeakPtr<VrShell> GetWeakPtr( |
| 88 const content::WebContents* web_contents); | 93 const content::WebContents* web_contents); |
| 89 | 94 |
| 90 // TODO(mthiesse): Clean up threading around UiInterface. | 95 // TODO(mthiesse): Clean up threading around UiInterface. |
| 91 UiInterface* GetUiInterface(); | 96 UiInterface* GetUiInterface(); |
| 92 void OnDomContentsLoaded(); | 97 void OnDomContentsLoaded(); |
| 93 | 98 |
| 94 // device::GvrDelegate implementation | 99 // device::GvrDelegate implementation |
| 95 // TODO(mthiesse): Clean up threading around GVR API. These functions are | 100 // TODO(mthiesse): Clean up threading around GVR API. These functions are |
| 96 // called on the UI thread, but use GL thread objects in a non-threadsafe way. | 101 // called on the UI thread, but use GL thread objects in a non-threadsafe way. |
| 97 void SetWebVRSecureOrigin(bool secure_origin) override; | 102 void SetWebVRSecureOrigin(bool secure_origin) override; |
| 98 void SubmitWebVRFrame() override; | 103 void SubmitWebVRFrame(int32_t surface_handle, device::mojom::VRPosePtr pose) o
verride; |
| 99 void UpdateWebVRTextureBounds(const gvr::Rectf& left_bounds, | 104 void UpdateWebVRTextureBounds(uint32_t for_pose_index, |
| 105 const gvr::Rectf& left_bounds, |
| 100 const gvr::Rectf& right_bounds) override; | 106 const gvr::Rectf& right_bounds) override; |
| 101 gvr::GvrApi* gvr_api() override; | 107 gvr::GvrApi* gvr_api() override; |
| 102 void SetGvrPoseForWebVr(const gvr::Mat4f& pose, uint32_t pose_num) override; | 108 void SetWebVRGvrPose(const gvr::Mat4f& pose, uint32_t pose_num, |
| 103 void SetWebVRRenderSurfaceSize(int width, int height) override; | 109 int64_t pose_time_nanos) override; |
| 104 gvr::Sizei GetWebVRCompositorSurfaceSize() override; | 110 void GetWebVRSurfaceHandle(int width, int height, const device::mojom::VRDispl
ay::GetSurfaceHandleCallback& callback) override; |
| 105 | 111 |
| 106 void SurfacesChanged(jobject content_surface, jobject ui_surface); | 112 void SurfacesChanged(jobject content_surface, jobject ui_surface); |
| 107 void GvrDelegateReady(); | 113 void GvrDelegateReady(); |
| 114 void OnWebVRFrameSubmitted(int32_t surface_handle, uint32_t frame_index, doubl
e elapsed); |
| 108 void AppButtonPressed(); | 115 void AppButtonPressed(); |
| 109 | 116 |
| 110 void ContentBoundsChanged( | 117 void ContentBoundsChanged( |
| 111 JNIEnv* env, | 118 JNIEnv* env, |
| 112 const base::android::JavaParamRef<jobject>& object, | 119 const base::android::JavaParamRef<jobject>& object, |
| 113 jint width, jint height, jfloat dpr); | 120 jint width, jint height, jfloat dpr); |
| 114 | 121 |
| 115 void UIBoundsChanged( | 122 void UIBoundsChanged( |
| 116 JNIEnv* env, | 123 JNIEnv* env, |
| 117 const base::android::JavaParamRef<jobject>& object, | 124 const base::android::JavaParamRef<jobject>& object, |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 base::WeakPtrFactory<VrShell> weak_ptr_factory_; | 169 base::WeakPtrFactory<VrShell> weak_ptr_factory_; |
| 163 | 170 |
| 164 DISALLOW_COPY_AND_ASSIGN(VrShell); | 171 DISALLOW_COPY_AND_ASSIGN(VrShell); |
| 165 }; | 172 }; |
| 166 | 173 |
| 167 bool RegisterVrShell(JNIEnv* env); | 174 bool RegisterVrShell(JNIEnv* env); |
| 168 | 175 |
| 169 } // namespace vr_shell | 176 } // namespace vr_shell |
| 170 | 177 |
| 171 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_H_ | 178 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_H_ |
| OLD | NEW |