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

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

Issue 2694103006: Inject vr controller events into Android Native UI. (Closed)
Patch Set: autoformat Created 3 years, 10 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>
(...skipping 20 matching lines...) Expand all
31 namespace content { 31 namespace content {
32 class WebContents; 32 class WebContents;
33 } 33 }
34 34
35 namespace ui { 35 namespace ui {
36 class WindowAndroid; 36 class WindowAndroid;
37 } 37 }
38 38
39 namespace vr_shell { 39 namespace vr_shell {
40 40
41 class AndroidUiGestureTarget;
41 class UiInterface; 42 class UiInterface;
42 class VrCompositor; 43 class VrCompositor;
43 class VrGLThread; 44 class VrGLThread;
44 class VrInputManager; 45 class VrInputManager;
45 class VrMetricsHelper; 46 class VrMetricsHelper;
46 class VrShellDelegate; 47 class VrShellDelegate;
47 class VrWebContentsObserver; 48 class VrWebContentsObserver;
48 49
49 enum UiAction { 50 enum UiAction {
50 HISTORY_BACK = 0, 51 HISTORY_BACK = 0,
(...skipping 14 matching lines...) Expand all
65 class VrShell : public device::GvrDelegate, content::WebContentsObserver { 66 class VrShell : public device::GvrDelegate, content::WebContentsObserver {
66 public: 67 public:
67 VrShell(JNIEnv* env, jobject obj, 68 VrShell(JNIEnv* env, jobject obj,
68 ui::WindowAndroid* content_window, 69 ui::WindowAndroid* content_window,
69 content::WebContents* ui_contents, 70 content::WebContents* ui_contents,
70 ui::WindowAndroid* ui_window, 71 ui::WindowAndroid* ui_window,
71 bool for_web_vr, 72 bool for_web_vr,
72 VrShellDelegate* delegate, 73 VrShellDelegate* delegate,
73 gvr_context* gvr_api, 74 gvr_context* gvr_api,
74 bool reprojected_rendering); 75 bool reprojected_rendering);
75 void SwapContents(JNIEnv* env, 76 void SwapContents(
76 const base::android::JavaParamRef<jobject>& obj, 77 JNIEnv* env,
77 const base::android::JavaParamRef<jobject>& web_contents); 78 const base::android::JavaParamRef<jobject>& obj,
79 const base::android::JavaParamRef<jobject>& web_contents,
80 const base::android::JavaParamRef<jobject>& touch_event_synthesizer);
78 void LoadUIContent(JNIEnv* env, 81 void LoadUIContent(JNIEnv* env,
79 const base::android::JavaParamRef<jobject>& obj); 82 const base::android::JavaParamRef<jobject>& obj);
80 void Destroy(JNIEnv* env, const base::android::JavaParamRef<jobject>& obj); 83 void Destroy(JNIEnv* env, const base::android::JavaParamRef<jobject>& obj);
81 void OnTriggerEvent(JNIEnv* env, 84 void OnTriggerEvent(JNIEnv* env,
82 const base::android::JavaParamRef<jobject>& obj); 85 const base::android::JavaParamRef<jobject>& obj);
83 void OnPause(JNIEnv* env, 86 void OnPause(JNIEnv* env,
84 const base::android::JavaParamRef<jobject>& obj); 87 const base::android::JavaParamRef<jobject>& obj);
85 void OnResume(JNIEnv* env, 88 void OnResume(JNIEnv* env,
86 const base::android::JavaParamRef<jobject>& obj); 89 const base::android::JavaParamRef<jobject>& obj);
87 void SetSurface(JNIEnv* env, 90 void SetSurface(JNIEnv* env,
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 192
190 void ProcessTabArray(JNIEnv* env, jobjectArray tabs, bool incognito); 193 void ProcessTabArray(JNIEnv* env, jobjectArray tabs, bool incognito);
191 194
192 bool vr_shell_enabled_; 195 bool vr_shell_enabled_;
193 196
194 std::unique_ptr<UiInterface> html_interface_; 197 std::unique_ptr<UiInterface> html_interface_;
195 bool content_paused_ = false; 198 bool content_paused_ = false;
196 bool webvr_mode_ = false; 199 bool webvr_mode_ = false;
197 200
198 content::WebContents* main_contents_ = nullptr; 201 content::WebContents* main_contents_ = nullptr;
202 base::android::ScopedJavaGlobalRef<jobject> j_motion_event_synthesizer_;
199 ui::WindowAndroid* content_window_; 203 ui::WindowAndroid* content_window_;
200 std::unique_ptr<VrCompositor> content_compositor_; 204 std::unique_ptr<VrCompositor> content_compositor_;
201 content::WebContents* ui_contents_; 205 content::WebContents* ui_contents_;
202 std::unique_ptr<VrCompositor> ui_compositor_; 206 std::unique_ptr<VrCompositor> ui_compositor_;
203 207
204 std::unique_ptr<VrWebContentsObserver> vr_web_contents_observer_; 208 std::unique_ptr<VrWebContentsObserver> vr_web_contents_observer_;
205 209
206 VrShellDelegate* delegate_provider_ = nullptr; 210 VrShellDelegate* delegate_provider_ = nullptr;
207 base::android::ScopedJavaGlobalRef<jobject> j_vr_shell_; 211 base::android::ScopedJavaGlobalRef<jobject> j_vr_shell_;
208 212
209 std::unique_ptr<VrInputManager> content_input_manager_; 213 std::unique_ptr<VrInputManager> content_input_manager_;
214 std::unique_ptr<AndroidUiGestureTarget> android_ui_gesture_target_;
210 std::unique_ptr<VrInputManager> ui_input_manager_; 215 std::unique_ptr<VrInputManager> ui_input_manager_;
211 std::unique_ptr<VrMetricsHelper> metrics_helper_; 216 std::unique_ptr<VrMetricsHelper> metrics_helper_;
212 217
213 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_; 218 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_;
214 std::unique_ptr<VrGLThread> gl_thread_; 219 std::unique_ptr<VrGLThread> gl_thread_;
215 bool reprojected_rendering_; 220 bool reprojected_rendering_;
216 221
217 jobject content_surface_ = nullptr; 222 jobject content_surface_ = nullptr;
218 223
219 // TODO(mthiesse): Remove the need for this to be stored here. 224 // TODO(mthiesse): Remove the need for this to be stored here.
220 // crbug.com/674594 225 // crbug.com/674594
221 gvr_context* gvr_api_; 226 gvr_context* gvr_api_;
222 227
223 base::WeakPtrFactory<VrShell> weak_ptr_factory_; 228 base::WeakPtrFactory<VrShell> weak_ptr_factory_;
224 229
225 DISALLOW_COPY_AND_ASSIGN(VrShell); 230 DISALLOW_COPY_AND_ASSIGN(VrShell);
226 }; 231 };
227 232
228 bool RegisterVrShell(JNIEnv* env); 233 bool RegisterVrShell(JNIEnv* env);
229 234
230 } // namespace vr_shell 235 } // namespace vr_shell
231 236
232 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_H_ 237 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698