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

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

Issue 2955023002: VR: Factor transient timing out of UiSceneManager. (Closed)
Patch Set: Rebase again onto ExclusivePresentationToast class/file rename. Created 3 years, 5 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
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 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 131
132 UiSceneManager::UiSceneManager(UiBrowserInterface* browser, 132 UiSceneManager::UiSceneManager(UiBrowserInterface* browser,
133 UiScene* scene, 133 UiScene* scene,
134 bool in_cct, 134 bool in_cct,
135 bool in_web_vr, 135 bool in_web_vr,
136 bool web_vr_autopresentation_expected) 136 bool web_vr_autopresentation_expected)
137 : browser_(browser), 137 : browser_(browser),
138 scene_(scene), 138 scene_(scene),
139 in_cct_(in_cct), 139 in_cct_(in_cct),
140 web_vr_mode_(in_web_vr), 140 web_vr_mode_(in_web_vr),
141 web_vr_autopresentation_(web_vr_autopresentation_expected),
141 web_vr_autopresentation_expected_(web_vr_autopresentation_expected), 142 web_vr_autopresentation_expected_(web_vr_autopresentation_expected),
142 weak_ptr_factory_(this) { 143 weak_ptr_factory_(this) {
143 CreateSplashScreen(); 144 CreateSplashScreen();
144 CreateBackground(); 145 CreateBackground();
145 CreateContentQuad(); 146 CreateContentQuad();
146 CreateSecurityWarnings(); 147 CreateSecurityWarnings();
147 CreateSystemIndicators(); 148 CreateSystemIndicators();
148 CreateUrlBar(); 149 CreateUrlBar();
149 CreateTransientUrlBar(); 150 CreateTransientUrlBar();
150 CreateCloseButton(); 151 CreateCloseButton();
151 CreateScreenDimmer(); 152 CreateScreenDimmer();
152 CreateExitPrompt(); 153 CreateExitPrompt();
153 CreateToasts(); 154 CreateToasts();
154 155
155 ConfigureScene(); 156 ConfigureScene();
156 ConfigureSecurityWarnings();
157 } 157 }
158 158
159 UiSceneManager::~UiSceneManager() {} 159 UiSceneManager::~UiSceneManager() {}
160 160
161 void UiSceneManager::CreateScreenDimmer() { 161 void UiSceneManager::CreateScreenDimmer() {
162 std::unique_ptr<UiElement> element; 162 std::unique_ptr<UiElement> element;
163 element = base::MakeUnique<ScreenDimmer>(); 163 element = base::MakeUnique<ScreenDimmer>();
164 element->set_debug_id(kScreenDimmer); 164 element->set_debug_id(kScreenDimmer);
165 element->set_id(AllocateId()); 165 element->set_id(AllocateId());
166 element->set_fill(vr_shell::Fill::NONE); 166 element->set_fill(vr_shell::Fill::NONE);
(...skipping 19 matching lines...) Expand all
186 gfx::Vector3dF(0, kWarningDistance * sin(kWarningAngleRadians), 186 gfx::Vector3dF(0, kWarningDistance * sin(kWarningAngleRadians),
187 -kWarningDistance * cos(kWarningAngleRadians))); 187 -kWarningDistance * cos(kWarningAngleRadians)));
188 element->set_rotation( 188 element->set_rotation(
189 gfx::Quaternion(gfx::Vector3dF(1, 0, 0), kWarningAngleRadians)); 189 gfx::Quaternion(gfx::Vector3dF(1, 0, 0), kWarningAngleRadians));
190 element->set_visible(false); 190 element->set_visible(false);
191 element->set_hit_testable(false); 191 element->set_hit_testable(false);
192 element->set_lock_to_fov(true); 192 element->set_lock_to_fov(true);
193 permanent_security_warning_ = element.get(); 193 permanent_security_warning_ = element.get();
194 scene_->AddUiElement(std::move(element)); 194 scene_->AddUiElement(std::move(element));
195 195
196 element = base::MakeUnique<TransientSecurityWarning>(1024); 196 auto transient_warning = base::MakeUnique<TransientSecurityWarning>(
197 1024, base::TimeDelta::FromSeconds(kWarningTimeoutSeconds));
198 transient_security_warning_ = transient_warning.get();
199 element = std::move(transient_warning);
197 element->set_debug_id(kWebVrTransientHttpSecurityWarning); 200 element->set_debug_id(kWebVrTransientHttpSecurityWarning);
198 element->set_id(AllocateId()); 201 element->set_id(AllocateId());
199 element->set_fill(vr_shell::Fill::NONE); 202 element->set_fill(vr_shell::Fill::NONE);
200 element->set_size({kTransientWarningWidth, kTransientWarningHeight, 1}); 203 element->set_size({kTransientWarningWidth, kTransientWarningHeight, 1});
201 element->set_scale({kWarningDistance, kWarningDistance, 1}); 204 element->set_scale({kWarningDistance, kWarningDistance, 1});
202 element->set_translation({0, 0, -kWarningDistance}); 205 element->set_translation({0, 0, -kWarningDistance});
203 element->set_visible(false); 206 element->set_visible(false);
204 element->set_hit_testable(false); 207 element->set_hit_testable(false);
205 element->set_lock_to_fov(true); 208 element->set_lock_to_fov(true);
206 transient_security_warning_ = element.get();
207 scene_->AddUiElement(std::move(element)); 209 scene_->AddUiElement(std::move(element));
208 210
209 element = base::MakeUnique<ExitWarning>(1024); 211 element = base::MakeUnique<ExitWarning>(1024);
210 element->set_debug_id(kExitWarning); 212 element->set_debug_id(kExitWarning);
211 element->set_id(AllocateId()); 213 element->set_id(AllocateId());
212 element->set_fill(vr_shell::Fill::NONE); 214 element->set_fill(vr_shell::Fill::NONE);
213 element->set_size({kExitWarningWidth, kExitWarningHeight, 1}); 215 element->set_size({kExitWarningWidth, kExitWarningHeight, 1});
214 element->set_scale({kExitWarningDistance, kExitWarningDistance, 1}); 216 element->set_scale({kExitWarningDistance, kExitWarningDistance, 1});
215 element->set_translation({0, 0, -kExitWarningDistance}); 217 element->set_translation({0, 0, -kExitWarningDistance});
216 element->set_visible(false); 218 element->set_visible(false);
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 indicator->set_size({kLoadingIndicatorWidth, kLoadingIndicatorHeight, 1}); 364 indicator->set_size({kLoadingIndicatorWidth, kLoadingIndicatorHeight, 1});
363 indicator->set_parent_id(url_bar_->id()); 365 indicator->set_parent_id(url_bar_->id());
364 indicator->set_y_anchoring(YAnchoring::YTOP); 366 indicator->set_y_anchoring(YAnchoring::YTOP);
365 loading_indicator_ = indicator.get(); 367 loading_indicator_ = indicator.get();
366 control_elements_.push_back(indicator.get()); 368 control_elements_.push_back(indicator.get());
367 scene_->AddUiElement(std::move(indicator)); 369 scene_->AddUiElement(std::move(indicator));
368 } 370 }
369 371
370 void UiSceneManager::CreateTransientUrlBar() { 372 void UiSceneManager::CreateTransientUrlBar() {
371 auto url_bar = base::MakeUnique<TransientUrlBar>( 373 auto url_bar = base::MakeUnique<TransientUrlBar>(
372 512, 374 512, base::TimeDelta::FromSeconds(kTransientUrlBarTimeoutSeconds),
373 base::Bind(&UiSceneManager::OnUnsupportedMode, base::Unretained(this))); 375 base::Bind(&UiSceneManager::OnUnsupportedMode, base::Unretained(this)));
374 url_bar->set_debug_id(kTransientUrlBar); 376 url_bar->set_debug_id(kTransientUrlBar);
375 url_bar->set_id(AllocateId()); 377 url_bar->set_id(AllocateId());
376 url_bar->set_lock_to_fov(true); 378 url_bar->set_lock_to_fov(true);
377 url_bar->set_visible(false); 379 url_bar->set_visible(false);
378 url_bar->set_hit_testable(false); 380 url_bar->set_hit_testable(false);
379 url_bar->set_translation( 381 url_bar->set_translation(
380 {0, kTransientUrlBarVerticalOffset, -kTransientUrlBarDistance}); 382 {0, kTransientUrlBarVerticalOffset, -kTransientUrlBarDistance});
381 url_bar->set_rotation( 383 url_bar->set_rotation(
382 gfx::Quaternion(gfx::Vector3dF(1, 0, 0), kUrlBarRotationRad)); 384 gfx::Quaternion(gfx::Vector3dF(1, 0, 0), kUrlBarRotationRad));
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
426 element->set_fill(vr_shell::Fill::NONE); 428 element->set_fill(vr_shell::Fill::NONE);
427 element->set_size({kExitPromptBackplaneSize, kExitPromptBackplaneSize, 1.0}); 429 element->set_size({kExitPromptBackplaneSize, kExitPromptBackplaneSize, 1.0});
428 element->set_translation({0.0, 0.0, -kTextureOffset}); 430 element->set_translation({0.0, 0.0, -kTextureOffset});
429 element->set_parent_id(exit_prompt_->id()); 431 element->set_parent_id(exit_prompt_->id());
430 exit_prompt_backplane_ = element.get(); 432 exit_prompt_backplane_ = element.get();
431 content_elements_.push_back(element.get()); 433 content_elements_.push_back(element.get());
432 scene_->AddUiElement(std::move(element)); 434 scene_->AddUiElement(std::move(element));
433 } 435 }
434 436
435 void UiSceneManager::CreateToasts() { 437 void UiSceneManager::CreateToasts() {
436 std::unique_ptr<UiElement> element = 438 auto element = base::MakeUnique<ExclusiveScreenToast>(
437 base::MakeUnique<ExclusiveScreenToast>(512); 439 512, base::TimeDelta::FromSeconds(kToastTimeoutSeconds));
438 element->set_debug_id(kExclusiveScreenToast); 440 element->set_debug_id(kExclusiveScreenToast);
439 element->set_id(AllocateId()); 441 element->set_id(AllocateId());
440 element->set_fill(vr_shell::Fill::NONE); 442 element->set_fill(vr_shell::Fill::NONE);
441 element->set_size({kToastWidthDMM, kToastHeightDMM, 1}); 443 element->set_size({kToastWidthDMM, kToastHeightDMM, 1});
442 element->set_visible(false); 444 element->set_visible(false);
443 element->set_hit_testable(false); 445 element->set_hit_testable(false);
444 exclusive_screen_toast_ = element.get(); 446 exclusive_screen_toast_ = element.get();
445 scene_->AddUiElement(std::move(element)); 447 scene_->AddUiElement(std::move(element));
446 } 448 }
447 449
448 base::WeakPtr<UiSceneManager> UiSceneManager::GetWeakPtr() { 450 base::WeakPtr<UiSceneManager> UiSceneManager::GetWeakPtr() {
449 return weak_ptr_factory_.GetWeakPtr(); 451 return weak_ptr_factory_.GetWeakPtr();
450 } 452 }
451 453
452 void UiSceneManager::SetWebVrMode(bool web_vr, bool show_toast) { 454 void UiSceneManager::SetWebVrMode(bool web_vr, bool show_toast) {
453 if (web_vr_mode_ == web_vr && web_vr_show_toast_ == show_toast) { 455 if (web_vr_mode_ == web_vr && web_vr_show_toast_ == show_toast) {
454 return; 456 return;
455 } 457 }
458
456 web_vr_mode_ = web_vr; 459 web_vr_mode_ = web_vr;
457 ConfigureTransientUrlBar();
458 scene_->set_showing_splash_screen(false);
459 web_vr_autopresentation_expected_ = false; 460 web_vr_autopresentation_expected_ = false;
460 web_vr_show_toast_ = show_toast; 461 web_vr_show_toast_ = show_toast;
461 toast_state_ = SET_FOR_WEB_VR; 462 if (!web_vr_mode_)
463 web_vr_autopresentation_ = false;
464 scene_->set_showing_splash_screen(false);
462 ConfigureScene(); 465 ConfigureScene();
463 ConfigureSecurityWarnings(); 466
464 ConfigureExclusiveScreenToast(); 467 // Because we may be transitioning from and to fullscreen, where the toast is
468 // also shown, explicitly kick or end visibility here.
469 if (web_vr) {
470 exclusive_screen_toast_->transience()->KickVisibilityIfEnabled();
471 } else {
472 exclusive_screen_toast_->transience()->EndVisibilityIfEnabled();
473 }
465 } 474 }
466 475
467 void UiSceneManager::ConfigureScene() { 476 void UiSceneManager::ConfigureScene() {
468 // Splash screen. 477 // Splash screen.
469 scene_->set_showing_splash_screen(web_vr_autopresentation_expected_); 478 scene_->set_showing_splash_screen(web_vr_autopresentation_expected_);
470 splash_screen_icon_->SetEnabled(!web_vr_mode_ && 479 splash_screen_icon_->SetEnabled(web_vr_autopresentation_expected_);
471 web_vr_autopresentation_expected_);
472 480
473 // Exit warning. 481 // Exit warning.
474 exit_warning_->SetEnabled(scene_->is_exiting()); 482 exit_warning_->SetEnabled(scene_->is_exiting());
475 screen_dimmer_->SetEnabled(scene_->is_exiting()); 483 screen_dimmer_->SetEnabled(scene_->is_exiting());
476 484
477 bool browsing_mode = !web_vr_mode_ && !scene_->showing_splash_screen(); 485 bool browsing_mode = !web_vr_mode_ && !scene_->showing_splash_screen();
478 486
479 // Controls (URL bar, loading progress, etc). 487 // Controls (URL bar, loading progress, etc).
480 bool controls_visible = browsing_mode && !fullscreen_; 488 bool controls_visible = browsing_mode && !fullscreen_;
481 for (UiElement* element : control_elements_) { 489 for (UiElement* element : control_elements_) {
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
524 -kCloseButtonDistance)); 532 -kCloseButtonDistance));
525 close_button_->set_size( 533 close_button_->set_size(
526 gfx::Vector3dF(kCloseButtonWidth, kCloseButtonHeight, 1)); 534 gfx::Vector3dF(kCloseButtonWidth, kCloseButtonHeight, 1));
527 } 535 }
528 536
529 scene_->SetMode(mode()); 537 scene_->SetMode(mode());
530 scene_->SetBackgroundDistance(main_content_->translation().z() * 538 scene_->SetBackgroundDistance(main_content_->translation().z() *
531 -kBackgroundDistanceMultiplier); 539 -kBackgroundDistanceMultiplier);
532 UpdateBackgroundColor(); 540 UpdateBackgroundColor();
533 541
534 // Configure other subsystems here as well. Ultimately, it would be nice if we 542 transient_url_bar_->SetEnabled(web_vr_autopresentation_ &&
535 // could configure all elements through ConfigureScene(), as the exact 543 !scene_->showing_splash_screen());
536 // conditions that control each element are getting complicated. More systems 544
537 // should move in here, such that a single method call can update the entire 545 ConfigureExclusiveScreenToast();
538 // scene. The drawback is slightly more overhead for individual scene 546 ConfigureSecurityWarnings();
539 // reconfigurations.
540 ConfigureIndicators(); 547 ConfigureIndicators();
541 } 548 }
542 549
543 void UiSceneManager::UpdateBackgroundColor() { 550 void UiSceneManager::UpdateBackgroundColor() {
544 // TODO(vollick): it would be nice if ceiling, floor and the grid were 551 // TODO(vollick): it would be nice if ceiling, floor and the grid were
545 // UiElement subclasses and could respond to the OnSetMode signal. 552 // UiElement subclasses and could respond to the OnSetMode signal.
546 ceiling_->set_center_color(color_scheme().ceiling); 553 ceiling_->set_center_color(color_scheme().ceiling);
547 ceiling_->set_edge_color(color_scheme().world_background); 554 ceiling_->set_edge_color(color_scheme().world_background);
548 floor_->set_center_color(color_scheme().floor); 555 floor_->set_center_color(color_scheme().floor);
549 floor_->set_edge_color(color_scheme().world_background); 556 floor_->set_edge_color(color_scheme().world_background);
(...skipping 24 matching lines...) Expand all
574 location_access_ = enabled; 581 location_access_ = enabled;
575 ConfigureIndicators(); 582 ConfigureIndicators();
576 } 583 }
577 584
578 void UiSceneManager::SetBluetoothConnectedIndicator(bool enabled) { 585 void UiSceneManager::SetBluetoothConnectedIndicator(bool enabled) {
579 bluetooth_connected_ = enabled; 586 bluetooth_connected_ = enabled;
580 ConfigureIndicators(); 587 ConfigureIndicators();
581 } 588 }
582 589
583 void UiSceneManager::SetWebVrSecureOrigin(bool secure) { 590 void UiSceneManager::SetWebVrSecureOrigin(bool secure) {
591 if (secure_origin_ == secure)
592 return;
584 secure_origin_ = secure; 593 secure_origin_ = secure;
585 ConfigureSecurityWarnings(); 594 ConfigureSecurityWarnings();
586 } 595 }
587 596
588 void UiSceneManager::SetIncognito(bool incognito) { 597 void UiSceneManager::SetIncognito(bool incognito) {
589 if (incognito == incognito_) 598 if (incognito == incognito_)
590 return; 599 return;
591 incognito_ = incognito; 600 incognito_ = incognito;
592 ConfigureScene(); 601 ConfigureScene();
593 } 602 }
(...skipping 10 matching lines...) Expand all
604 browser_->ExitFullscreen(); 613 browser_->ExitFullscreen();
605 } 614 }
606 615
607 void UiSceneManager::OnAppButtonGesturePerformed( 616 void UiSceneManager::OnAppButtonGesturePerformed(
608 UiInterface::Direction direction) {} 617 UiInterface::Direction direction) {}
609 618
610 void UiSceneManager::SetFullscreen(bool fullscreen) { 619 void UiSceneManager::SetFullscreen(bool fullscreen) {
611 if (fullscreen_ == fullscreen) 620 if (fullscreen_ == fullscreen)
612 return; 621 return;
613 fullscreen_ = fullscreen; 622 fullscreen_ = fullscreen;
614 toast_state_ = SET_FOR_FULLSCREEN;
615 ConfigureScene(); 623 ConfigureScene();
616 ConfigureExclusiveScreenToast();
617 } 624 }
618 625
619 void UiSceneManager::ConfigureSecurityWarnings() { 626 void UiSceneManager::ConfigureSecurityWarnings() {
620 bool enabled = web_vr_mode_ && !secure_origin_; 627 bool enabled = web_vr_mode_ && !secure_origin_;
621 permanent_security_warning_->set_visible(enabled); 628 permanent_security_warning_->SetEnabled(enabled);
622 transient_security_warning_->set_visible(enabled); 629 transient_security_warning_->SetEnabled(enabled);
623 if (enabled) {
624 security_warning_timer_.Start(
625 FROM_HERE, base::TimeDelta::FromSeconds(kWarningTimeoutSeconds), this,
626 &UiSceneManager::OnSecurityWarningTimer);
627 } else {
628 security_warning_timer_.Stop();
629 }
630 } 630 }
631 631
632 void UiSceneManager::ConfigureIndicators() { 632 void UiSceneManager::ConfigureIndicators() {
633 bool allowed = !web_vr_mode_ && !fullscreen_; 633 bool allowed = !web_vr_mode_ && !fullscreen_;
634 audio_capture_indicator_->set_visible(allowed && audio_capturing_); 634 audio_capture_indicator_->set_visible(allowed && audio_capturing_);
635 video_capture_indicator_->set_visible(allowed && video_capturing_); 635 video_capture_indicator_->set_visible(allowed && video_capturing_);
636 screen_capture_indicator_->set_visible(allowed && screen_capturing_); 636 screen_capture_indicator_->set_visible(allowed && screen_capturing_);
637 location_access_indicator_->set_visible(allowed && location_access_); 637 location_access_indicator_->set_visible(allowed && location_access_);
638 bluetooth_connected_indicator_->set_visible(allowed && bluetooth_connected_); 638 bluetooth_connected_indicator_->set_visible(allowed && bluetooth_connected_);
639 639
(...skipping 16 matching lines...) Expand all
656 continue; 656 continue;
657 float width = indicator->size().x(); 657 float width = indicator->size().x();
658 indicator->set_translation({x_position + width / 2, 658 indicator->set_translation({x_position + width / 2,
659 kIndicatorVerticalOffset, 659 kIndicatorVerticalOffset,
660 kIndicatorDistanceOffset}); 660 kIndicatorDistanceOffset});
661 x_position += width + kIndicatorGap; 661 x_position += width + kIndicatorGap;
662 } 662 }
663 } 663 }
664 664
665 void UiSceneManager::ConfigureExclusiveScreenToast() { 665 void UiSceneManager::ConfigureExclusiveScreenToast() {
666 bool toast_visible = false; 666 exclusive_screen_toast_->SetEnabled((fullscreen_ && !web_vr_mode_) ||
667 switch (toast_state_) { 667 (web_vr_mode_ && web_vr_show_toast_));
668 case SET_FOR_WEB_VR: 668
669 toast_visible = web_vr_show_toast_;
670 break;
671 case SET_FOR_FULLSCREEN:
672 toast_visible = fullscreen_;
673 break;
674 case UNCHANGED:
675 return;
676 }
677 if (fullscreen_ && !web_vr_mode_) { 669 if (fullscreen_ && !web_vr_mode_) {
678 // Do not set size again. The size might have been changed by the backing 670 // Do not set size again. The size might have been changed by the backing
679 // texture size in UpdateElementSize. 671 // texture size in UpdateElementSize.
680 exclusive_screen_toast_->set_scale( 672 exclusive_screen_toast_->set_scale(
681 {kFullscreenToastDistance, kFullscreenToastDistance, 1}); 673 {kFullscreenToastDistance, kFullscreenToastDistance, 1});
682 exclusive_screen_toast_->set_translation( 674 exclusive_screen_toast_->set_translation(
683 {0, 675 {0,
684 kFullscreenVerticalOffset + kFullscreenHeight / 2 + 676 kFullscreenVerticalOffset + kFullscreenHeight / 2 +
685 (kToastOffsetDMM + kToastHeightDMM) * kFullscreenToastDistance, 677 (kToastOffsetDMM + kToastHeightDMM) * kFullscreenToastDistance,
686 -kFullscreenToastDistance}); 678 -kFullscreenToastDistance});
687 exclusive_screen_toast_->set_rotation( 679 exclusive_screen_toast_->set_rotation(
688 gfx::Quaternion(gfx::Vector3dF(1, 0, 0), 0.0)); 680 gfx::Quaternion(gfx::Vector3dF(1, 0, 0), 0.0));
689 exclusive_screen_toast_->set_lock_to_fov(false); 681 exclusive_screen_toast_->set_lock_to_fov(false);
690 } else if (web_vr_mode_ && web_vr_show_toast_) { 682 } else if (web_vr_mode_ && web_vr_show_toast_) {
691 exclusive_screen_toast_->set_scale( 683 exclusive_screen_toast_->set_scale(
692 {kWebVrToastDistance, kWebVrToastDistance, 1}); 684 {kWebVrToastDistance, kWebVrToastDistance, 1});
693 exclusive_screen_toast_->set_translation( 685 exclusive_screen_toast_->set_translation(
694 gfx::Vector3dF(0, kWebVrToastDistance * sin(kWebVrAngleRadians), 686 gfx::Vector3dF(0, kWebVrToastDistance * sin(kWebVrAngleRadians),
695 -kWebVrToastDistance * cos(kWebVrAngleRadians))); 687 -kWebVrToastDistance * cos(kWebVrAngleRadians)));
696 exclusive_screen_toast_->set_rotation( 688 exclusive_screen_toast_->set_rotation(
697 gfx::Quaternion(gfx::Vector3dF(1, 0, 0), kWebVrAngleRadians)); 689 gfx::Quaternion(gfx::Vector3dF(1, 0, 0), kWebVrAngleRadians));
698 exclusive_screen_toast_->set_lock_to_fov(true); 690 exclusive_screen_toast_->set_lock_to_fov(true);
699 } 691 }
700 exclusive_screen_toast_->set_visible(toast_visible);
701 if (toast_visible) {
702 exclusive_screen_toast_timer_.Start(
703 FROM_HERE, base::TimeDelta::FromSeconds(kToastTimeoutSeconds), this,
704 &UiSceneManager::OnExclusiveScreenToastTimer);
705 } else {
706 exclusive_screen_toast_timer_.Stop();
707 }
708 toast_state_ = UNCHANGED;
709 }
710
711 void UiSceneManager::OnSecurityWarningTimer() {
712 transient_security_warning_->set_visible(false);
713 }
714
715 void UiSceneManager::ConfigureTransientUrlBar() {
716 bool enabled = web_vr_mode_ && web_vr_autopresentation_expected_;
717 transient_url_bar_->set_visible(enabled);
718 if (enabled) {
719 transient_url_bar_timer_.Start(
720 FROM_HERE, base::TimeDelta::FromSeconds(kTransientUrlBarTimeoutSeconds),
721 this, &UiSceneManager::OnTransientUrlBarTimer);
722 } else {
723 transient_url_bar_timer_.Stop();
724 }
725 }
726
727 void UiSceneManager::OnTransientUrlBarTimer() {
728 transient_url_bar_->set_visible(false);
729 }
730
731 void UiSceneManager::OnExclusiveScreenToastTimer() {
732 exclusive_screen_toast_->set_visible(false);
733 } 692 }
734 693
735 void UiSceneManager::OnBackButtonClicked() { 694 void UiSceneManager::OnBackButtonClicked() {
736 browser_->NavigateBack(); 695 browser_->NavigateBack();
737 } 696 }
738 697
739 void UiSceneManager::OnSecurityIconClickedForTesting() { 698 void UiSceneManager::OnSecurityIconClickedForTesting() {
740 OnSecurityIconClicked(); 699 OnSecurityIconClicked();
741 } 700 }
742 701
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
818 if (fullscreen_) 777 if (fullscreen_)
819 return ColorScheme::kModeFullscreen; 778 return ColorScheme::kModeFullscreen;
820 return ColorScheme::kModeNormal; 779 return ColorScheme::kModeNormal;
821 } 780 }
822 781
823 const ColorScheme& UiSceneManager::color_scheme() const { 782 const ColorScheme& UiSceneManager::color_scheme() const {
824 return ColorScheme::GetColorScheme(mode()); 783 return ColorScheme::GetColorScheme(mode());
825 } 784 }
826 785
827 } // namespace vr_shell 786 } // namespace vr_shell
OLDNEW
« no previous file with comments | « chrome/browser/android/vr_shell/ui_scene_manager.h ('k') | 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