| 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 | 13 |
| 14 class GURL; | 14 class GURL; |
| 15 | 15 |
| 16 namespace vr_shell { | 16 namespace vr_shell { |
| 17 | 17 |
| 18 class LoadingIndicator; |
| 18 class UiElement; | 19 class UiElement; |
| 19 class UiScene; | 20 class UiScene; |
| 20 class UrlBar; | 21 class UrlBar; |
| 21 class VrBrowserInterface; | 22 class VrBrowserInterface; |
| 22 | 23 |
| 23 class UiSceneManager { | 24 class UiSceneManager { |
| 24 public: | 25 public: |
| 25 UiSceneManager(VrBrowserInterface* browser, | 26 UiSceneManager(VrBrowserInterface* browser, |
| 26 UiScene* scene, | 27 UiScene* scene, |
| 27 bool in_cct, | 28 bool in_cct, |
| 28 bool in_web_vr); | 29 bool in_web_vr); |
| 29 ~UiSceneManager(); | 30 ~UiSceneManager(); |
| 30 | 31 |
| 31 base::WeakPtr<UiSceneManager> GetWeakPtr(); | 32 base::WeakPtr<UiSceneManager> GetWeakPtr(); |
| 32 | 33 |
| 33 void SetFullscreen(bool fullscreen); | 34 void SetFullscreen(bool fullscreen); |
| 34 void SetURL(const GURL& gurl); | 35 void SetURL(const GURL& gurl); |
| 35 void SetWebVrSecureOrigin(bool secure); | 36 void SetWebVrSecureOrigin(bool secure); |
| 36 void SetWebVrMode(bool web_vr); | 37 void SetWebVrMode(bool web_vr); |
| 37 // These methods are currently stubbed. | 38 // These methods are currently stubbed. |
| 38 void SetSecurityLevel(int level); | 39 void SetSecurityLevel(int level); |
| 39 void SetLoading(bool loading); | 40 void SetLoading(bool loading); |
| 40 void SetLoadProgress(double progress); | 41 void SetLoadProgress(float progress); |
| 41 void SetHistoryButtonsEnabled(bool can_go_back, bool can_go_forward); | 42 void SetHistoryButtonsEnabled(bool can_go_back, bool can_go_forward); |
| 42 | 43 |
| 43 void OnAppButtonClicked(); | 44 void OnAppButtonClicked(); |
| 44 void OnAppButtonGesturePerformed(UiInterface::Direction direction); | 45 void OnAppButtonGesturePerformed(UiInterface::Direction direction); |
| 45 | 46 |
| 46 private: | 47 private: |
| 47 void CreateSecurityWarnings(); | 48 void CreateSecurityWarnings(); |
| 48 void CreateContentQuad(); | 49 void CreateContentQuad(); |
| 49 void CreateBackground(); | 50 void CreateBackground(); |
| 50 void CreateUrlBar(); | 51 void CreateUrlBar(); |
| 51 void CreateCloseButton(); | 52 void CreateCloseButton(); |
| 52 | 53 |
| 54 void ConfigureScene(); |
| 53 void ConfigureSecurityWarnings(); | 55 void ConfigureSecurityWarnings(); |
| 54 void OnSecurityWarningTimer(); | 56 void OnSecurityWarningTimer(); |
| 55 void OnBackButtonClicked(); | 57 void OnBackButtonClicked(); |
| 56 void OnCloseButtonClicked(); | 58 void OnCloseButtonClicked(); |
| 57 int AllocateId(); | 59 int AllocateId(); |
| 58 | 60 |
| 59 VrBrowserInterface* browser_; | 61 VrBrowserInterface* browser_; |
| 60 UiScene* scene_; | 62 UiScene* scene_; |
| 61 | 63 |
| 62 // UI element pointers (not owned by the scene manager). | 64 // UI element pointers (not owned by the scene manager). |
| 63 UiElement* permanent_security_warning_ = nullptr; | 65 UiElement* permanent_security_warning_ = nullptr; |
| 64 UiElement* transient_security_warning_ = nullptr; | 66 UiElement* transient_security_warning_ = nullptr; |
| 65 UiElement* main_content_ = nullptr; | 67 UiElement* main_content_ = nullptr; |
| 66 UrlBar* url_bar_ = nullptr; | 68 UrlBar* url_bar_ = nullptr; |
| 69 LoadingIndicator* loading_indicator_ = nullptr; |
| 67 | 70 |
| 68 bool in_cct_; | 71 bool in_cct_; |
| 69 bool web_vr_mode_; | 72 bool web_vr_mode_; |
| 70 bool secure_origin_ = false; | 73 bool secure_origin_ = false; |
| 74 bool fullscreen_ = false; |
| 71 | 75 |
| 72 int next_available_id_ = 1; | 76 int next_available_id_ = 1; |
| 73 | 77 |
| 74 std::vector<UiElement*> browser_ui_elements_; | 78 std::vector<UiElement*> content_elements_; |
| 79 std::vector<UiElement*> control_elements_; |
| 75 | 80 |
| 76 base::OneShotTimer security_warning_timer_; | 81 base::OneShotTimer security_warning_timer_; |
| 77 | 82 |
| 78 base::WeakPtrFactory<UiSceneManager> weak_ptr_factory_; | 83 base::WeakPtrFactory<UiSceneManager> weak_ptr_factory_; |
| 79 | 84 |
| 80 DISALLOW_COPY_AND_ASSIGN(UiSceneManager); | 85 DISALLOW_COPY_AND_ASSIGN(UiSceneManager); |
| 81 }; | 86 }; |
| 82 | 87 |
| 83 } // namespace vr_shell | 88 } // namespace vr_shell |
| 84 | 89 |
| 85 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_UI_SCENE_MANAGER_H_ | 90 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_UI_SCENE_MANAGER_H_ |
| OLD | NEW |