Skip to content

Commit

Permalink
Update transient URL bar, toast and in secure warning UX
Browse files Browse the repository at this point in the history
Bug: None
Change-Id: I4079665b9665fa5be38b0c4138dbd2ee4d2d3b1a
Reviewed-on: https://chromium-review.googlesource.com/577917
Commit-Queue: Biao She <bshe@chromium.org>
Reviewed-by: Yash Malik <ymalik@chromium.org>
Cr-Commit-Position: refs/heads/master@{#488528}
  • Loading branch information
Yash Malik authored and Commit Bot committed Jul 21, 2017
1 parent 52e8a53 commit ff259ba
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 9 deletions.
9 changes: 8 additions & 1 deletion chrome/browser/vr/elements/url_bar_texture.cc
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,9 @@ gfx::PointF percentToMeters(const gfx::PointF& percent) {
UrlBarTexture::UrlBarTexture(
bool web_vr,
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;

Expand Down Expand Up @@ -185,10 +187,15 @@ void UrlBarTexture::Draw(SkCanvas* canvas, const gfx::Size& texture_size) {
round_rect.setRectRadii({0, 0, kHeight, kHeight}, left_corners);
SkPaint paint;
paint.setColor(GetLeftCornerColor());
if (opaque_background_)
paint.setAlpha(255);
canvas->drawRRect(round_rect, paint);

// URL area.
paint.setColor(color_scheme().element_background);
if (opaque_background_)
paint.setAlpha(255);

SkVector right_corners[4] = {{0, 0}, rounded_corner, rounded_corner, {0, 0}};
round_rect.setRectRadii({kHeight, 0, kWidth, kHeight}, right_corners);
canvas->drawRRect(round_rect, paint);
Expand Down
1 change: 1 addition & 0 deletions chrome/browser/vr/elements/url_bar_texture.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ class UrlBarTexture : public UiTexture {

GURL last_drawn_gurl_;
bool has_back_button_ = true;
bool opaque_background_ = false;
security_state::SecurityLevel last_drawn_security_level_;
base::Callback<void(UiUnsupportedMode)> failure_callback_;
gfx::RectF security_hit_region_ = gfx::RectF(0, 0, 0, 0);
Expand Down
17 changes: 9 additions & 8 deletions chrome/browser/vr/ui_scene_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@ namespace vr {
namespace {

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 kPermanentWarningHeight = 0.070f;
static constexpr float kPermanentWarningWidth = 0.224f;
static constexpr float kTransientWarningHeight = 0.160;
static constexpr float kTransientWarningWidth = 0.512;
static constexpr float kPermanentWarningHeightDMM = 0.049f;
static constexpr float kPermanentWarningWidthDMM = 0.1568f;
static constexpr float kTransientWarningHeightDMM = 0.160;
static constexpr float kTransientWarningWidthDMM = 0.512;

static constexpr float kExitWarningDistance = 0.6;
static constexpr float kExitWarningHeight = 0.160;
Expand Down Expand Up @@ -80,7 +80,7 @@ static constexpr float kIndicatorGap = 0.05;
static constexpr float kIndicatorVerticalOffset = 0.1;
static constexpr float kIndicatorDistanceOffset = 0.1;

static constexpr float kTransientUrlBarDistance = 1.4;
static constexpr float kTransientUrlBarDistance = 1.0;
static constexpr float kTransientUrlBarWidth =
kUrlBarWidthDMM * kTransientUrlBarDistance;
static constexpr float kTransientUrlBarHeight =
Expand Down Expand Up @@ -183,7 +183,7 @@ void UiSceneManager::CreateSecurityWarnings() {
element->set_debug_id(kWebVrPermanentHttpSecurityWarning);
element->set_id(AllocateId());
element->set_fill(vr::Fill::NONE);
element->SetSize(kPermanentWarningWidth, kPermanentWarningHeight);
element->SetSize(kPermanentWarningWidthDMM, kPermanentWarningHeightDMM);
element->SetTranslate(0, kWarningDistance * sin(kWarningAngleRadians),
-kWarningDistance * cos(kWarningAngleRadians));
element->SetRotate(1, 0, 0, kWarningAngleRadians);
Expand All @@ -201,8 +201,9 @@ void UiSceneManager::CreateSecurityWarnings() {
element->set_debug_id(kWebVrTransientHttpSecurityWarning);
element->set_id(AllocateId());
element->set_fill(vr::Fill::NONE);
element->SetSize(kTransientWarningWidth, kTransientWarningHeight);
element->SetSize(kTransientWarningWidthDMM, kTransientWarningHeightDMM);
element->SetTranslate(0, 0, -kWarningDistance);
element->SetScale(kWarningDistance, kWarningDistance, 1);
element->SetVisible(false);
element->set_hit_testable(false);
element->set_lock_to_fov(true);
Expand Down

0 comments on commit ff259ba

Please sign in to comment.