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

Unified Diff: chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm

Issue 2700243002: [Mac] Test for Security State Bubble Decoration (Closed)
Patch Set: Nits Created 3 years, 10 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/ui/cocoa/location_bar/location_bar_view_mac.mm
diff --git a/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm b/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm
index 5c4a91e5b43a8b01b66e2755aa1c50d1582fbc0f..4a45219d612b11dd43086288482490b346f13f17 100644
--- a/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm
+++ b/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm
@@ -869,7 +869,6 @@ bool LocationBarViewMac::UpdateZoomDecoration(bool default_zoom_changed) {
IsLocationBarDark());
}
-// TODO(spqchan): Add tests for the security state decoration.
void LocationBarViewMac::UpdateSecurityState(bool tab_changed) {
using SecurityLevel = security_state::SecurityLevel;
SecurityLevel new_security_level = GetToolbarModel()->GetSecurityLevel(false);
@@ -884,18 +883,24 @@ void LocationBarViewMac::UpdateSecurityState(bool tab_changed) {
if ((ShouldShowSecurityState() || ShouldShowExtensionBubble() ||
ShouldShowChromeBubble()) &&
is_width_available_for_security_verbose_) {
- bool is_secure_to_secure = IsSecureConnection(new_security_level) &&
- IsSecureConnection(security_level_);
- bool is_new_security_level =
- security_level_ != new_security_level && !is_secure_to_secure;
- if (!tab_changed && security_state_bubble_decoration_->HasAnimatedOut())
- security_state_bubble_decoration_->AnimateIn(false);
- else if (tab_changed || !CanAnimateSecurityLevel(new_security_level))
+ if (tab_changed) {
security_state_bubble_decoration_->ShowWithoutAnimation();
- else if (is_new_security_level)
- security_state_bubble_decoration_->AnimateIn();
+ } else {
+ bool is_secure_to_secure = IsSecureConnection(new_security_level) &&
+ IsSecureConnection(security_level_);
+ bool is_new_security_level =
+ security_level_ != new_security_level && !is_secure_to_secure;
+ if (!is_new_security_level &&
+ security_state_bubble_decoration_->HasAnimatedOut()) {
+ security_state_bubble_decoration_->AnimateIn(false);
+ } else if (!CanAnimateSecurityLevel(new_security_level)) {
+ security_state_bubble_decoration_->ShowWithoutAnimation();
+ } else if (is_new_security_level) {
+ security_state_bubble_decoration_->AnimateIn();
+ }
+ }
} else if (!is_width_available_for_security_verbose_ ||
- CanAnimateSecurityLevel(security_level_)) {
+ (!tab_changed && CanAnimateSecurityLevel(security_level_))) {
security_state_bubble_decoration_->AnimateOut();
}
@@ -905,8 +910,8 @@ void LocationBarViewMac::UpdateSecurityState(bool tab_changed) {
bool LocationBarViewMac::CanAnimateSecurityLevel(
security_state::SecurityLevel level) const {
return !GetOmniboxView()->IsEditingOrEmpty() &&
- (security_level_ == security_state::SecurityLevel::DANGEROUS ||
- security_level_ == security_state::SecurityLevel::HTTP_SHOW_WARNING);
+ (level == security_state::DANGEROUS ||
+ level == security_state::HTTP_SHOW_WARNING);
}
bool LocationBarViewMac::IsSecureConnection(

Powered by Google App Engine
This is Rietveld 408576698