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

Unified Diff: chrome/browser/android/vr_shell/ui_scene_manager.cc

Issue 2957173002: Update toast behavior and apperance according to UX requirement (Closed)
Patch Set: Set size to DMM. Scale will be used to correctly scale the toast 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/android/vr_shell/ui_scene_manager.cc
diff --git a/chrome/browser/android/vr_shell/ui_scene_manager.cc b/chrome/browser/android/vr_shell/ui_scene_manager.cc
index a0507a63a625e4c67440520b15c315b198512d5a..595cf1239913d8679f40618247cb6fcd0eec78dc 100644
--- a/chrome/browser/android/vr_shell/ui_scene_manager.cc
+++ b/chrome/browser/android/vr_shell/ui_scene_manager.cc
@@ -10,6 +10,7 @@
#include "chrome/browser/android/vr_shell/textures/ui_texture.h"
#include "chrome/browser/android/vr_shell/ui_browser_interface.h"
#include "chrome/browser/android/vr_shell/ui_elements/button.h"
+#include "chrome/browser/android/vr_shell/ui_elements/exclusive_screen_toast.h"
#include "chrome/browser/android/vr_shell/ui_elements/exit_prompt.h"
#include "chrome/browser/android/vr_shell/ui_elements/exit_prompt_backplane.h"
#include "chrome/browser/android/vr_shell/ui_elements/loading_indicator.h"
@@ -80,9 +81,14 @@ static constexpr float kTransientUrlBarVerticalOffset =
-0.2 * kTransientUrlBarDistance;
static constexpr int kTransientUrlBarTimeoutSeconds = 6;
-static constexpr float kToastDistance = 1.4;
-static constexpr float kToastWidth = 0.512 * kToastDistance;
-static constexpr float kToastHeight = 0.16 * kToastDistance;
+static constexpr float kWebVrToastDistance = 1.0;
+static constexpr float kFullscreenToastDistance = kFullscreenDistance;
+static constexpr float kToastWidthDMM = 0.512;
+static constexpr float kToastHeightDMM = 0.064;
+static constexpr float kToastOffsetDMM = 0.004;
+// When changing the value here, make sure it doesn't collide with
+// kWarningAngleRadians.
+static constexpr float kWebVrAngleRadians = 9.88 * M_PI / 180.0;
static constexpr int kToastTimeoutSeconds = kTransientUrlBarTimeoutSeconds;
static constexpr float kSplashScreenDistance = 1;
@@ -430,11 +436,9 @@ void UiSceneManager::CreateToasts() {
element->set_debug_id(kExclusiveScreenToast);
element->set_id(AllocateId());
element->set_fill(vr_shell::Fill::NONE);
- element->set_size({kToastWidth, kToastHeight, 1});
- element->set_translation({0, 0, -kToastDistance});
+ element->set_size({kToastWidthDMM, kToastHeightDMM, 1});
amp 2017/06/28 16:47:21 Don't the DMM need to be multiplied by the distanc
bshe 2017/06/28 20:01:58 It is what set_scale does. It is unclear to me if
element->set_visible(false);
element->set_hit_testable(false);
- element->set_lock_to_fov(true);
exclusive_screen_toast_ = element.get();
scene_->AddUiElement(std::move(element));
}
@@ -520,6 +524,30 @@ void UiSceneManager::ConfigureScene() {
gfx::Vector3dF(kCloseButtonWidth, kCloseButtonHeight, 1));
}
+ if (fullscreen_ && !web_vr_mode_) {
cjgrant 2017/06/28 13:55:34 Why not put this block into ConfigureExclusiveScre
bshe 2017/06/28 20:01:58 I am trying to make rebase easier. Your refactor p
cjgrant 2017/06/28 20:24:50 Yes, it does, currently, but when there's this muc
bshe 2017/06/29 01:34:11 Done.
+ // Do not set size again. The size might have been changed by the backing
+ // texture size in UpdateElementSize.
+ exclusive_screen_toast_->set_scale(
+ {kFullscreenToastDistance, kFullscreenToastDistance, 1});
+ exclusive_screen_toast_->set_translation(
+ {0,
+ kFullscreenVerticalOffset + kFullscreenHeight / 2 +
+ (kToastOffsetDMM + kToastHeightDMM) * kFullscreenToastDistance,
+ -kFullscreenToastDistance});
+ exclusive_screen_toast_->set_rotation(
+ gfx::Quaternion(gfx::Vector3dF(1, 0, 0), 0.0));
+ exclusive_screen_toast_->set_lock_to_fov(false);
+ } else if (web_vr_mode_ && web_vr_show_toast_) {
+ exclusive_screen_toast_->set_scale(
+ {kWebVrToastDistance, kWebVrToastDistance, 1});
+ exclusive_screen_toast_->set_translation(
+ gfx::Vector3dF(0, kWebVrToastDistance * sin(kWebVrAngleRadians),
+ -kWebVrToastDistance * cos(kWebVrAngleRadians)));
+ exclusive_screen_toast_->set_rotation(
+ gfx::Quaternion(gfx::Vector3dF(1, 0, 0), kWebVrAngleRadians));
+ exclusive_screen_toast_->set_lock_to_fov(true);
+ }
+
scene_->SetMode(mode());
scene_->SetBackgroundDistance(main_content_->translation().z() *
-kBackgroundDistanceMultiplier);

Powered by Google App Engine
This is Rietveld 408576698