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

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: Rebase; remove now-unused source file. 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 base::Thread,
27 public UiInterface,
28 public VrBrowserInterface {
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 in_cct, 35 bool in_cct,
32 bool reprojected_rendering); 36 bool reprojected_rendering);
33 37
34 ~VrGLThread() override; 38 ~VrGLThread() override;
35 base::WeakPtr<VrShellGl> GetVrShellGl() { return weak_vr_shell_gl_; } 39 base::WeakPtr<VrShellGl> GetVrShellGl() { return weak_vr_shell_gl_; }
36 base::WeakPtr<UiSceneManager> GetSceneManager() { 40 base::WeakPtr<UiSceneManager> GetSceneManager() {
37 return weak_scene_manager_; 41 return weak_scene_manager_;
38 } 42 }
39 43
40 // VrBrowserInterface implementation. 44 // VrBrowserInterface implementation (VrShellGl calling to UI and VrShell).
41 void ContentSurfaceChanged(jobject surface) override; 45 void ContentSurfaceChanged(jobject surface) override;
42 void GvrDelegateReady() override; 46 void GvrDelegateReady() override;
43 void UpdateGamepadData(device::GvrGamepadData) override; 47 void UpdateGamepadData(device::GvrGamepadData) override;
48 void AppButtonClicked() override;
44 void AppButtonGesturePerformed(UiInterface::Direction direction) override; 49 void AppButtonGesturePerformed(UiInterface::Direction direction) override;
45 void OnAppButtonClicked() override;
46 void ProcessContentGesture( 50 void ProcessContentGesture(
47 std::unique_ptr<blink::WebInputEvent> event) override; 51 std::unique_ptr<blink::WebInputEvent> event) override;
48 void ForceExitVr() override; 52 void ForceExitVr() override;
49 void RunVRDisplayInfoCallback( 53 void RunVRDisplayInfoCallback(
50 const base::Callback<void(device::mojom::VRDisplayInfoPtr)>& callback, 54 const base::Callback<void(device::mojom::VRDisplayInfoPtr)>& callback,
51 device::mojom::VRDisplayInfoPtr* info) override; 55 device::mojom::VRDisplayInfoPtr* info) override;
52 void OnContentPaused(bool enabled) override; 56 void OnContentPaused(bool enabled) override;
53 57
58 // UiInterface implementation (VrShell calling to the UI).
59 void SetFullscreen(bool enabled) override;
60 void SetHistoryButtonsEnabled(bool can_go_back, bool can_go_forward) override;
61 void SetLoadProgress(double progress) override;
62 void SetLoading(bool loading) override;
63 void SetSecurityLevel(int level) override;
64 void SetURL(const GURL& gurl) override;
65 void SetWebVrMode(bool enabled) override;
66 void SetWebVrSecureOrigin(bool secure) override;
67
54 protected: 68 protected:
55 void Init() override; 69 void Init() override;
56 void CleanUp() override; 70 void CleanUp() override;
57 71
58 private: 72 private:
59 // Created on GL thread. 73 // Created on GL thread.
60 std::unique_ptr<UiScene> scene_; 74 std::unique_ptr<UiScene> scene_;
61 std::unique_ptr<UiSceneManager> scene_manager_; 75 std::unique_ptr<UiSceneManager> scene_manager_;
62 base::WeakPtr<UiSceneManager> weak_scene_manager_; 76 base::WeakPtr<UiSceneManager> weak_scene_manager_;
63 std::unique_ptr<VrShellGl> vr_shell_gl_; 77 std::unique_ptr<VrShellGl> vr_shell_gl_;
64 base::WeakPtr<VrShellGl> weak_vr_shell_gl_; 78 base::WeakPtr<VrShellGl> weak_vr_shell_gl_;
65 79
66 // This state is used for initializing vr_shell_gl_. 80 // This state is used for initializing vr_shell_gl_.
67 base::WeakPtr<VrShell> weak_vr_shell_; 81 base::WeakPtr<VrShell> weak_vr_shell_;
68 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_; 82 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_;
69 gvr_context* gvr_api_; 83 gvr_context* gvr_api_;
70 bool initially_web_vr_; 84 bool initially_web_vr_;
71 bool in_cct_; 85 bool in_cct_;
72 bool reprojected_rendering_; 86 bool reprojected_rendering_;
73 87
74 DISALLOW_COPY_AND_ASSIGN(VrGLThread); 88 DISALLOW_COPY_AND_ASSIGN(VrGLThread);
75 }; 89 };
76 90
77 } // namespace vr_shell 91 } // namespace vr_shell
78 92
79 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_VR_GL_THREAD_H_ 93 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_VR_GL_THREAD_H_
OLDNEW
« no previous file with comments | « chrome/browser/android/vr_shell/vr_browser_interface.h ('k') | chrome/browser/android/vr_shell/vr_gl_thread.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698