Commit 6bf91042 authored by Emily Stark's avatar Emily Stark Committed by Commit Bot

Views: Do not animate HTTP_SHOW_WARNING to DANGEROUS transition

This transition (which is currently only possible with an experiment enabled)
can look messy/confusing when animated, so do not animate it.

Bug: 807075
Change-Id: Ib7bda303958739cd4840dbc57910c1c850c5e97a
Reviewed-on: https://chromium-review.googlesource.com/891630Reviewed-by: default avatarPeter Kasting <pkasting@chromium.org>
Commit-Queue: Emily Stark <estark@chromium.org>
Cr-Commit-Position: refs/heads/master@{#533312}
parent f1c8e469
......@@ -618,6 +618,7 @@ void LocationBarView::Update(const WebContents* contents) {
ShouldShowLocationIconText(),
!contents && ShouldAnimateLocationIconTextVisibilityChange());
OnChanged(); // NOTE: Calls Layout().
last_update_security_level_ = GetToolbarModel()->GetSecurityLevel(false);
}
void LocationBarView::ResetTabState(WebContents* contents) {
......@@ -877,10 +878,13 @@ bool LocationBarView::ShouldShowLocationIconText() const {
}
bool LocationBarView::ShouldAnimateLocationIconTextVisibilityChange() const {
// Text for extension URLs should not be animated (their security level is
// SecurityLevel::NONE).
using SecurityLevel = security_state::SecurityLevel;
SecurityLevel level = GetToolbarModel()->GetSecurityLevel(false);
// Do not animate transitions from HTTP_SHOW_WARNING to DANGEROUS, since the
// transition can look confusing/messy.
if (level == SecurityLevel::DANGEROUS &&
last_update_security_level_ == SecurityLevel::HTTP_SHOW_WARNING)
return false;
return level == SecurityLevel::DANGEROUS ||
level == SecurityLevel::HTTP_SHOW_WARNING;
}
......
......@@ -437,6 +437,11 @@ class LocationBarView : public LocationBar,
// A list of all bubble descendants ordered by focus.
std::vector<BubbleIconView*> bubble_icons_;
// The security level when the location bar was last updated. Used to decide
// whether to animate security level transitions.
security_state::SecurityLevel last_update_security_level_ =
security_state::NONE;
DISALLOW_COPY_AND_ASSIGN(LocationBarView);
};
......
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