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