Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(57)

Side by Side Diff: chrome/browser/android/vr_shell/vr_shell.h

Issue 2624633002: Remove Sync GetPose VRService call, implement VRVSyncProvider (Closed)
Patch Set: Finish implementation Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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>
11 11
12 #include "base/android/jni_weak_ref.h" 12 #include "base/android/jni_weak_ref.h"
13 #include "base/callback.h" 13 #include "base/callback.h"
14 #include "base/macros.h" 14 #include "base/macros.h"
15 #include "base/memory/weak_ptr.h" 15 #include "base/memory/weak_ptr.h"
16 #include "base/single_thread_task_runner.h" 16 #include "base/single_thread_task_runner.h"
17 #include "content/public/browser/web_contents_observer.h" 17 #include "content/public/browser/web_contents_observer.h"
18 #include "device/vr/android/gvr/gvr_delegate.h" 18 #include "device/vr/android/gvr/gvr_delegate.h"
19 #include "device/vr/vr_service.mojom.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"
20 #include "third_party/gvr-android-sdk/src/libraries/headers/vr/gvr/capi/include/ gvr_types.h" 21 #include "third_party/gvr-android-sdk/src/libraries/headers/vr/gvr/capi/include/ gvr_types.h"
21 22
22 namespace base { 23 namespace base {
23 class ListValue; 24 class ListValue;
24 class Thread; 25 class Thread;
25 } 26 }
26 27
27 namespace content { 28 namespace content {
28 class WebContents; 29 class WebContents;
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 85
85 void ContentWebContentsDestroyed(); 86 void ContentWebContentsDestroyed();
86 // 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
87 // like another tab placed in front of it. 88 // like another tab placed in front of it.
88 void ContentWasHidden(); 89 void ContentWasHidden();
89 90
90 // html/js UI hooks. 91 // html/js UI hooks.
91 static base::WeakPtr<VrShell> GetWeakPtr( 92 static base::WeakPtr<VrShell> GetWeakPtr(
92 const content::WebContents* web_contents); 93 const content::WebContents* web_contents);
93 94
94 // TODO(mthiesse): Clean up threading around UiInterface.
95 UiInterface* GetUiInterface(); 95 UiInterface* GetUiInterface();
96 void OnDomContentsLoaded(); 96 void OnDomContentsLoaded();
97 97
98 // device::GvrDelegate implementation
99 // TODO(mthiesse): Clean up threading around GVR API. These functions are
100 // called on the UI thread, but use GL thread objects in a non-threadsafe way.
101 void SetWebVRSecureOrigin(bool secure_origin) override;
102 void SubmitWebVRFrame() override;
103 void UpdateWebVRTextureBounds(const gvr::Rectf& left_bounds,
104 const gvr::Rectf& right_bounds) override;
105 gvr::GvrApi* gvr_api() override;
106 void SetGvrPoseForWebVr(const gvr::Mat4f& pose, uint32_t pose_num) override;
107 void SetWebVRRenderSurfaceSize(int width, int height) override;
108 gvr::Sizei GetWebVRCompositorSurfaceSize() override;
109
110 void SurfacesChanged(jobject content_surface, jobject ui_surface); 98 void SurfacesChanged(jobject content_surface, jobject ui_surface);
111 void GvrDelegateReady(); 99 void GvrDelegateReady();
112 void AppButtonPressed(); 100 void AppButtonPressed();
113 101
114 void ContentPhysicalBoundsChanged( 102 void ContentPhysicalBoundsChanged(
115 JNIEnv* env, 103 JNIEnv* env,
116 const base::android::JavaParamRef<jobject>& object, 104 const base::android::JavaParamRef<jobject>& object,
117 jint width, jint height, jfloat dpr); 105 jint width, jint height, jfloat dpr);
118 106
119 void UIPhysicalBoundsChanged( 107 void UIPhysicalBoundsChanged(
120 JNIEnv* env, 108 JNIEnv* env,
121 const base::android::JavaParamRef<jobject>& object, 109 const base::android::JavaParamRef<jobject>& object,
122 jint width, jint height, jfloat dpr); 110 jint width, jint height, jfloat dpr);
123 111
124 void UpdateScene(const base::ListValue* args); 112 void UpdateScene(const base::ListValue* args);
125 113
126 // Perform a UI action triggered by the javascript API. 114 // Perform a UI action triggered by the javascript API.
127 void DoUiAction(const UiAction action); 115 void DoUiAction(const UiAction action);
128 116
129 void SetContentCssSize(float width, float height, float dpr); 117 void SetContentCssSize(float width, float height, float dpr);
130 void SetUiCssSize(float width, float height, float dpr); 118 void SetUiCssSize(float width, float height, float dpr);
131 119
132 void ContentFrameWasResized(bool width_changed); 120 void ContentFrameWasResized(bool width_changed);
133 121
134 void ForceExitVr(); 122 void ForceExitVr();
135 123
124 static device::mojom::VRPosePtr VRPosePtrFromGvrPose(gvr::Mat4f head_mat,
125 uint32_t pose_index);
126
136 private: 127 private:
137 ~VrShell() override; 128 virtual ~VrShell();
138 void SetShowingOverscrollGlow(bool showing_glow); 129 void SetShowingOverscrollGlow(bool showing_glow);
139 void PostToGlThreadWhenReady(const base::Closure& task); 130 void PostToGlThreadWhenReady(const base::Closure& task);
140 131
141 // content::WebContentsObserver implementation. All called on UI thread. 132 // content::WebContentsObserver implementation.
142 void RenderViewHostChanged(content::RenderViewHost* old_host, 133 void RenderViewHostChanged(content::RenderViewHost* old_host,
143 content::RenderViewHost* new_host) override; 134 content::RenderViewHost* new_host) override;
144 void MainFrameWasResized(bool width_changed) override; 135 void MainFrameWasResized(bool width_changed) override;
145 void WebContentsDestroyed() override; 136 void WebContentsDestroyed() override;
146 137
138 // device::GvrDelegate implementation
139 void SetWebVRSecureOrigin(bool secure_origin) override;
140 void SubmitWebVRFrame() override;
141 void UpdateWebVRTextureBounds(const gvr::Rectf& left_bounds,
142 const gvr::Rectf& right_bounds) override;
143 gvr::GvrApi* gvr_api() override;
144 void SetWebVRRenderSurfaceSize(int width, int height) override;
145 gvr::Sizei GetWebVRCompositorSurfaceSize() override;
146 void OnVRVsyncProviderRequest(
147 device::mojom::VRVSyncProviderRequest request) override;
148 void UpdateVSyncInterval(long timebase_nanos,
149 double interval_seconds) override;
150
147 std::unique_ptr<UiInterface> html_interface_; 151 std::unique_ptr<UiInterface> html_interface_;
148 152
149 content::WebContents* main_contents_; 153 content::WebContents* main_contents_;
150 std::unique_ptr<VrCompositor> content_compositor_; 154 std::unique_ptr<VrCompositor> content_compositor_;
151 content::WebContents* ui_contents_; 155 content::WebContents* ui_contents_;
152 std::unique_ptr<VrCompositor> ui_compositor_; 156 std::unique_ptr<VrCompositor> ui_compositor_;
153 157
154 std::unique_ptr<VrWebContentsObserver> vr_web_contents_observer_; 158 std::unique_ptr<VrWebContentsObserver> vr_web_contents_observer_;
155 159
156 VrShellDelegate* delegate_ = nullptr; 160 VrShellDelegate* delegate_ = nullptr;
(...skipping 10 matching lines...) Expand all
167 base::WeakPtrFactory<VrShell> weak_ptr_factory_; 171 base::WeakPtrFactory<VrShell> weak_ptr_factory_;
168 172
169 DISALLOW_COPY_AND_ASSIGN(VrShell); 173 DISALLOW_COPY_AND_ASSIGN(VrShell);
170 }; 174 };
171 175
172 bool RegisterVrShell(JNIEnv* env); 176 bool RegisterVrShell(JNIEnv* env);
173 177
174 } // namespace vr_shell 178 } // namespace vr_shell
175 179
176 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_H_ 180 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698