| 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/gtest_prod_util.h" | 8 #include "base/gtest_prod_util.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
| 11 #include "base/timer/timer.h" | |
| 12 #include "base/values.h" | 11 #include "base/values.h" |
| 13 #include "chrome/browser/android/vr_shell/color_scheme.h" | 12 #include "chrome/browser/android/vr_shell/color_scheme.h" |
| 14 #include "chrome/browser/android/vr_shell/ui_elements/simple_textured_element.h" | 13 #include "chrome/browser/android/vr_shell/ui_elements/simple_textured_element.h" |
| 15 #include "chrome/browser/android/vr_shell/ui_interface.h" | 14 #include "chrome/browser/android/vr_shell/ui_interface.h" |
| 16 #include "chrome/browser/android/vr_shell/ui_unsupported_mode.h" | 15 #include "chrome/browser/android/vr_shell/ui_unsupported_mode.h" |
| 17 #include "third_party/skia/include/core/SkBitmap.h" | 16 #include "third_party/skia/include/core/SkBitmap.h" |
| 18 | 17 |
| 19 namespace vr_shell { | 18 namespace vr_shell { |
| 20 | 19 |
| 20 class ExclusiveScreenToast; |
| 21 class LoadingIndicator; | 21 class LoadingIndicator; |
| 22 class TransientUrlBar; | 22 class TransientUrlBar; |
| 23 class UiBrowserInterface; | 23 class UiBrowserInterface; |
| 24 class UiElement; | 24 class UiElement; |
| 25 class UiScene; | 25 class UiScene; |
| 26 class UrlBar; | 26 class UrlBar; |
| 27 | 27 |
| 28 class UiSceneManager { | 28 class UiSceneManager { |
| 29 public: | 29 public: |
| 30 UiSceneManager(UiBrowserInterface* browser, | 30 UiSceneManager(UiBrowserInterface* browser, |
| (...skipping 24 matching lines...) Expand all Loading... |
| 55 void SetHistoryButtonsEnabled(bool can_go_back, bool can_go_forward); | 55 void SetHistoryButtonsEnabled(bool can_go_back, bool can_go_forward); |
| 56 | 56 |
| 57 void OnGLInitialized(); | 57 void OnGLInitialized(); |
| 58 void OnAppButtonClicked(); | 58 void OnAppButtonClicked(); |
| 59 void OnAppButtonGesturePerformed(UiInterface::Direction direction); | 59 void OnAppButtonGesturePerformed(UiInterface::Direction direction); |
| 60 | 60 |
| 61 void OnSecurityIconClickedForTesting(); | 61 void OnSecurityIconClickedForTesting(); |
| 62 void OnExitPromptPrimaryButtonClickedForTesting(); | 62 void OnExitPromptPrimaryButtonClickedForTesting(); |
| 63 | 63 |
| 64 private: | 64 private: |
| 65 enum ToastState { | |
| 66 UNCHANGED = 0, | |
| 67 SET_FOR_WEB_VR, | |
| 68 SET_FOR_FULLSCREEN, | |
| 69 }; | |
| 70 void CreateScreenDimmer(); | 65 void CreateScreenDimmer(); |
| 71 void CreateSecurityWarnings(); | 66 void CreateSecurityWarnings(); |
| 72 void CreateSystemIndicators(); | 67 void CreateSystemIndicators(); |
| 73 void CreateContentQuad(); | 68 void CreateContentQuad(); |
| 74 void CreateSplashScreen(); | 69 void CreateSplashScreen(); |
| 75 void CreateBackground(); | 70 void CreateBackground(); |
| 76 void CreateUrlBar(); | 71 void CreateUrlBar(); |
| 77 void CreateTransientUrlBar(); | 72 void CreateTransientUrlBar(); |
| 78 void CreateCloseButton(); | 73 void CreateCloseButton(); |
| 79 void CreateExitPrompt(); | 74 void CreateExitPrompt(); |
| 80 void CreateToasts(); | 75 void CreateToasts(); |
| 81 | 76 |
| 82 void ConfigureScene(); | 77 void ConfigureScene(); |
| 83 void ConfigureSecurityWarnings(); | 78 void ConfigureSecurityWarnings(); |
| 84 void ConfigureTransientUrlBar(); | 79 void ConfigureExclusiveScreenToast(); |
| 85 void ConfigureIndicators(); | 80 void ConfigureIndicators(); |
| 86 void ConfigureExclusiveScreenToast(); | |
| 87 void UpdateBackgroundColor(); | 81 void UpdateBackgroundColor(); |
| 88 void CloseExitPrompt(); | 82 void CloseExitPrompt(); |
| 89 void OnSecurityWarningTimer(); | |
| 90 void OnTransientUrlBarTimer(); | |
| 91 void OnExclusiveScreenToastTimer(); | |
| 92 void OnBackButtonClicked(); | 83 void OnBackButtonClicked(); |
| 93 void OnSecurityIconClicked(); | 84 void OnSecurityIconClicked(); |
| 94 void OnExitPromptPrimaryButtonClicked(); | 85 void OnExitPromptPrimaryButtonClicked(); |
| 95 void OnExitPromptSecondaryButtonClicked(); | 86 void OnExitPromptSecondaryButtonClicked(); |
| 96 void OnExitPromptBackplaneClicked(); | 87 void OnExitPromptBackplaneClicked(); |
| 97 void OnCloseButtonClicked(); | 88 void OnCloseButtonClicked(); |
| 98 void OnUnsupportedMode(UiUnsupportedMode mode); | 89 void OnUnsupportedMode(UiUnsupportedMode mode); |
| 99 int AllocateId(); | 90 int AllocateId(); |
| 100 ColorScheme::Mode mode() const; | 91 ColorScheme::Mode mode() const; |
| 101 const ColorScheme& color_scheme() const; | 92 const ColorScheme& color_scheme() const; |
| 102 | 93 |
| 103 UiBrowserInterface* browser_; | 94 UiBrowserInterface* browser_; |
| 104 UiScene* scene_; | 95 UiScene* scene_; |
| 105 | 96 |
| 106 // UI element pointers (not owned by the scene manager). | 97 // UI element pointers (not owned by the scene manager). |
| 107 UiElement* permanent_security_warning_ = nullptr; | 98 UiElement* permanent_security_warning_ = nullptr; |
| 108 UiElement* transient_security_warning_ = nullptr; | 99 TransientSecurityWarning* transient_security_warning_ = nullptr; |
| 109 UiElement* exclusive_screen_toast_ = nullptr; | 100 ExclusiveScreenToast* exclusive_screen_toast_ = nullptr; |
| 110 UiElement* exit_prompt_ = nullptr; | 101 UiElement* exit_prompt_ = nullptr; |
| 111 UiElement* exit_prompt_backplane_ = nullptr; | 102 UiElement* exit_prompt_backplane_ = nullptr; |
| 112 UiElement* exit_warning_ = nullptr; | 103 UiElement* exit_warning_ = nullptr; |
| 113 UiElement* main_content_ = nullptr; | 104 UiElement* main_content_ = nullptr; |
| 114 UiElement* audio_capture_indicator_ = nullptr; | 105 UiElement* audio_capture_indicator_ = nullptr; |
| 115 UiElement* bluetooth_connected_indicator_ = nullptr; | 106 UiElement* bluetooth_connected_indicator_ = nullptr; |
| 116 UiElement* video_capture_indicator_ = nullptr; | 107 UiElement* video_capture_indicator_ = nullptr; |
| 117 UiElement* screen_capture_indicator_ = nullptr; | 108 UiElement* screen_capture_indicator_ = nullptr; |
| 118 UiElement* location_access_indicator_ = nullptr; | 109 UiElement* location_access_indicator_ = nullptr; |
| 119 UiElement* screen_dimmer_ = nullptr; | 110 UiElement* screen_dimmer_ = nullptr; |
| 120 UiElement* ceiling_ = nullptr; | 111 UiElement* ceiling_ = nullptr; |
| 121 UiElement* floor_ = nullptr; | 112 UiElement* floor_ = nullptr; |
| 122 UiElement* close_button_ = nullptr; | 113 UiElement* close_button_ = nullptr; |
| 123 SplashScreenIcon* splash_screen_icon_ = nullptr; | 114 SplashScreenIcon* splash_screen_icon_ = nullptr; |
| 124 UrlBar* url_bar_ = nullptr; | 115 UrlBar* url_bar_ = nullptr; |
| 125 TransientUrlBar* transient_url_bar_ = nullptr; | 116 TransientUrlBar* transient_url_bar_ = nullptr; |
| 126 LoadingIndicator* loading_indicator_ = nullptr; | 117 LoadingIndicator* loading_indicator_ = nullptr; |
| 127 | 118 |
| 128 std::vector<UiElement*> system_indicators_; | 119 std::vector<UiElement*> system_indicators_; |
| 129 | 120 |
| 130 bool in_cct_; | 121 bool in_cct_; |
| 131 bool web_vr_mode_; | 122 bool web_vr_mode_; |
| 132 bool web_vr_show_toast_ = false; | 123 bool web_vr_show_toast_ = false; |
| 124 bool web_vr_autopresentation_ = false; |
| 133 bool web_vr_autopresentation_expected_ = false; | 125 bool web_vr_autopresentation_expected_ = false; |
| 134 bool secure_origin_ = false; | 126 bool secure_origin_ = false; |
| 135 bool fullscreen_ = false; | 127 bool fullscreen_ = false; |
| 136 bool incognito_ = false; | 128 bool incognito_ = false; |
| 137 bool audio_capturing_ = false; | 129 bool audio_capturing_ = false; |
| 138 bool video_capturing_ = false; | 130 bool video_capturing_ = false; |
| 139 bool screen_capturing_ = false; | 131 bool screen_capturing_ = false; |
| 140 bool location_access_ = false; | 132 bool location_access_ = false; |
| 141 bool bluetooth_connected_ = false; | 133 bool bluetooth_connected_ = false; |
| 142 ToastState toast_state_ = UNCHANGED; | |
| 143 | 134 |
| 144 int next_available_id_ = 1; | 135 int next_available_id_ = 1; |
| 145 | 136 |
| 146 std::vector<UiElement*> content_elements_; | 137 std::vector<UiElement*> content_elements_; |
| 147 std::vector<UiElement*> background_elements_; | 138 std::vector<UiElement*> background_elements_; |
| 148 std::vector<UiElement*> control_elements_; | 139 std::vector<UiElement*> control_elements_; |
| 149 | 140 |
| 150 base::OneShotTimer security_warning_timer_; | |
| 151 base::OneShotTimer transient_url_bar_timer_; | |
| 152 base::OneShotTimer exclusive_screen_toast_timer_; | |
| 153 | |
| 154 base::WeakPtrFactory<UiSceneManager> weak_ptr_factory_; | 141 base::WeakPtrFactory<UiSceneManager> weak_ptr_factory_; |
| 155 | 142 |
| 156 DISALLOW_COPY_AND_ASSIGN(UiSceneManager); | 143 DISALLOW_COPY_AND_ASSIGN(UiSceneManager); |
| 157 }; | 144 }; |
| 158 | 145 |
| 159 } // namespace vr_shell | 146 } // namespace vr_shell |
| 160 | 147 |
| 161 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_UI_SCENE_MANAGER_H_ | 148 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_UI_SCENE_MANAGER_H_ |
| OLD | NEW |