Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(57)

Side by Side Diff: chrome/browser/android/vr_shell/ui_scene_manager.cc

Issue 2953073003: VR: Disable system indicators in full-screen mode. (Closed)
Patch Set: Address comments. Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/android/vr_shell/ui_scene_manager_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 418 matching lines...) Expand 10 before | Expand all | Expand 10 after
429 if (web_vr_mode_ == web_vr && web_vr_autopresented_ == auto_presented && 429 if (web_vr_mode_ == web_vr && web_vr_autopresented_ == auto_presented &&
430 web_vr_show_toast_ == show_toast) { 430 web_vr_show_toast_ == show_toast) {
431 return; 431 return;
432 } 432 }
433 web_vr_mode_ = web_vr; 433 web_vr_mode_ = web_vr;
434 web_vr_autopresented_ = auto_presented; 434 web_vr_autopresented_ = auto_presented;
435 web_vr_show_toast_ = show_toast; 435 web_vr_show_toast_ = show_toast;
436 ConfigureScene(); 436 ConfigureScene();
437 ConfigureSecurityWarnings(); 437 ConfigureSecurityWarnings();
438 ConfigureTransientUrlBar(); 438 ConfigureTransientUrlBar();
439 ConfigureIndicators();
440 ConfigurePresentationToast(); 439 ConfigurePresentationToast();
441 } 440 }
442 441
443 void UiSceneManager::ConfigureScene() { 442 void UiSceneManager::ConfigureScene() {
444 exit_warning_->SetEnabled(scene_->is_exiting()); 443 exit_warning_->SetEnabled(scene_->is_exiting());
445 screen_dimmer_->SetEnabled(scene_->is_exiting()); 444 screen_dimmer_->SetEnabled(scene_->is_exiting());
446 445
447 // Controls (URL bar, loading progress, etc). 446 // Controls (URL bar, loading progress, etc).
448 bool controls_visible = !web_vr_mode_ && !fullscreen_; 447 bool controls_visible = !web_vr_mode_ && !fullscreen_;
449 for (UiElement* element : control_elements_) { 448 for (UiElement* element : control_elements_) {
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
491 gfx::Vector3dF(0, kContentVerticalOffset - (kContentHeight / 2) - 0.3, 490 gfx::Vector3dF(0, kContentVerticalOffset - (kContentHeight / 2) - 0.3,
492 -kCloseButtonDistance)); 491 -kCloseButtonDistance));
493 close_button_->set_size( 492 close_button_->set_size(
494 gfx::Vector3dF(kCloseButtonWidth, kCloseButtonHeight, 1)); 493 gfx::Vector3dF(kCloseButtonWidth, kCloseButtonHeight, 1));
495 } 494 }
496 495
497 scene_->SetMode(mode()); 496 scene_->SetMode(mode());
498 scene_->SetBackgroundDistance(main_content_->translation().z() * 497 scene_->SetBackgroundDistance(main_content_->translation().z() *
499 -kBackgroundDistanceMultiplier); 498 -kBackgroundDistanceMultiplier);
500 UpdateBackgroundColor(); 499 UpdateBackgroundColor();
500
501 // Configure other subsystems here as well. Ultimately, it would be nice if we
502 // could configure all elements through ConfigureScene(), as the exact
503 // conditions that control each element are getting complicated. More systems
504 // should move in here, such that a single method call can update the entire
505 // scene. The drawback is slightly more overhead for individual scene
506 // reconfigurations.
507 ConfigureIndicators();
501 } 508 }
502 509
503 void UiSceneManager::UpdateBackgroundColor() { 510 void UiSceneManager::UpdateBackgroundColor() {
504 // TODO(vollick): it would be nice if ceiling, floor and the grid were 511 // TODO(vollick): it would be nice if ceiling, floor and the grid were
505 // UiElement subclasses and could respond to the OnSetMode signal. 512 // UiElement subclasses and could respond to the OnSetMode signal.
506 ceiling_->set_center_color(color_scheme().ceiling); 513 ceiling_->set_center_color(color_scheme().ceiling);
507 ceiling_->set_edge_color(color_scheme().world_background); 514 ceiling_->set_edge_color(color_scheme().world_background);
508 floor_->set_center_color(color_scheme().floor); 515 floor_->set_center_color(color_scheme().floor);
509 floor_->set_edge_color(color_scheme().world_background); 516 floor_->set_edge_color(color_scheme().world_background);
510 floor_->set_grid_color(color_scheme().floor_grid); 517 floor_->set_grid_color(color_scheme().floor_grid);
(...skipping 27 matching lines...) Expand all
538 void UiSceneManager::SetIncognito(bool incognito) { 545 void UiSceneManager::SetIncognito(bool incognito) {
539 if (incognito == incognito_) 546 if (incognito == incognito_)
540 return; 547 return;
541 incognito_ = incognito; 548 incognito_ = incognito;
542 ConfigureScene(); 549 ConfigureScene();
543 } 550 }
544 551
545 void UiSceneManager::OnGLInitialized() { 552 void UiSceneManager::OnGLInitialized() {
546 scene_->OnGLInitialized(); 553 scene_->OnGLInitialized();
547 554
548 // Indicators don't know their position until they've rendered themselves. 555 ConfigureScene();
549 ConfigureIndicators();
550 } 556 }
551 557
552 void UiSceneManager::OnAppButtonClicked() { 558 void UiSceneManager::OnAppButtonClicked() {
553 // App button click exits the WebVR presentation and fullscreen. 559 // App button click exits the WebVR presentation and fullscreen.
554 browser_->ExitPresent(); 560 browser_->ExitPresent();
555 browser_->ExitFullscreen(); 561 browser_->ExitFullscreen();
556 } 562 }
557 563
558 void UiSceneManager::OnAppButtonGesturePerformed( 564 void UiSceneManager::OnAppButtonGesturePerformed(
559 UiInterface::Direction direction) {} 565 UiInterface::Direction direction) {}
(...skipping 12 matching lines...) Expand all
572 if (enabled) { 578 if (enabled) {
573 security_warning_timer_.Start( 579 security_warning_timer_.Start(
574 FROM_HERE, base::TimeDelta::FromSeconds(kWarningTimeoutSeconds), this, 580 FROM_HERE, base::TimeDelta::FromSeconds(kWarningTimeoutSeconds), this,
575 &UiSceneManager::OnSecurityWarningTimer); 581 &UiSceneManager::OnSecurityWarningTimer);
576 } else { 582 } else {
577 security_warning_timer_.Stop(); 583 security_warning_timer_.Stop();
578 } 584 }
579 } 585 }
580 586
581 void UiSceneManager::ConfigureIndicators() { 587 void UiSceneManager::ConfigureIndicators() {
582 audio_capture_indicator_->set_visible(!web_vr_mode_ && audio_capturing_); 588 bool allowed = !web_vr_mode_ && !fullscreen_;
583 video_capture_indicator_->set_visible(!web_vr_mode_ && video_capturing_); 589 audio_capture_indicator_->set_visible(allowed && audio_capturing_);
584 screen_capture_indicator_->set_visible(!web_vr_mode_ && screen_capturing_); 590 video_capture_indicator_->set_visible(allowed && video_capturing_);
585 location_access_indicator_->set_visible(!web_vr_mode_ && location_access_); 591 screen_capture_indicator_->set_visible(allowed && screen_capturing_);
592 location_access_indicator_->set_visible(allowed && location_access_);
593
594 if (!allowed)
595 return;
586 596
587 // Position elements dynamically relative to each other, based on which 597 // Position elements dynamically relative to each other, based on which
588 // indicators are showing, and how big each one is. 598 // indicators are showing, and how big each one is.
589 float total_width = kIndicatorGap * (system_indicators_.size() - 1); 599 float total_width = kIndicatorGap * (system_indicators_.size() - 1);
590 for (const UiElement* indicator : system_indicators_) { 600 for (const UiElement* indicator : system_indicators_) {
591 if (indicator->visible()) 601 if (indicator->visible())
592 total_width += indicator->size().x(); 602 total_width += indicator->size().x();
593 } 603 }
594 float x_position = -total_width / 2; 604 float x_position = -total_width / 2;
595 for (UiElement* indicator : system_indicators_) { 605 for (UiElement* indicator : system_indicators_) {
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
730 if (fullscreen_) 740 if (fullscreen_)
731 return ColorScheme::kModeFullscreen; 741 return ColorScheme::kModeFullscreen;
732 return ColorScheme::kModeNormal; 742 return ColorScheme::kModeNormal;
733 } 743 }
734 744
735 const ColorScheme& UiSceneManager::color_scheme() const { 745 const ColorScheme& UiSceneManager::color_scheme() const {
736 return ColorScheme::GetColorScheme(mode()); 746 return ColorScheme::GetColorScheme(mode());
737 } 747 }
738 748
739 } // namespace vr_shell 749 } // namespace vr_shell
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/android/vr_shell/ui_scene_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698