| 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 | 52 |
| 53 void ConfigureScene(); |
| 52 void ConfigureSecurityWarnings(); | 54 void ConfigureSecurityWarnings(); |
| 53 void OnSecurityWarningTimer(); | 55 void OnSecurityWarningTimer(); |
| 54 void OnBackButtonClicked(); | 56 void OnBackButtonClicked(); |
| 55 int AllocateId(); | 57 int AllocateId(); |
| 56 | 58 |
| 57 VrBrowserInterface* browser_; | 59 VrBrowserInterface* browser_; |
| 58 UiScene* scene_; | 60 UiScene* scene_; |
| 59 | 61 |
| 60 // UI element pointers (not owned by the scene manager). | 62 // UI element pointers (not owned by the scene manager). |
| 61 UiElement* permanent_security_warning_ = nullptr; | 63 UiElement* permanent_security_warning_ = nullptr; |
| 62 UiElement* transient_security_warning_ = nullptr; | 64 UiElement* transient_security_warning_ = nullptr; |
| 63 UiElement* main_content_ = nullptr; | 65 UiElement* main_content_ = nullptr; |
| 64 UrlBar* url_bar_ = nullptr; | 66 UrlBar* url_bar_ = nullptr; |
| 67 LoadingIndicator* loading_indicator_ = nullptr; |
| 65 | 68 |
| 66 bool in_cct_; | 69 bool in_cct_; |
| 67 bool web_vr_mode_; | 70 bool web_vr_mode_; |
| 68 bool secure_origin_ = false; | 71 bool secure_origin_ = false; |
| 69 bool content_rendering_enabled_ = true; | 72 bool content_rendering_enabled_ = true; |
| 70 | 73 |
| 71 int next_available_id_ = 1; | 74 int next_available_id_ = 1; |
| 72 | 75 |
| 73 std::vector<UiElement*> browser_ui_elements_; | 76 std::vector<UiElement*> browser_ui_elements_; |
| 74 | 77 |
| 75 base::OneShotTimer security_warning_timer_; | 78 base::OneShotTimer security_warning_timer_; |
| 76 | 79 |
| 77 base::WeakPtrFactory<UiSceneManager> weak_ptr_factory_; | 80 base::WeakPtrFactory<UiSceneManager> weak_ptr_factory_; |
| 78 | 81 |
| 79 DISALLOW_COPY_AND_ASSIGN(UiSceneManager); | 82 DISALLOW_COPY_AND_ASSIGN(UiSceneManager); |
| 80 }; | 83 }; |
| 81 | 84 |
| 82 } // namespace vr_shell | 85 } // namespace vr_shell |
| 83 | 86 |
| 84 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_UI_SCENE_MANAGER_H_ | 87 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_UI_SCENE_MANAGER_H_ |
| OLD | NEW |