Commit 93f98384 authored by Olesia Marukhno's avatar Olesia Marukhno Committed by Commit Bot

[omnibox] Update omnibox button row colors to match omnibox colors

Instead of using dark/light theme coloring from MdTextButton, use
colors of the omnibox. We need to do this because omnibox follows NTP
"Customize" color picker.

Bug: 1133851
Change-Id: I2e9bb636f6a724ee5b9ccd1887cf31bda32a70aa
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2442537Reviewed-by: default avatarTommy Li <tommycli@chromium.org>
Reviewed-by: default avatarBret Sepulveda <bsep@chromium.org>
Commit-Queue: Olesia Marukhno <olesiamarukhno@google.com>
Cr-Commit-Position: refs/heads/master@{#815555}
parent b113d7cd
......@@ -29,6 +29,7 @@
#include "ui/views/controls/focus_ring.h"
#include "ui/views/controls/highlight_path_generator.h"
#include "ui/views/layout/flex_layout.h"
#include "ui/views/painter.h"
#include "ui/views/view_class_properties.h"
class OmniboxSuggestionRowButton : public views::MdTextButton {
......@@ -81,12 +82,30 @@ class OmniboxSuggestionRowButton : public views::MdTextButton {
void OnThemeChanged() override {
MdTextButton::OnThemeChanged();
SkColor color =
// We can't use colors from NativeTheme as the omnibox theme might be
// different (for example, if the NTP colors are customized).
SkColor icon_color =
GetOmniboxColor(GetThemeProvider(), OmniboxPart::RESULTS_ICON,
OmniboxPartState::NORMAL);
SetImage(views::Button::STATE_NORMAL,
gfx::CreateVectorIcon(
icon_, GetLayoutConstant(LOCATION_BAR_ICON_SIZE), color));
icon_, GetLayoutConstant(LOCATION_BAR_ICON_SIZE), icon_color));
SetEnabledTextColors(GetOmniboxColor(GetThemeProvider(),
OmniboxPart::RESULTS_TEXT_DEFAULT,
OmniboxPartState::NORMAL));
}
void UpdateBackgroundColor() override {
// See comment in OnThemeChanged.
SkColor stroke_color =
GetOmniboxColor(GetThemeProvider(), OmniboxPart::RESULTS_BACKGROUND,
OmniboxPartState::SELECTED);
SkColor bg_color =
GetOmniboxColor(GetThemeProvider(), OmniboxPart::RESULTS_BACKGROUND,
OmniboxPartState::NORMAL);
SetBackground(CreateBackgroundFromPainter(
views::Painter::CreateRoundRectWith1PxBorderPainter(
bg_color, stroke_color, GetCornerRadius())));
}
void GetAccessibleNodeData(ui::AXNodeData* node_data) override {
......
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