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

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

Issue 2319863005: Implement new compositor and ContentViewCore reparenting for VR Shell. (Closed)
Patch Set: Rebase onto ToT Created 4 years, 3 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 #include <memory> 9 #include <memory>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/android/jni_weak_ref.h" 12 #include "base/android/jni_weak_ref.h"
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "chrome/browser/android/vr_shell/ui_elements.h" 14 #include "chrome/browser/android/vr_shell/ui_elements.h"
15 #include "device/vr/android/gvr/gvr_delegate.h" 15 #include "device/vr/android/gvr/gvr_delegate.h"
16 #include "third_party/gvr-android-sdk/src/ndk-beta/include/vr/gvr/capi/include/g vr.h" 16 #include "third_party/gvr-android-sdk/src/ndk-beta/include/vr/gvr/capi/include/g vr.h"
17 #include "third_party/gvr-android-sdk/src/ndk-beta/include/vr/gvr/capi/include/g vr_types.h" 17 #include "third_party/gvr-android-sdk/src/ndk-beta/include/vr/gvr/capi/include/g vr_types.h"
18 18
19 namespace content {
20 class ContentViewCore;
21 }
22
23 namespace ui {
24 class WindowAndroid;
25 }
19 26
20 namespace vr_shell { 27 namespace vr_shell {
21 28
29 class VrCompositor;
22 class VrShellRenderer; 30 class VrShellRenderer;
23 31
24 32
25 class VrShell : public device::GvrDelegate { 33 class VrShell : public device::GvrDelegate {
26 public: 34 public:
27 VrShell(JNIEnv* env, jobject obj); 35 VrShell(JNIEnv* env, jobject obj,
36 content::ContentViewCore* content_view_core,
37 ui::WindowAndroid* content_window);
28 38
39 void UpdateCompositorLayers(JNIEnv* env,
40 const base::android::JavaParamRef<jobject>& obj);
29 void Destroy(JNIEnv* env, const base::android::JavaParamRef<jobject>& obj); 41 void Destroy(JNIEnv* env, const base::android::JavaParamRef<jobject>& obj);
30 void GvrInit(JNIEnv* env, 42 void GvrInit(JNIEnv* env,
31 const base::android::JavaParamRef<jobject>& obj, 43 const base::android::JavaParamRef<jobject>& obj,
32 jlong native_gvr_api); 44 jlong native_gvr_api);
33 void InitializeGl(JNIEnv* env, 45 void InitializeGl(JNIEnv* env,
34 const base::android::JavaParamRef<jobject>& obj, 46 const base::android::JavaParamRef<jobject>& obj,
35 jint texture_data_handle); 47 jint texture_data_handle);
36 void DrawFrame(JNIEnv* env, const base::android::JavaParamRef<jobject>& obj); 48 void DrawFrame(JNIEnv* env, const base::android::JavaParamRef<jobject>& obj);
37 void OnPause(JNIEnv* env, const base::android::JavaParamRef<jobject>& obj); 49 void OnPause(JNIEnv* env, const base::android::JavaParamRef<jobject>& obj);
38 void OnResume(JNIEnv* env, const base::android::JavaParamRef<jobject>& obj); 50 void OnResume(JNIEnv* env, const base::android::JavaParamRef<jobject>& obj);
39 51
40 // GvrDelegate 52 // GvrDelegate
41 void RequestWebVRPresent() override; 53 void RequestWebVRPresent() override;
42 void ExitWebVRPresent() override; 54 void ExitWebVRPresent() override;
43 void SubmitWebVRFrame() override; 55 void SubmitWebVRFrame() override;
44 void UpdateWebVRTextureBounds( 56 void UpdateWebVRTextureBounds(
45 int eye, float left, float top, float width, float height) override; 57 int eye, float left, float top, float width, float height) override;
46 gvr::GvrApi* gvr_api() override; 58 gvr::GvrApi* gvr_api() override;
47 59
60 void ContentSurfaceDestroyed(
61 JNIEnv* env,
62 const base::android::JavaParamRef<jobject>& object);
63 void ContentSurfaceChanged(
64 JNIEnv* env,
65 const base::android::JavaParamRef<jobject>& object,
66 jint width,
67 jint height,
68 const base::android::JavaParamRef<jobject>& surface);
69
48 private: 70 private:
49 virtual ~VrShell(); 71 virtual ~VrShell();
50 void DrawVrShell(); 72 void DrawVrShell();
51 void DrawEye(const gvr::Mat4f& view_matrix, 73 void DrawEye(const gvr::Mat4f& view_matrix,
52 const gvr::BufferViewport& params); 74 const gvr::BufferViewport& params);
53 void DrawContentRect(); 75 void DrawContentRect();
54 void DrawWebVr(); 76 void DrawWebVr();
55 void DrawUI(); 77 void DrawUI();
56 78
57 void UpdateTransforms(float screen_width_meters, 79 void UpdateTransforms(float screen_width_meters,
(...skipping 16 matching lines...) Expand all
74 std::unique_ptr<gvr::BufferViewport> buffer_viewport_; 96 std::unique_ptr<gvr::BufferViewport> buffer_viewport_;
75 std::unique_ptr<gvr::SwapChain> swap_chain_; 97 std::unique_ptr<gvr::SwapChain> swap_chain_;
76 98
77 gvr::Mat4f view_matrix_; 99 gvr::Mat4f view_matrix_;
78 gvr::Mat4f projection_matrix_; 100 gvr::Mat4f projection_matrix_;
79 101
80 gvr::Mat4f head_pose_; 102 gvr::Mat4f head_pose_;
81 103
82 gvr::Sizei render_size_; 104 gvr::Sizei render_size_;
83 105
106 std::unique_ptr<VrCompositor> content_compositor_view_;
107 content::ContentViewCore* content_cvc_;
108
84 std::unique_ptr<VrShellRenderer> vr_shell_renderer_; 109 std::unique_ptr<VrShellRenderer> vr_shell_renderer_;
85 base::android::ScopedJavaGlobalRef<jobject> j_vr_shell_; 110 base::android::ScopedJavaGlobalRef<jobject> j_vr_shell_;
86 111
87 bool webvr_mode_ = false; 112 bool webvr_mode_ = false;
88 113
89 DISALLOW_COPY_AND_ASSIGN(VrShell); 114 DISALLOW_COPY_AND_ASSIGN(VrShell);
90 }; 115 };
91 116
92 bool RegisterVrShell(JNIEnv* env); 117 bool RegisterVrShell(JNIEnv* env);
93 118
94 } // namespace vr_shell 119 } // namespace vr_shell
95 120
96 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_H_ 121 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698