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

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

Issue 2866853002: VR: Wire VrShell UI-related state to the scene manager. (Closed)
Patch Set: Created 3 years, 7 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_GL_THREAD_H_ 5 #ifndef CHROME_BROWSER_ANDROID_VR_SHELL_VR_GL_THREAD_H_
6 #define CHROME_BROWSER_ANDROID_VR_SHELL_VR_GL_THREAD_H_ 6 #define CHROME_BROWSER_ANDROID_VR_SHELL_VR_GL_THREAD_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "base/memory/weak_ptr.h" 11 #include "base/memory/weak_ptr.h"
12 #include "base/single_thread_task_runner.h" 12 #include "base/single_thread_task_runner.h"
13 #include "base/threading/thread.h" 13 #include "base/threading/thread.h"
14 #include "chrome/browser/android/vr_shell/vr_browser_interface.h" 14 #include "chrome/browser/android/vr_shell/vr_browser_interface.h"
15 #include "third_party/gvr-android-sdk/src/libraries/headers/vr/gvr/capi/include/ gvr_types.h" 15 #include "third_party/gvr-android-sdk/src/libraries/headers/vr/gvr/capi/include/ gvr_types.h"
16 16
17 class GURL;
18
17 namespace vr_shell { 19 namespace vr_shell {
18 20
19 class UiScene; 21 class UiScene;
20 class UiSceneManager; 22 class UiSceneManager;
21 class VrShell; 23 class VrShell;
22 class VrShellGl; 24 class VrShellGl;
23 25
24 class VrGLThread : public VrBrowserInterface, public base::Thread { 26 class VrGLThread : public VrBrowserInterface,
mthiesse 2017/05/08 16:04:55 Sidenote, we should think about renaming this clas
cjgrant 2017/05/08 19:17:22 I think the name is still right, but all the cross
27 public base::Thread,
mthiesse 2017/05/08 16:04:55 Is there some style-guide approved way to order th
cjgrant 2017/05/08 19:17:22 I don't think there's a style guide. But, having
28 public UiInterface {
25 public: 29 public:
26 VrGLThread( 30 VrGLThread(
27 const base::WeakPtr<VrShell>& weak_vr_shell, 31 const base::WeakPtr<VrShell>& weak_vr_shell,
28 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner, 32 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner,
29 gvr_context* gvr_api, 33 gvr_context* gvr_api,
30 bool initially_web_vr, 34 bool initially_web_vr,
31 bool reprojected_rendering); 35 bool reprojected_rendering);
32 36
33 ~VrGLThread() override; 37 ~VrGLThread() override;
34 base::WeakPtr<VrShellGl> GetVrShellGl() { return weak_vr_shell_gl_; } 38 base::WeakPtr<VrShellGl> GetVrShellGl() { return weak_vr_shell_gl_; }
35 base::WeakPtr<UiSceneManager> GetSceneManager() { 39 base::WeakPtr<UiSceneManager> GetSceneManager() {
36 return weak_scene_manager_; 40 return weak_scene_manager_;
37 } 41 }
38 42
39 // VrBrowserInterface implementation. 43 // VrBrowserInterface implementation (VrShellGl calling to UI and VrShell).
40 void ContentSurfaceChanged(jobject surface) override; 44 void ContentSurfaceChanged(jobject surface) override;
41 void GvrDelegateReady() override; 45 void GvrDelegateReady() override;
42 void UpdateGamepadData(device::GvrGamepadData) override; 46 void UpdateGamepadData(device::GvrGamepadData) override;
47 void AppButtonClicked() override;
43 void AppButtonGesturePerformed(UiInterface::Direction direction) override; 48 void AppButtonGesturePerformed(UiInterface::Direction direction) override;
44 void OnAppButtonClicked() override;
45 void ProcessContentGesture( 49 void ProcessContentGesture(
46 std::unique_ptr<blink::WebInputEvent> event) override; 50 std::unique_ptr<blink::WebInputEvent> event) override;
47 void ForceExitVr() override; 51 void ForceExitVr() override;
48 void RunVRDisplayInfoCallback( 52 void RunVRDisplayInfoCallback(
49 const base::Callback<void(device::mojom::VRDisplayInfoPtr)>& callback, 53 const base::Callback<void(device::mojom::VRDisplayInfoPtr)>& callback,
50 device::mojom::VRDisplayInfoPtr* info) override; 54 device::mojom::VRDisplayInfoPtr* info) override;
51 void OnContentPaused(bool enabled) override; 55 void OnContentPaused(bool enabled) override;
52 56
57 // UiInterface implementation (VrShell calling to the UI).
58 void SetWebVr(bool enabled) override;
59 void SetURL(const GURL& gurl) override;
60 void SetFullscreen(bool enabled) override;
61 void SetSecurityLevel(int level) override;
62 void SetWebVRSecureOrigin(bool secure) override;
63 void SetLoading(bool loading) override;
64 void SetLoadProgress(double progress) override;
65 void SetHistoryButtonsEnabled(bool can_go_back, bool can_go_forward) override;
66
53 protected: 67 protected:
54 void Init() override; 68 void Init() override;
55 void CleanUp() override; 69 void CleanUp() override;
56 70
57 private: 71 private:
58 // Created on GL thread. 72 // Created on GL thread.
59 std::unique_ptr<UiScene> scene_; 73 std::unique_ptr<UiScene> scene_;
60 std::unique_ptr<UiSceneManager> scene_manager_; 74 std::unique_ptr<UiSceneManager> scene_manager_;
61 base::WeakPtr<UiSceneManager> weak_scene_manager_; 75 base::WeakPtr<UiSceneManager> weak_scene_manager_;
62 std::unique_ptr<VrShellGl> vr_shell_gl_; 76 std::unique_ptr<VrShellGl> vr_shell_gl_;
63 base::WeakPtr<VrShellGl> weak_vr_shell_gl_; 77 base::WeakPtr<VrShellGl> weak_vr_shell_gl_;
64 78
65 // This state is used for initializing vr_shell_gl_. 79 // This state is used for initializing vr_shell_gl_.
66 base::WeakPtr<VrShell> weak_vr_shell_; 80 base::WeakPtr<VrShell> weak_vr_shell_;
67 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_; 81 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_;
68 gvr_context* gvr_api_; 82 gvr_context* gvr_api_;
69 bool initially_web_vr_; 83 bool initially_web_vr_;
70 bool reprojected_rendering_; 84 bool reprojected_rendering_;
71 85
72 DISALLOW_COPY_AND_ASSIGN(VrGLThread); 86 DISALLOW_COPY_AND_ASSIGN(VrGLThread);
73 }; 87 };
74 88
75 } // namespace vr_shell 89 } // namespace vr_shell
76 90
77 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_VR_GL_THREAD_H_ 91 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_VR_GL_THREAD_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698