| OLD | NEW |
| 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/gl_browser_interface.h" |
| 15 #include "chrome/browser/android/vr_shell/ui_browser_interface.h" |
| 14 #include "chrome/browser/android/vr_shell/ui_interface.h" | 16 #include "chrome/browser/android/vr_shell/ui_interface.h" |
| 15 #include "chrome/browser/android/vr_shell/vr_browser_interface.h" | |
| 16 #include "third_party/gvr-android-sdk/src/libraries/headers/vr/gvr/capi/include/
gvr_types.h" | 17 #include "third_party/gvr-android-sdk/src/libraries/headers/vr/gvr/capi/include/
gvr_types.h" |
| 17 | 18 |
| 18 class GURL; | 19 class GURL; |
| 19 | 20 |
| 20 namespace vr_shell { | 21 namespace vr_shell { |
| 21 | 22 |
| 22 class UiScene; | 23 class UiScene; |
| 23 class UiSceneManager; | 24 class UiSceneManager; |
| 24 class VrShell; | 25 class VrShell; |
| 25 class VrShellGl; | 26 class VrShellGl; |
| 26 | 27 |
| 27 class VrGLThread : public base::Thread, | 28 class VrGLThread : public base::Thread, |
| 28 public UiInterface, | 29 public GlBrowserInterface, |
| 29 public VrBrowserInterface { | 30 public UiBrowserInterface, |
| 31 public UiInterface { |
| 30 public: | 32 public: |
| 31 VrGLThread( | 33 VrGLThread( |
| 32 const base::WeakPtr<VrShell>& weak_vr_shell, | 34 const base::WeakPtr<VrShell>& weak_vr_shell, |
| 33 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner, | 35 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner, |
| 34 gvr_context* gvr_api, | 36 gvr_context* gvr_api, |
| 35 bool initially_web_vr, | 37 bool initially_web_vr, |
| 36 bool in_cct, | 38 bool in_cct, |
| 37 bool reprojected_rendering, | 39 bool reprojected_rendering, |
| 38 bool daydream_support); | 40 bool daydream_support); |
| 39 | 41 |
| 40 ~VrGLThread() override; | 42 ~VrGLThread() override; |
| 41 base::WeakPtr<VrShellGl> GetVrShellGl() { return weak_vr_shell_gl_; } | 43 base::WeakPtr<VrShellGl> GetVrShellGl() { return weak_vr_shell_gl_; } |
| 42 base::WeakPtr<UiSceneManager> GetSceneManager() { | 44 base::WeakPtr<UiSceneManager> GetSceneManager() { |
| 43 return weak_scene_manager_; | 45 return weak_scene_manager_; |
| 44 } | 46 } |
| 45 | 47 |
| 46 // VrBrowserInterface implementation (VrShellGl calling to UI and VrShell). | 48 // GlBrowserInterface implementation (VrShellGl calling to VrShell). |
| 47 void ContentSurfaceChanged(jobject surface) override; | 49 void ContentSurfaceChanged(jobject surface) override; |
| 48 void GvrDelegateReady() override; | 50 void GvrDelegateReady() override; |
| 49 void UpdateGamepadData(device::GvrGamepadData) override; | 51 void UpdateGamepadData(device::GvrGamepadData) override; |
| 50 void AppButtonClicked() override; | 52 void AppButtonClicked() override; |
| 51 void AppButtonGesturePerformed(UiInterface::Direction direction) override; | 53 void AppButtonGesturePerformed(UiInterface::Direction direction) override; |
| 52 void ProcessContentGesture( | 54 void ProcessContentGesture( |
| 53 std::unique_ptr<blink::WebInputEvent> event) override; | 55 std::unique_ptr<blink::WebInputEvent> event) override; |
| 54 void ForceExitVr() override; | 56 void ForceExitVr() override; |
| 55 void ExitPresent() override; | |
| 56 void ExitFullscreen() override; | |
| 57 void RunVRDisplayInfoCallback( | 57 void RunVRDisplayInfoCallback( |
| 58 const base::Callback<void(device::mojom::VRDisplayInfoPtr)>& callback, | 58 const base::Callback<void(device::mojom::VRDisplayInfoPtr)>& callback, |
| 59 device::mojom::VRDisplayInfoPtr* info) override; | 59 device::mojom::VRDisplayInfoPtr* info) override; |
| 60 void OnContentPaused(bool enabled) override; | 60 void OnContentPaused(bool enabled) override; |
| 61 void ToggleCardboardGamepad(bool enabled) override; |
| 62 |
| 63 // UiBrowserInterface implementation (UI calling to VrShell). |
| 64 void ExitPresent() override; |
| 65 void ExitFullscreen() override; |
| 61 void NavigateBack() override; | 66 void NavigateBack() override; |
| 62 void ExitCct() override; | 67 void ExitCct() override; |
| 63 void ToggleCardboardGamepad(bool enabled) override; | |
| 64 void OnUnsupportedMode(UiUnsupportedMode mode) override; | 68 void OnUnsupportedMode(UiUnsupportedMode mode) override; |
| 65 | 69 |
| 66 // UiInterface implementation (VrShell calling to the UI). | 70 // UiInterface implementation (VrShell and GL calling to the UI). |
| 67 void SetFullscreen(bool enabled) override; | 71 void SetFullscreen(bool enabled) override; |
| 68 void SetIncognito(bool incognito) override; | 72 void SetIncognito(bool incognito) override; |
| 69 void SetHistoryButtonsEnabled(bool can_go_back, bool can_go_forward) override; | 73 void SetHistoryButtonsEnabled(bool can_go_back, bool can_go_forward) override; |
| 70 void SetLoadProgress(float progress) override; | 74 void SetLoadProgress(float progress) override; |
| 71 void SetLoading(bool loading) override; | 75 void SetLoading(bool loading) override; |
| 72 void SetSecurityLevel(security_state::SecurityLevel level) override; | 76 void SetSecurityLevel(security_state::SecurityLevel level) override; |
| 73 void SetURL(const GURL& gurl) override; | 77 void SetURL(const GURL& gurl) override; |
| 74 void SetWebVrMode(bool enabled) override; | 78 void SetWebVrMode(bool enabled) override; |
| 75 void SetWebVrSecureOrigin(bool secure) override; | 79 void SetWebVrSecureOrigin(bool secure) override; |
| 76 void SetVideoCapturingIndicator(bool enabled) override; | 80 void SetVideoCapturingIndicator(bool enabled) override; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 98 bool in_cct_; | 102 bool in_cct_; |
| 99 bool reprojected_rendering_; | 103 bool reprojected_rendering_; |
| 100 bool daydream_support_; | 104 bool daydream_support_; |
| 101 | 105 |
| 102 DISALLOW_COPY_AND_ASSIGN(VrGLThread); | 106 DISALLOW_COPY_AND_ASSIGN(VrGLThread); |
| 103 }; | 107 }; |
| 104 | 108 |
| 105 } // namespace vr_shell | 109 } // namespace vr_shell |
| 106 | 110 |
| 107 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_VR_GL_THREAD_H_ | 111 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_VR_GL_THREAD_H_ |
| OLD | NEW |