Commit 2e8bc5a3 authored by Ravjit Singh Uppal's avatar Ravjit Singh Uppal Committed by Commit Bot

Fixed - Icons in Web authentication request dialog are red in colour

Bug: 1111350, 1096944
Change-Id: I8749caa24c7ef51c4410b5793777e68bdfbcf889
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2329851
Auto-Submit: Ravjit Singh Uppal <ravjit@chromium.org>
Commit-Queue: Ravjit Singh Uppal <ravjit@chromium.org>
Commit-Queue: Adam Langley <agl@chromium.org>
Reviewed-by: default avatarAdam Langley <agl@chromium.org>
Cr-Commit-Position: refs/heads/master@{#793218}
parent fac8fcd2
......@@ -121,15 +121,13 @@ AuthenticatorRequestSheetView::CreateIllustrationWithOverlays() {
auto color_reference = std::make_unique<views::Label>(
base::string16(), views::style::CONTEXT_DIALOG_TITLE,
views::style::STYLE_PRIMARY);
views::SetImageFromVectorIcon(back_arrow.get(),
vector_icons::kBackArrowIcon,
color_utils::DeriveDefaultIconColor(
color_reference->GetEnabledColor()));
back_arrow->SizeToPreferredSize();
back_arrow->SetX(dialog_insets.left());
back_arrow->SetY(dialog_insets.top());
back_arrow_ = back_arrow.get();
back_arrow_button_ =
image_with_overlays->AddChildView(std::move(back_arrow));
UpdateIconColors();
}
return image_with_overlays;
......@@ -208,6 +206,7 @@ AuthenticatorRequestSheetView::CreateContentsBelowIllustration() {
void AuthenticatorRequestSheetView::OnThemeChanged() {
views::View::OnThemeChanged();
UpdateIconImageFromModel();
UpdateIconColors();
}
void AuthenticatorRequestSheetView::UpdateIconImageFromModel() {
......@@ -219,3 +218,12 @@ void AuthenticatorRequestSheetView::UpdateIconImageFromModel() {
: ImageColorScheme::kLight));
step_illustration_->SetImage(gfx::CreateVectorIcon(icon_description));
}
void AuthenticatorRequestSheetView::UpdateIconColors() {
if (back_arrow_) {
views::SetImageFromVectorIcon(
back_arrow_, vector_icons::kBackArrowIcon,
color_utils::DeriveDefaultIconColor(views::style::GetColor(
*this, views::style::CONTEXT_LABEL, views::style::STYLE_PRIMARY)));
}
}
......@@ -10,6 +10,7 @@
#include "base/macros.h"
#include "base/strings/string16.h"
#include "ui/views/controls/button/button.h"
#include "ui/views/controls/button/image_button.h"
#include "ui/views/view.h"
namespace views {
......@@ -96,11 +97,15 @@ class AuthenticatorRequestSheetView : public views::View,
// Updates the illustration icon shown on the sheet.
void UpdateIconImageFromModel();
// Updates the icon color.
void UpdateIconColors();
// views::View:
void OnThemeChanged() override;
std::unique_ptr<AuthenticatorRequestSheetModel> model_;
views::Button* back_arrow_button_ = nullptr;
views::ImageButton* back_arrow_ = nullptr;
views::View* step_specific_content_ = nullptr;
NonAccessibleImageView* step_illustration_ = nullptr;
views::Label* error_label_ = nullptr;
......
......@@ -43,13 +43,12 @@ std::unique_ptr<WebAuthnHoverButton> CreateHoverButtonForListItem(
views::ButtonListener* listener,
bool is_two_line_item,
ItemType item_type = ItemType::kButton) {
// Derive the icon color from the text color of an enabled label.
auto color_reference_label = std::make_unique<views::Label>(
base::string16(), CONTEXT_BODY_TEXT_SMALL, views::style::STYLE_PRIMARY);
const SkColor icon_color = color_utils::DeriveDefaultIconColor(
color_reference_label->GetEnabledColor());
auto item_image = std::make_unique<views::ImageView>();
// TODO - Icon color should be set and updated in OnThemeChanged
const SkColor icon_color = color_utils::DeriveDefaultIconColor(
views::style::GetColor(*item_image, views::style::CONTEXT_LABEL,
views::style::STYLE_PRIMARY));
if (vector_icon) {
constexpr int kIconSize = 20;
item_image->SetImage(
......
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