Commit ff259bab authored by Yash Malik's avatar Yash Malik Committed by Commit Bot

Update transient URL bar, toast and in secure warning UX

Bug: None
Change-Id: I4079665b9665fa5be38b0c4138dbd2ee4d2d3b1a
Reviewed-on: https://chromium-review.googlesource.com/577917
Commit-Queue: Biao She <bshe@chromium.org>
Reviewed-by: default avatarYash Malik <ymalik@chromium.org>
Cr-Commit-Position: refs/heads/master@{#488528}
parent 52e8a532
...@@ -87,7 +87,9 @@ gfx::PointF percentToMeters(const gfx::PointF& percent) { ...@@ -87,7 +87,9 @@ gfx::PointF percentToMeters(const gfx::PointF& percent) {
UrlBarTexture::UrlBarTexture( UrlBarTexture::UrlBarTexture(
bool web_vr, bool web_vr,
const base::Callback<void(UiUnsupportedMode)>& failure_callback) const base::Callback<void(UiUnsupportedMode)>& failure_callback)
: has_back_button_(!web_vr), failure_callback_(failure_callback) {} : has_back_button_(!web_vr),
opaque_background_(web_vr),
failure_callback_(failure_callback) {}
UrlBarTexture::~UrlBarTexture() = default; UrlBarTexture::~UrlBarTexture() = default;
...@@ -185,10 +187,15 @@ void UrlBarTexture::Draw(SkCanvas* canvas, const gfx::Size& texture_size) { ...@@ -185,10 +187,15 @@ void UrlBarTexture::Draw(SkCanvas* canvas, const gfx::Size& texture_size) {
round_rect.setRectRadii({0, 0, kHeight, kHeight}, left_corners); round_rect.setRectRadii({0, 0, kHeight, kHeight}, left_corners);
SkPaint paint; SkPaint paint;
paint.setColor(GetLeftCornerColor()); paint.setColor(GetLeftCornerColor());
if (opaque_background_)
paint.setAlpha(255);
canvas->drawRRect(round_rect, paint); canvas->drawRRect(round_rect, paint);
// URL area. // URL area.
paint.setColor(color_scheme().element_background); paint.setColor(color_scheme().element_background);
if (opaque_background_)
paint.setAlpha(255);
SkVector right_corners[4] = {{0, 0}, rounded_corner, rounded_corner, {0, 0}}; SkVector right_corners[4] = {{0, 0}, rounded_corner, rounded_corner, {0, 0}};
round_rect.setRectRadii({kHeight, 0, kWidth, kHeight}, right_corners); round_rect.setRectRadii({kHeight, 0, kWidth, kHeight}, right_corners);
canvas->drawRRect(round_rect, paint); canvas->drawRRect(round_rect, paint);
......
...@@ -81,6 +81,7 @@ class UrlBarTexture : public UiTexture { ...@@ -81,6 +81,7 @@ class UrlBarTexture : public UiTexture {
GURL last_drawn_gurl_; GURL last_drawn_gurl_;
bool has_back_button_ = true; bool has_back_button_ = true;
bool opaque_background_ = false;
security_state::SecurityLevel last_drawn_security_level_; security_state::SecurityLevel last_drawn_security_level_;
base::Callback<void(UiUnsupportedMode)> failure_callback_; base::Callback<void(UiUnsupportedMode)> failure_callback_;
gfx::RectF security_hit_region_ = gfx::RectF(0, 0, 0, 0); gfx::RectF security_hit_region_ = gfx::RectF(0, 0, 0, 0);
......
...@@ -37,12 +37,12 @@ namespace vr { ...@@ -37,12 +37,12 @@ namespace vr {
namespace { namespace {
static constexpr int kWarningTimeoutSeconds = 30; static constexpr int kWarningTimeoutSeconds = 30;
static constexpr float kWarningDistance = 0.7; static constexpr float kWarningDistance = 1.0;
static constexpr float kWarningAngleRadians = 16.3 * M_PI / 180.0; static constexpr float kWarningAngleRadians = 16.3 * M_PI / 180.0;
static constexpr float kPermanentWarningHeight = 0.070f; static constexpr float kPermanentWarningHeightDMM = 0.049f;
static constexpr float kPermanentWarningWidth = 0.224f; static constexpr float kPermanentWarningWidthDMM = 0.1568f;
static constexpr float kTransientWarningHeight = 0.160; static constexpr float kTransientWarningHeightDMM = 0.160;
static constexpr float kTransientWarningWidth = 0.512; static constexpr float kTransientWarningWidthDMM = 0.512;
static constexpr float kExitWarningDistance = 0.6; static constexpr float kExitWarningDistance = 0.6;
static constexpr float kExitWarningHeight = 0.160; static constexpr float kExitWarningHeight = 0.160;
...@@ -80,7 +80,7 @@ static constexpr float kIndicatorGap = 0.05; ...@@ -80,7 +80,7 @@ static constexpr float kIndicatorGap = 0.05;
static constexpr float kIndicatorVerticalOffset = 0.1; static constexpr float kIndicatorVerticalOffset = 0.1;
static constexpr float kIndicatorDistanceOffset = 0.1; static constexpr float kIndicatorDistanceOffset = 0.1;
static constexpr float kTransientUrlBarDistance = 1.4; static constexpr float kTransientUrlBarDistance = 1.0;
static constexpr float kTransientUrlBarWidth = static constexpr float kTransientUrlBarWidth =
kUrlBarWidthDMM * kTransientUrlBarDistance; kUrlBarWidthDMM * kTransientUrlBarDistance;
static constexpr float kTransientUrlBarHeight = static constexpr float kTransientUrlBarHeight =
...@@ -183,7 +183,7 @@ void UiSceneManager::CreateSecurityWarnings() { ...@@ -183,7 +183,7 @@ void UiSceneManager::CreateSecurityWarnings() {
element->set_debug_id(kWebVrPermanentHttpSecurityWarning); element->set_debug_id(kWebVrPermanentHttpSecurityWarning);
element->set_id(AllocateId()); element->set_id(AllocateId());
element->set_fill(vr::Fill::NONE); element->set_fill(vr::Fill::NONE);
element->SetSize(kPermanentWarningWidth, kPermanentWarningHeight); element->SetSize(kPermanentWarningWidthDMM, kPermanentWarningHeightDMM);
element->SetTranslate(0, kWarningDistance * sin(kWarningAngleRadians), element->SetTranslate(0, kWarningDistance * sin(kWarningAngleRadians),
-kWarningDistance * cos(kWarningAngleRadians)); -kWarningDistance * cos(kWarningAngleRadians));
element->SetRotate(1, 0, 0, kWarningAngleRadians); element->SetRotate(1, 0, 0, kWarningAngleRadians);
...@@ -201,8 +201,9 @@ void UiSceneManager::CreateSecurityWarnings() { ...@@ -201,8 +201,9 @@ void UiSceneManager::CreateSecurityWarnings() {
element->set_debug_id(kWebVrTransientHttpSecurityWarning); element->set_debug_id(kWebVrTransientHttpSecurityWarning);
element->set_id(AllocateId()); element->set_id(AllocateId());
element->set_fill(vr::Fill::NONE); element->set_fill(vr::Fill::NONE);
element->SetSize(kTransientWarningWidth, kTransientWarningHeight); element->SetSize(kTransientWarningWidthDMM, kTransientWarningHeightDMM);
element->SetTranslate(0, 0, -kWarningDistance); element->SetTranslate(0, 0, -kWarningDistance);
element->SetScale(kWarningDistance, kWarningDistance, 1);
element->SetVisible(false); element->SetVisible(false);
element->set_hit_testable(false); element->set_hit_testable(false);
element->set_lock_to_fov(true); element->set_lock_to_fov(true);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment