| 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_UI_SCENE_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_ANDROID_VR_SHELL_UI_SCENE_MANAGER_H_ |
| 6 #define CHROME_BROWSER_ANDROID_VR_SHELL_UI_SCENE_MANAGER_H_ | 6 #define CHROME_BROWSER_ANDROID_VR_SHELL_UI_SCENE_MANAGER_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
| 10 #include "base/timer/timer.h" | 10 #include "base/timer/timer.h" |
| 11 #include "base/values.h" | 11 #include "base/values.h" |
| 12 #include "chrome/browser/android/vr_shell/ui_interface.h" | 12 #include "chrome/browser/android/vr_shell/ui_interface.h" |
| 13 #include "device/vr/vr_types.h" | 13 #include "device/vr/vr_types.h" |
| 14 | 14 |
| 15 class GURL; | 15 class GURL; |
| 16 | 16 |
| 17 namespace vr_shell { | 17 namespace vr_shell { |
| 18 | 18 |
| 19 class LoadingIndicator; | 19 class LoadingIndicator; |
| 20 class UiElement; | 20 class UiElement; |
| 21 class UiScene; | 21 class UiScene; |
| 22 class UrlBar; | 22 class UrlBar; |
| 23 class VrBrowserInterface; | 23 class VrBrowserInterface; |
| 24 | 24 |
| 25 struct ColorScheme; |
| 26 |
| 25 class UiSceneManager { | 27 class UiSceneManager { |
| 26 public: | 28 public: |
| 27 UiSceneManager(VrBrowserInterface* browser, | 29 UiSceneManager(VrBrowserInterface* browser, |
| 28 UiScene* scene, | 30 UiScene* scene, |
| 29 bool in_cct, | 31 bool in_cct, |
| 30 bool in_web_vr); | 32 bool in_web_vr); |
| 31 ~UiSceneManager(); | 33 ~UiSceneManager(); |
| 32 | 34 |
| 33 base::WeakPtr<UiSceneManager> GetWeakPtr(); | 35 base::WeakPtr<UiSceneManager> GetWeakPtr(); |
| 34 | 36 |
| 35 void SetFullscreen(bool fullscreen); | 37 void SetFullscreen(bool fullscreen); |
| 38 void SetIncognito(bool incognito); |
| 36 void SetURL(const GURL& gurl); | 39 void SetURL(const GURL& gurl); |
| 37 void SetWebVrSecureOrigin(bool secure); | 40 void SetWebVrSecureOrigin(bool secure); |
| 38 void SetWebVrMode(bool web_vr); | 41 void SetWebVrMode(bool web_vr); |
| 39 void SetSecurityLevel(int level); | 42 void SetSecurityLevel(int level); |
| 40 void SetLoading(bool loading); | 43 void SetLoading(bool loading); |
| 41 void SetLoadProgress(float progress); | 44 void SetLoadProgress(float progress); |
| 42 void SetIsExiting(); | 45 void SetIsExiting(); |
| 43 // These methods are currently stubbed. | |
| 44 void SetHistoryButtonsEnabled(bool can_go_back, bool can_go_forward); | |
| 45 void SetVideoCapturingIndicator(bool enabled); | 46 void SetVideoCapturingIndicator(bool enabled); |
| 46 void SetScreenCapturingIndicator(bool enabled); | 47 void SetScreenCapturingIndicator(bool enabled); |
| 47 void SetAudioCapturingIndicator(bool enabled); | 48 void SetAudioCapturingIndicator(bool enabled); |
| 48 | 49 |
| 50 // These methods are currently stubbed. |
| 51 void SetHistoryButtonsEnabled(bool can_go_back, bool can_go_forward); |
| 52 |
| 49 void OnAppButtonClicked(); | 53 void OnAppButtonClicked(); |
| 50 void OnAppButtonGesturePerformed(UiInterface::Direction direction); | 54 void OnAppButtonGesturePerformed(UiInterface::Direction direction); |
| 51 | 55 |
| 52 private: | 56 private: |
| 53 void CreateScreenDimmer(); | 57 void CreateScreenDimmer(); |
| 54 void CreateSecurityWarnings(); | 58 void CreateSecurityWarnings(); |
| 55 void CreateSystemIndicators(); | 59 void CreateSystemIndicators(); |
| 56 void CreateContentQuad(); | 60 void CreateContentQuad(); |
| 57 void CreateBackground(); | 61 void CreateBackground(); |
| 58 void CreateUrlBar(); | 62 void CreateUrlBar(); |
| 59 void CreateCloseButton(); | 63 void CreateCloseButton(); |
| 60 void CreateExitWarning(); | 64 void CreateExitWarning(); |
| 61 | 65 |
| 62 void ConfigureScene(); | 66 void ConfigureScene(); |
| 63 void ConfigureBackgroundColor(vr::Colorf center_color, | |
| 64 vr::Colorf horizon_color); | |
| 65 void ConfigureSecurityWarnings(); | 67 void ConfigureSecurityWarnings(); |
| 68 void UpdateBackgroundColor(); |
| 66 void OnSecurityWarningTimer(); | 69 void OnSecurityWarningTimer(); |
| 67 void OnBackButtonClicked(); | 70 void OnBackButtonClicked(); |
| 68 void OnCloseButtonClicked(); | 71 void OnCloseButtonClicked(); |
| 69 int AllocateId(); | 72 int AllocateId(); |
| 73 const ColorScheme& color_scheme() const; |
| 70 | 74 |
| 71 VrBrowserInterface* browser_; | 75 VrBrowserInterface* browser_; |
| 72 UiScene* scene_; | 76 UiScene* scene_; |
| 73 | 77 |
| 74 // UI element pointers (not owned by the scene manager). | 78 // UI element pointers (not owned by the scene manager). |
| 75 UiElement* permanent_security_warning_ = nullptr; | 79 UiElement* permanent_security_warning_ = nullptr; |
| 76 UiElement* transient_security_warning_ = nullptr; | 80 UiElement* transient_security_warning_ = nullptr; |
| 77 UiElement* exit_warning_ = nullptr; | 81 UiElement* exit_warning_ = nullptr; |
| 78 UiElement* main_content_ = nullptr; | 82 UiElement* main_content_ = nullptr; |
| 79 UiElement* audio_capture_indicator_ = nullptr; | 83 UiElement* audio_capture_indicator_ = nullptr; |
| 80 UiElement* video_capture_indicator_ = nullptr; | 84 UiElement* video_capture_indicator_ = nullptr; |
| 81 UiElement* screen_capture_indicator_ = nullptr; | 85 UiElement* screen_capture_indicator_ = nullptr; |
| 82 UiElement* screen_dimmer_ = nullptr; | 86 UiElement* screen_dimmer_ = nullptr; |
| 83 UiElement* ceiling_ = nullptr; | 87 UiElement* ceiling_ = nullptr; |
| 84 UiElement* floor_ = nullptr; | 88 UiElement* floor_ = nullptr; |
| 85 UiElement* floor_grid_ = nullptr; | 89 UiElement* floor_grid_ = nullptr; |
| 86 UrlBar* url_bar_ = nullptr; | 90 UrlBar* url_bar_ = nullptr; |
| 87 LoadingIndicator* loading_indicator_ = nullptr; | 91 LoadingIndicator* loading_indicator_ = nullptr; |
| 88 | 92 |
| 89 bool in_cct_; | 93 bool in_cct_; |
| 90 bool web_vr_mode_; | 94 bool web_vr_mode_; |
| 91 bool secure_origin_ = false; | 95 bool secure_origin_ = false; |
| 92 bool fullscreen_ = false; | 96 bool fullscreen_ = false; |
| 97 bool incognito_ = false; |
| 93 bool is_exiting_ = false; | 98 bool is_exiting_ = false; |
| 94 | 99 |
| 95 int next_available_id_ = 1; | 100 int next_available_id_ = 1; |
| 96 | 101 |
| 97 std::vector<UiElement*> content_elements_; | 102 std::vector<UiElement*> content_elements_; |
| 98 std::vector<UiElement*> control_elements_; | 103 std::vector<UiElement*> control_elements_; |
| 99 | 104 |
| 100 base::OneShotTimer security_warning_timer_; | 105 base::OneShotTimer security_warning_timer_; |
| 101 | 106 |
| 102 base::WeakPtrFactory<UiSceneManager> weak_ptr_factory_; | 107 base::WeakPtrFactory<UiSceneManager> weak_ptr_factory_; |
| 103 | 108 |
| 104 DISALLOW_COPY_AND_ASSIGN(UiSceneManager); | 109 DISALLOW_COPY_AND_ASSIGN(UiSceneManager); |
| 105 }; | 110 }; |
| 106 | 111 |
| 107 } // namespace vr_shell | 112 } // namespace vr_shell |
| 108 | 113 |
| 109 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_UI_SCENE_MANAGER_H_ | 114 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_UI_SCENE_MANAGER_H_ |
| OLD | NEW |