| 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 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 298 base::WeakPtr<UiSceneManager> UiSceneManager::GetWeakPtr() { | 298 base::WeakPtr<UiSceneManager> UiSceneManager::GetWeakPtr() { |
| 299 return weak_ptr_factory_.GetWeakPtr(); | 299 return weak_ptr_factory_.GetWeakPtr(); |
| 300 } | 300 } |
| 301 | 301 |
| 302 void UiSceneManager::SetWebVrMode(bool web_vr) { | 302 void UiSceneManager::SetWebVrMode(bool web_vr) { |
| 303 if (web_vr_mode_ == web_vr) | 303 if (web_vr_mode_ == web_vr) |
| 304 return; | 304 return; |
| 305 web_vr_mode_ = web_vr; | 305 web_vr_mode_ = web_vr; |
| 306 ConfigureScene(); | 306 ConfigureScene(); |
| 307 ConfigureSecurityWarnings(); | 307 ConfigureSecurityWarnings(); |
| 308 audio_capture_indicator_->set_visible(!web_vr && audio_capturing_); |
| 309 video_capture_indicator_->set_visible(!web_vr && video_capturing_); |
| 310 screen_capture_indicator_->set_visible(!web_vr && screen_capturing_); |
| 308 } | 311 } |
| 309 | 312 |
| 310 void UiSceneManager::ConfigureScene() { | 313 void UiSceneManager::ConfigureScene() { |
| 311 exit_warning_->SetEnabled(scene_->is_exiting()); | 314 exit_warning_->SetEnabled(scene_->is_exiting()); |
| 312 screen_dimmer_->SetEnabled(scene_->is_exiting()); | 315 screen_dimmer_->SetEnabled(scene_->is_exiting()); |
| 313 | 316 |
| 314 // Controls (URL bar, loading progress, etc). | 317 // Controls (URL bar, loading progress, etc). |
| 315 bool controls_visible = !web_vr_mode_ && !fullscreen_; | 318 bool controls_visible = !web_vr_mode_ && !fullscreen_; |
| 316 for (UiElement* element : control_elements_) { | 319 for (UiElement* element : control_elements_) { |
| 317 element->SetEnabled(controls_visible); | 320 element->SetEnabled(controls_visible); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 345 // TODO(vollick): it would be nice if ceiling, floor and the grid were | 348 // TODO(vollick): it would be nice if ceiling, floor and the grid were |
| 346 // UiElement subclasses and could respond to the OnSetMode signal. | 349 // UiElement subclasses and could respond to the OnSetMode signal. |
| 347 ceiling_->set_center_color(color_scheme().ceiling); | 350 ceiling_->set_center_color(color_scheme().ceiling); |
| 348 ceiling_->set_edge_color(color_scheme().horizon); | 351 ceiling_->set_edge_color(color_scheme().horizon); |
| 349 floor_->set_center_color(color_scheme().floor); | 352 floor_->set_center_color(color_scheme().floor); |
| 350 floor_->set_edge_color(color_scheme().horizon); | 353 floor_->set_edge_color(color_scheme().horizon); |
| 351 floor_->set_grid_color(color_scheme().floor_grid); | 354 floor_->set_grid_color(color_scheme().floor_grid); |
| 352 } | 355 } |
| 353 | 356 |
| 354 void UiSceneManager::SetAudioCapturingIndicator(bool enabled) { | 357 void UiSceneManager::SetAudioCapturingIndicator(bool enabled) { |
| 355 audio_capture_indicator_->set_visible(enabled); | 358 audio_capturing_ = enabled; |
| 359 audio_capture_indicator_->set_visible(enabled && !web_vr_mode_); |
| 356 } | 360 } |
| 357 | 361 |
| 358 void UiSceneManager::SetVideoCapturingIndicator(bool enabled) { | 362 void UiSceneManager::SetVideoCapturingIndicator(bool enabled) { |
| 359 video_capture_indicator_->set_visible(enabled); | 363 video_capturing_ = enabled; |
| 364 video_capture_indicator_->set_visible(enabled && !web_vr_mode_); |
| 360 } | 365 } |
| 361 | 366 |
| 362 void UiSceneManager::SetScreenCapturingIndicator(bool enabled) { | 367 void UiSceneManager::SetScreenCapturingIndicator(bool enabled) { |
| 363 // TODO(asimjour) add the indicator and change the visibility here. | 368 screen_capturing_ = enabled; |
| 369 screen_capture_indicator_->set_visible(enabled && !web_vr_mode_); |
| 364 } | 370 } |
| 365 | 371 |
| 366 void UiSceneManager::SetWebVrSecureOrigin(bool secure) { | 372 void UiSceneManager::SetWebVrSecureOrigin(bool secure) { |
| 367 secure_origin_ = secure; | 373 secure_origin_ = secure; |
| 368 ConfigureSecurityWarnings(); | 374 ConfigureSecurityWarnings(); |
| 369 } | 375 } |
| 370 | 376 |
| 371 void UiSceneManager::SetIncognito(bool incognito) { | 377 void UiSceneManager::SetIncognito(bool incognito) { |
| 372 if (incognito == incognito_) | 378 if (incognito == incognito_) |
| 373 return; | 379 return; |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 458 if (fullscreen_) | 464 if (fullscreen_) |
| 459 return ColorScheme::kModeFullscreen; | 465 return ColorScheme::kModeFullscreen; |
| 460 return ColorScheme::kModeNormal; | 466 return ColorScheme::kModeNormal; |
| 461 } | 467 } |
| 462 | 468 |
| 463 const ColorScheme& UiSceneManager::color_scheme() const { | 469 const ColorScheme& UiSceneManager::color_scheme() const { |
| 464 return ColorScheme::GetColorScheme(mode()); | 470 return ColorScheme::GetColorScheme(mode()); |
| 465 } | 471 } |
| 466 | 472 |
| 467 } // namespace vr_shell | 473 } // namespace vr_shell |
| OLD | NEW |