Commit 8b982008 authored by Bret Sepulveda's avatar Bret Sepulveda Committed by Commit Bot

Fix permission bubble icons not updating with theme changes.

This patch changes the request row icons and Flash's learn more button
to color-tracking versions of the basic Views, which fixes the bug. This
also changes the learn more button to track kColorId_DefaultIconColor
instead of kColorId_LabelEnabledColor, but this is more consistent and
matches the request row icon.

Bug: 1125510
Change-Id: I0931622efbf3a4a6e56ad236a281f4201b9d27d5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2409958
Commit-Queue: Bret Sepulveda <bsep@chromium.org>
Reviewed-by: default avatarOlesia Marukhno <olesiamarukhno@google.com>
Cr-Commit-Position: refs/heads/master@{#807034}
parent 6f9f402c
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
#include "ui/views/bubble/bubble_frame_view.h" #include "ui/views/bubble/bubble_frame_view.h"
#include "ui/views/controls/button/image_button.h" #include "ui/views/controls/button/image_button.h"
#include "ui/views/controls/button/image_button_factory.h" #include "ui/views/controls/button/image_button_factory.h"
#include "ui/views/controls/color_tracking_icon_view.h"
#include "ui/views/controls/image_view.h" #include "ui/views/controls/image_view.h"
#include "ui/views/controls/label.h" #include "ui/views/controls/label.h"
#include "ui/views/layout/box_layout.h" #include "ui/views/layout/box_layout.h"
...@@ -94,15 +95,12 @@ PermissionPromptBubbleView::PermissionPromptBubbleView( ...@@ -94,15 +95,12 @@ PermissionPromptBubbleView::PermissionPromptBubbleView(
if (visible_requests_[0]->GetContentSettingsType() == if (visible_requests_[0]->GetContentSettingsType() ==
ContentSettingsType::PLUGINS) { ContentSettingsType::PLUGINS) {
auto learn_more_button = views::CreateVectorImageButton(this); auto* learn_more_button =
SetExtraView(views::CreateVectorImageButtonWithNativeTheme(
this, vector_icons::kHelpOutlineIcon));
learn_more_button->SetFocusForPlatform(); learn_more_button->SetFocusForPlatform();
learn_more_button->SetTooltipText( learn_more_button->SetTooltipText(
l10n_util::GetStringUTF16(IDS_LEARN_MORE)); l10n_util::GetStringUTF16(IDS_LEARN_MORE));
SkColor text_color = GetNativeTheme()->GetSystemColor(
ui::NativeTheme::kColorId_LabelEnabledColor);
views::SetImageFromVectorIcon(learn_more_button.get(),
vector_icons::kHelpOutlineIcon, text_color);
SetExtraView(std::move(learn_more_button));
} }
} }
...@@ -168,14 +166,10 @@ void PermissionPromptBubbleView::AddPermissionRequestLine( ...@@ -168,14 +166,10 @@ void PermissionPromptBubbleView::AddPermissionRequestLine(
DISTANCE_SUBSECTION_HORIZONTAL_INDENT)), DISTANCE_SUBSECTION_HORIZONTAL_INDENT)),
provider->GetDistanceMetric(views::DISTANCE_RELATED_LABEL_HORIZONTAL))); provider->GetDistanceMetric(views::DISTANCE_RELATED_LABEL_HORIZONTAL)));
auto* icon =
line_container->AddChildView(std::make_unique<views::ImageView>());
const gfx::VectorIcon& vector_id = request->GetIconId();
const SkColor icon_color = icon->GetNativeTheme()->GetSystemColor(
ui::NativeTheme::kColorId_DefaultIconColor);
constexpr int kPermissionIconSize = 18; constexpr int kPermissionIconSize = 18;
icon->SetImage( auto* icon = line_container->AddChildView(
gfx::CreateVectorIcon(vector_id, kPermissionIconSize, icon_color)); std::make_unique<views::ColorTrackingIconView>(request->GetIconId(),
kPermissionIconSize));
icon->SetVerticalAlignment(views::ImageView::Alignment::kLeading); icon->SetVerticalAlignment(views::ImageView::Alignment::kLeading);
auto* label = line_container->AddChildView( auto* label = line_container->AddChildView(
......
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