Commit 57cfd50f authored by Thomas Lukaszewicz's avatar Thomas Lukaszewicz Committed by Commit Bot

Patched LocationIconView to properly update label colors.

Added a label color update method to IconLabelBubbleView that is
called OnThemeChanged() and also when LocationIconView's Update()
method is called.

This is necessary as the LocationIconView may switch the foreground
color to red in the presence of a security context change, not
necessarily only during a theme change event.

Bug: 1042090
Change-Id: Ib0004bd519abfbf3ab27102b6304e9a9f75ec4e3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2002855
Commit-Queue: Thomas Lukaszewicz <tluk@chromium.org>
Reviewed-by: default avatarPeter Kasting <pkasting@chromium.org>
Cr-Commit-Position: refs/heads/master@{#732111}
parent bdbc54bd
......@@ -195,6 +195,11 @@ SkColor IconLabelBubbleView::GetForegroundColor() const {
return delegate_->GetIconLabelBubbleSurroundingForegroundColor();
}
void IconLabelBubbleView::UpdateLabelColors() {
SetEnabledTextColors(GetForegroundColor());
label()->SetBackgroundColor(delegate_->GetIconLabelBubbleBackgroundColor());
}
bool IconLabelBubbleView::ShouldShowSeparator() const {
return ShouldShowLabel();
}
......@@ -304,9 +309,7 @@ void IconLabelBubbleView::OnThemeChanged() {
// under certain conditions. We don't want that, so unset the background.
label()->SetBackground(nullptr);
SetEnabledTextColors(GetForegroundColor());
label()->SetBackgroundColor(delegate_->GetIconLabelBubbleBackgroundColor());
SchedulePaint();
UpdateLabelColors();
}
std::unique_ptr<views::InkDrop> IconLabelBubbleView::CreateInkDrop() {
......
......@@ -101,6 +101,9 @@ class IconLabelBubbleView : public views::InkDropObserver,
// Gets the color for displaying text and/or icons.
virtual SkColor GetForegroundColor() const;
// Sets the label text and background colors.
void UpdateLabelColors();
// Returns true when the separator should be visible.
virtual bool ShouldShowSeparator() const;
......
......@@ -217,6 +217,10 @@ void LocationIconView::Update(bool suppress_animations) {
UpdateTextVisibility(suppress_animations);
UpdateIcon();
// The label text color may have changed in response to changes in security
// level.
UpdateLabelColors();
bool is_editing_or_empty = delegate_->IsEditingOrEmpty();
// The tooltip should be shown if we are not editing or empty.
SetTooltipText(is_editing_or_empty
......
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