| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 #include "chrome/browser/android/vr_shell/ui_scene_manager.h" | 5 #include "chrome/browser/android/vr_shell/ui_scene_manager.h" |
| 6 | 6 |
| 7 #include "base/callback.h" | 7 #include "base/callback.h" |
| 8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
| 9 #include "chrome/browser/android/vr_shell/textures/ui_texture.h" | 9 #include "chrome/browser/android/vr_shell/textures/ui_texture.h" |
| 10 #include "chrome/browser/android/vr_shell/ui_elements/audio_capture_indicator.h" |
| 10 #include "chrome/browser/android/vr_shell/ui_elements/close_button.h" | 11 #include "chrome/browser/android/vr_shell/ui_elements/close_button.h" |
| 11 #include "chrome/browser/android/vr_shell/ui_elements/loading_indicator.h" | 12 #include "chrome/browser/android/vr_shell/ui_elements/loading_indicator.h" |
| 12 #include "chrome/browser/android/vr_shell/ui_elements/permanent_security_warning
.h" | 13 #include "chrome/browser/android/vr_shell/ui_elements/permanent_security_warning
.h" |
| 13 #include "chrome/browser/android/vr_shell/ui_elements/transient_security_warning
.h" | 14 #include "chrome/browser/android/vr_shell/ui_elements/transient_security_warning
.h" |
| 14 #include "chrome/browser/android/vr_shell/ui_elements/ui_element.h" | 15 #include "chrome/browser/android/vr_shell/ui_elements/ui_element.h" |
| 15 #include "chrome/browser/android/vr_shell/ui_elements/url_bar.h" | 16 #include "chrome/browser/android/vr_shell/ui_elements/url_bar.h" |
| 17 #include "chrome/browser/android/vr_shell/ui_elements/video_capture_indicator.h" |
| 16 #include "chrome/browser/android/vr_shell/ui_scene.h" | 18 #include "chrome/browser/android/vr_shell/ui_scene.h" |
| 17 #include "chrome/browser/android/vr_shell/vr_browser_interface.h" | 19 #include "chrome/browser/android/vr_shell/vr_browser_interface.h" |
| 18 #include "chrome/browser/android/vr_shell/vr_shell.h" | 20 #include "chrome/browser/android/vr_shell/vr_shell.h" |
| 19 | 21 |
| 20 namespace vr_shell { | 22 namespace vr_shell { |
| 21 | 23 |
| 22 namespace { | 24 namespace { |
| 23 | 25 |
| 24 static constexpr int kWarningTimeoutSeconds = 30; | 26 static constexpr int kWarningTimeoutSeconds = 30; |
| 25 static constexpr float kWarningDistance = 0.7; | 27 static constexpr float kWarningDistance = 0.7; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 bool in_cct, | 60 bool in_cct, |
| 59 bool in_web_vr) | 61 bool in_web_vr) |
| 60 : browser_(browser), | 62 : browser_(browser), |
| 61 scene_(scene), | 63 scene_(scene), |
| 62 in_cct_(in_cct), | 64 in_cct_(in_cct), |
| 63 web_vr_mode_(in_web_vr), | 65 web_vr_mode_(in_web_vr), |
| 64 weak_ptr_factory_(this) { | 66 weak_ptr_factory_(this) { |
| 65 CreateBackground(); | 67 CreateBackground(); |
| 66 CreateContentQuad(); | 68 CreateContentQuad(); |
| 67 CreateSecurityWarnings(); | 69 CreateSecurityWarnings(); |
| 70 CreateSystemIndicators(); |
| 68 CreateUrlBar(); | 71 CreateUrlBar(); |
| 69 if (in_cct_) | 72 if (in_cct_) |
| 70 CreateCloseButton(); | 73 CreateCloseButton(); |
| 71 | 74 |
| 72 ConfigureScene(); | 75 ConfigureScene(); |
| 73 } | 76 } |
| 74 | 77 |
| 75 UiSceneManager::~UiSceneManager() {} | 78 UiSceneManager::~UiSceneManager() {} |
| 76 | 79 |
| 77 void UiSceneManager::CreateSecurityWarnings() { | 80 void UiSceneManager::CreateSecurityWarnings() { |
| (...skipping 22 matching lines...) Expand all Loading... |
| 100 element->set_size({kTransientWarningWidth, kTransientWarningHeight, 1}); | 103 element->set_size({kTransientWarningWidth, kTransientWarningHeight, 1}); |
| 101 element->set_scale({kWarningDistance, kWarningDistance, 1}); | 104 element->set_scale({kWarningDistance, kWarningDistance, 1}); |
| 102 element->set_translation({0, 0, -kWarningDistance}); | 105 element->set_translation({0, 0, -kWarningDistance}); |
| 103 element->set_visible(false); | 106 element->set_visible(false); |
| 104 element->set_hit_testable(false); | 107 element->set_hit_testable(false); |
| 105 element->set_lock_to_fov(true); | 108 element->set_lock_to_fov(true); |
| 106 transient_security_warning_ = element.get(); | 109 transient_security_warning_ = element.get(); |
| 107 scene_->AddUiElement(std::move(element)); | 110 scene_->AddUiElement(std::move(element)); |
| 108 } | 111 } |
| 109 | 112 |
| 113 void UiSceneManager::CreateSystemIndicators() { |
| 114 std::unique_ptr<UiElement> element; |
| 115 |
| 116 // TODO(acondor): Make constants for sizes and positions once the UX for the |
| 117 // indicators is defined. |
| 118 element = base::MakeUnique<AudioCaptureIndicator>(256); |
| 119 element->set_id(AllocateId()); |
| 120 element->set_translation({-0.3, 0.8, -1.9}); |
| 121 element->set_size({0.4, 0, 1}); |
| 122 element->set_visible(false); |
| 123 audio_input_indicator_ = element.get(); |
| 124 scene_->AddUiElement(std::move(element)); |
| 125 |
| 126 element = base::MakeUnique<VideoCaptureIndicator>(256); |
| 127 element->set_id(AllocateId()); |
| 128 element->set_translation({0.3, 0.8, -1.9}); |
| 129 element->set_size({0.4, 0, 1}); |
| 130 element->set_visible(false); |
| 131 video_input_indicator_ = element.get(); |
| 132 scene_->AddUiElement(std::move(element)); |
| 133 } |
| 134 |
| 110 void UiSceneManager::CreateContentQuad() { | 135 void UiSceneManager::CreateContentQuad() { |
| 111 std::unique_ptr<UiElement> element; | 136 std::unique_ptr<UiElement> element; |
| 112 | 137 |
| 113 element = base::MakeUnique<UiElement>(); | 138 element = base::MakeUnique<UiElement>(); |
| 114 element->set_id(AllocateId()); | 139 element->set_id(AllocateId()); |
| 115 element->set_fill(vr_shell::Fill::CONTENT); | 140 element->set_fill(vr_shell::Fill::CONTENT); |
| 116 element->set_size({kContentWidth, kContentHeight, 1}); | 141 element->set_size({kContentWidth, kContentHeight, 1}); |
| 117 element->set_translation({0, kContentVerticalOffset, -kContentDistance}); | 142 element->set_translation({0, kContentVerticalOffset, -kContentDistance}); |
| 118 element->set_visible(false); | 143 element->set_visible(false); |
| 119 main_content_ = element.get(); | 144 main_content_ = element.get(); |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 324 void UiSceneManager::SetHistoryButtonsEnabled(bool can_go_back, | 349 void UiSceneManager::SetHistoryButtonsEnabled(bool can_go_back, |
| 325 bool can_go_forward) {} | 350 bool can_go_forward) {} |
| 326 | 351 |
| 327 void UiSceneManager::OnCloseButtonClicked() {} | 352 void UiSceneManager::OnCloseButtonClicked() {} |
| 328 | 353 |
| 329 int UiSceneManager::AllocateId() { | 354 int UiSceneManager::AllocateId() { |
| 330 return next_available_id_++; | 355 return next_available_id_++; |
| 331 } | 356 } |
| 332 | 357 |
| 333 } // namespace vr_shell | 358 } // namespace vr_shell |
| OLD | NEW |