| 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/close_button_texture.h" | 9 #include "chrome/browser/android/vr_shell/textures/close_button_texture.h" |
| 10 #include "chrome/browser/android/vr_shell/textures/ui_texture.h" | 10 #include "chrome/browser/android/vr_shell/textures/ui_texture.h" |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 void UiSceneManager::CreateSystemIndicators() { | 124 void UiSceneManager::CreateSystemIndicators() { |
| 125 std::unique_ptr<UiElement> element; | 125 std::unique_ptr<UiElement> element; |
| 126 | 126 |
| 127 // TODO(acondor): Make constants for sizes and positions once the UX for the | 127 // TODO(acondor): Make constants for sizes and positions once the UX for the |
| 128 // indicators is defined. | 128 // indicators is defined. |
| 129 element = base::MakeUnique<AudioCaptureIndicator>(256); | 129 element = base::MakeUnique<AudioCaptureIndicator>(256); |
| 130 element->set_id(AllocateId()); | 130 element->set_id(AllocateId()); |
| 131 element->set_translation({-0.3, 0.8, -1.9}); | 131 element->set_translation({-0.3, 0.8, -1.9}); |
| 132 element->set_size({0.4, 0, 1}); | 132 element->set_size({0.4, 0, 1}); |
| 133 element->set_visible(false); | 133 element->set_visible(false); |
| 134 audio_input_indicator_ = element.get(); | 134 audio_capture_indicator_ = element.get(); |
| 135 scene_->AddUiElement(std::move(element)); | 135 scene_->AddUiElement(std::move(element)); |
| 136 | 136 |
| 137 element = base::MakeUnique<VideoCaptureIndicator>(256); | 137 element = base::MakeUnique<VideoCaptureIndicator>(256); |
| 138 element->set_id(AllocateId()); | 138 element->set_id(AllocateId()); |
| 139 element->set_translation({0.3, 0.8, -1.9}); | 139 element->set_translation({0.3, 0.8, -1.9}); |
| 140 element->set_size({0.4, 0, 1}); | 140 element->set_size({0.4, 0, 1}); |
| 141 element->set_visible(false); | 141 element->set_visible(false); |
| 142 video_input_indicator_ = element.get(); | 142 video_capture_indicator_ = element.get(); |
| 143 scene_->AddUiElement(std::move(element)); | 143 scene_->AddUiElement(std::move(element)); |
| 144 } | 144 } |
| 145 | 145 |
| 146 void UiSceneManager::CreateContentQuad() { | 146 void UiSceneManager::CreateContentQuad() { |
| 147 std::unique_ptr<UiElement> element; | 147 std::unique_ptr<UiElement> element; |
| 148 | 148 |
| 149 element = base::MakeUnique<UiElement>(); | 149 element = base::MakeUnique<UiElement>(); |
| 150 element->set_id(AllocateId()); | 150 element->set_id(AllocateId()); |
| 151 element->set_fill(vr_shell::Fill::CONTENT); | 151 element->set_fill(vr_shell::Fill::CONTENT); |
| 152 element->set_size({kContentWidth, kContentHeight, 1}); | 152 element->set_size({kContentWidth, kContentHeight, 1}); |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 // Note that main_content_ is already visible in this case. | 294 // Note that main_content_ is already visible in this case. |
| 295 main_content_->set_translation( | 295 main_content_->set_translation( |
| 296 {0, kContentVerticalOffset, -kContentDistance}); | 296 {0, kContentVerticalOffset, -kContentDistance}); |
| 297 main_content_->set_size({kContentWidth, kContentHeight, 1}); | 297 main_content_->set_size({kContentWidth, kContentHeight, 1}); |
| 298 } | 298 } |
| 299 | 299 |
| 300 scene_->SetBackgroundDistance(main_content_->translation().z() * | 300 scene_->SetBackgroundDistance(main_content_->translation().z() * |
| 301 -kBackgroundDistanceMultiplier); | 301 -kBackgroundDistanceMultiplier); |
| 302 } | 302 } |
| 303 | 303 |
| 304 void UiSceneManager::SetAudioCapturingIndicator(bool enabled) { |
| 305 audio_capture_indicator_->set_visible(enabled); |
| 306 } |
| 307 |
| 308 void UiSceneManager::SetVideoCapturingIndicator(bool enabled) { |
| 309 video_capture_indicator_->set_visible(enabled); |
| 310 } |
| 311 |
| 312 void UiSceneManager::SetScreenCapturingIndicator(bool enabled) { |
| 313 // TODO(asimjour) add the indicator and change the visibility here. |
| 314 } |
| 315 |
| 304 void UiSceneManager::SetWebVrSecureOrigin(bool secure) { | 316 void UiSceneManager::SetWebVrSecureOrigin(bool secure) { |
| 305 secure_origin_ = secure; | 317 secure_origin_ = secure; |
| 306 ConfigureSecurityWarnings(); | 318 ConfigureSecurityWarnings(); |
| 307 } | 319 } |
| 308 | 320 |
| 309 void UiSceneManager::OnAppButtonClicked() { | 321 void UiSceneManager::OnAppButtonClicked() { |
| 310 // App button click exits the WebVR presentation and fullscreen. | 322 // App button click exits the WebVR presentation and fullscreen. |
| 311 browser_->ExitPresent(); | 323 browser_->ExitPresent(); |
| 312 browser_->ExitFullscreen(); | 324 browser_->ExitFullscreen(); |
| 313 } | 325 } |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 362 void UiSceneManager::SetHistoryButtonsEnabled(bool can_go_back, | 374 void UiSceneManager::SetHistoryButtonsEnabled(bool can_go_back, |
| 363 bool can_go_forward) {} | 375 bool can_go_forward) {} |
| 364 | 376 |
| 365 void UiSceneManager::OnCloseButtonClicked() {} | 377 void UiSceneManager::OnCloseButtonClicked() {} |
| 366 | 378 |
| 367 int UiSceneManager::AllocateId() { | 379 int UiSceneManager::AllocateId() { |
| 368 return next_available_id_++; | 380 return next_available_id_++; |
| 369 } | 381 } |
| 370 | 382 |
| 371 } // namespace vr_shell | 383 } // namespace vr_shell |
| OLD | NEW |