| 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/color_scheme.h" | 9 #include "chrome/browser/android/vr_shell/color_scheme.h" |
| 10 #include "chrome/browser/android/vr_shell/textures/close_button_texture.h" | 10 #include "chrome/browser/android/vr_shell/textures/close_button_texture.h" |
| (...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 312 base::WeakPtr<UiSceneManager> UiSceneManager::GetWeakPtr() { | 312 base::WeakPtr<UiSceneManager> UiSceneManager::GetWeakPtr() { |
| 313 return weak_ptr_factory_.GetWeakPtr(); | 313 return weak_ptr_factory_.GetWeakPtr(); |
| 314 } | 314 } |
| 315 | 315 |
| 316 void UiSceneManager::SetWebVrMode(bool web_vr) { | 316 void UiSceneManager::SetWebVrMode(bool web_vr) { |
| 317 if (web_vr_mode_ == web_vr) | 317 if (web_vr_mode_ == web_vr) |
| 318 return; | 318 return; |
| 319 web_vr_mode_ = web_vr; | 319 web_vr_mode_ = web_vr; |
| 320 ConfigureScene(); | 320 ConfigureScene(); |
| 321 ConfigureSecurityWarnings(); | 321 ConfigureSecurityWarnings(); |
| 322 audio_capture_indicator_->set_visible(!web_vr && audio_capturing_); |
| 323 video_capture_indicator_->set_visible(!web_vr && video_capturing_); |
| 324 screen_capture_indicator_->set_visible(!web_vr && screen_capturing_); |
| 322 } | 325 } |
| 323 | 326 |
| 324 void UiSceneManager::ConfigureScene() { | 327 void UiSceneManager::ConfigureScene() { |
| 325 exit_warning_->SetEnabled(scene_->is_exiting()); | 328 exit_warning_->SetEnabled(scene_->is_exiting()); |
| 326 screen_dimmer_->SetEnabled(scene_->is_exiting()); | 329 screen_dimmer_->SetEnabled(scene_->is_exiting()); |
| 327 | 330 |
| 328 // Controls (URL bar, loading progress, etc). | 331 // Controls (URL bar, loading progress, etc). |
| 329 bool controls_visible = !web_vr_mode_ && !fullscreen_; | 332 bool controls_visible = !web_vr_mode_ && !fullscreen_; |
| 330 for (UiElement* element : control_elements_) { | 333 for (UiElement* element : control_elements_) { |
| 331 element->SetEnabled(controls_visible); | 334 element->SetEnabled(controls_visible); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 360 ceiling_->set_edge_color(color_scheme().horizon); | 363 ceiling_->set_edge_color(color_scheme().horizon); |
| 361 floor_->set_center_color(color_scheme().floor); | 364 floor_->set_center_color(color_scheme().floor); |
| 362 floor_->set_edge_color(color_scheme().horizon); | 365 floor_->set_edge_color(color_scheme().horizon); |
| 363 floor_grid_->set_center_color(color_scheme().floor_grid); | 366 floor_grid_->set_center_color(color_scheme().floor_grid); |
| 364 vr::Colorf floor_grid_edge_color = color_scheme().floor_grid; | 367 vr::Colorf floor_grid_edge_color = color_scheme().floor_grid; |
| 365 floor_grid_edge_color.a = 0.0; | 368 floor_grid_edge_color.a = 0.0; |
| 366 floor_grid_->set_edge_color(floor_grid_edge_color); | 369 floor_grid_->set_edge_color(floor_grid_edge_color); |
| 367 } | 370 } |
| 368 | 371 |
| 369 void UiSceneManager::SetAudioCapturingIndicator(bool enabled) { | 372 void UiSceneManager::SetAudioCapturingIndicator(bool enabled) { |
| 370 audio_capture_indicator_->set_visible(enabled); | 373 audio_capturing_ = enabled; |
| 374 audio_capture_indicator_->set_visible(enabled && !web_vr_mode_); |
| 371 } | 375 } |
| 372 | 376 |
| 373 void UiSceneManager::SetVideoCapturingIndicator(bool enabled) { | 377 void UiSceneManager::SetVideoCapturingIndicator(bool enabled) { |
| 374 video_capture_indicator_->set_visible(enabled); | 378 video_capturing_ = enabled; |
| 379 video_capture_indicator_->set_visible(enabled && !web_vr_mode_); |
| 375 } | 380 } |
| 376 | 381 |
| 377 void UiSceneManager::SetScreenCapturingIndicator(bool enabled) { | 382 void UiSceneManager::SetScreenCapturingIndicator(bool enabled) { |
| 378 // TODO(asimjour) add the indicator and change the visibility here. | 383 screen_capturing_ = enabled; |
| 384 screen_capture_indicator_->set_visible(enabled && !web_vr_mode_); |
| 379 } | 385 } |
| 380 | 386 |
| 381 void UiSceneManager::SetWebVrSecureOrigin(bool secure) { | 387 void UiSceneManager::SetWebVrSecureOrigin(bool secure) { |
| 382 secure_origin_ = secure; | 388 secure_origin_ = secure; |
| 383 ConfigureSecurityWarnings(); | 389 ConfigureSecurityWarnings(); |
| 384 } | 390 } |
| 385 | 391 |
| 386 void UiSceneManager::OnAppButtonClicked() { | 392 void UiSceneManager::OnAppButtonClicked() { |
| 387 // App button click exits the WebVR presentation and fullscreen. | 393 // App button click exits the WebVR presentation and fullscreen. |
| 388 browser_->ExitPresent(); | 394 browser_->ExitPresent(); |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 453 int UiSceneManager::AllocateId() { | 459 int UiSceneManager::AllocateId() { |
| 454 return next_available_id_++; | 460 return next_available_id_++; |
| 455 } | 461 } |
| 456 | 462 |
| 457 const ColorScheme& UiSceneManager::color_scheme() const { | 463 const ColorScheme& UiSceneManager::color_scheme() const { |
| 458 return ColorScheme::GetColorScheme(fullscreen_ ? ColorScheme::kModeFullscreen | 464 return ColorScheme::GetColorScheme(fullscreen_ ? ColorScheme::kModeFullscreen |
| 459 : ColorScheme::kModeNormal); | 465 : ColorScheme::kModeNormal); |
| 460 } | 466 } |
| 461 | 467 |
| 462 } // namespace vr_shell | 468 } // namespace vr_shell |
| OLD | NEW |