Commit f079e739 authored by elawrence's avatar elawrence Committed by Commit bot

Update scheme text color in Omnibox only in non-default Security Levels

A recent refactoring dropped a test from the conditional which caused
the Omnibox to paint the scheme text in black in cases where it should
not. Restore the conditional so that the Omnibox only colors the scheme
text in the correct scenarios.

BUG=699222
TEST=Type about:blank in the omnibox and hit enter. "about:" should be
grey and "blank" should be black

Review-Url: https://codereview.chromium.org/2734783007
Cr-Commit-Position: refs/heads/master@{#455783}
parent a35b40c3
......@@ -570,11 +570,16 @@ void OmniboxViewViews::SetEmphasis(bool emphasize, const gfx::Range& range) {
void OmniboxViewViews::UpdateSchemeStyle(const gfx::Range& range) {
DCHECK(range.IsValid());
const SkColor security_color =
location_bar_view_->GetSecureTextColor(security_level_);
const bool strike = security_level_ == security_state::DANGEROUS;
ApplyColor(security_color, range);
ApplyStyle(gfx::DIAGONAL_STRIKE, strike, range);
// Only SECURE and DANGEROUS levels (pages served over HTTPS or flagged by
// SafeBrowsing) get a special scheme color treatment. If the security level
// is NONE or HTTP_SHOW_WARNING, we do not override the text style previously
// applied to the scheme text range by SetEmphasis().
if (security_level_ == security_state::NONE ||
security_level_ == security_state::HTTP_SHOW_WARNING)
return;
ApplyColor(location_bar_view_->GetSecureTextColor(security_level_), range);
if (security_level_ == security_state::DANGEROUS)
ApplyStyle(gfx::DIAGONAL_STRIKE, true, range);
}
void OmniboxViewViews::EmphasizeURLComponents() {
......
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