Prevent default construction of VectorIcon.
This avoids obscure bugs when VectorIcons are stored or compared based on address and the default (empty) icon is involved. Instead add a getter that returns a ref to a singleton empty icon. This obviates the need for kNoneIcon, which can't be made to work with these changes (easily, anyway), so that's replaced also. Bug: 364987728 Low-Coverage-Reason: LARGE_SCALE_CHANGE no functional effect Change-Id: Ia93324b46e7fd1e28f4f1ad28168ecae915f9151 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6133053 Reviewed-by: Evan Stade <estade@chromium.org> Owners-Override: David Yeung <dayeung@google.com> Commit-Queue: Peter Kasting <pkasting@chromium.org> Reviewed-by: David Yeung <dayeung@chromium.org> Cr-Commit-Position: refs/heads/main@{#1401567}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
f806050b2b
commit
76462a6abb
ash
public
cpp
scalable_iph
style
system
audio
bluetooth
holding_space
hotspot
network
notification_center
palette
toast
unified
video_conference
user_education
wm
splitview
chrome/browser
ash
app_list
child_accounts
on_device_controls
crostini
notifications
policy
remote_commands
scalable_iph
tpm
u2f
usb
nearby_sharing
ui
ash
content_settings
views
autofill
content_setting_bubble_contents.ccextensions
location_bar
page_action
page_info
permissions
chip
embedded_permission_prompt_base_view.ccmidi_permissions_flow_interactive_uitest.ccpermission_indicators_interactive_uitest.ccprofiles
sharing
sharing_hub
tabs
toolbar
webui
ash
notification_tester
components
infobars
omnibox
browser
permissions
ios/chrome/browser/lens_overlay/coordinator
remoting/host/it2me
ui
gfx
message_center
public
views
controls
@ -20,7 +20,7 @@
|
||||
#include "testing/gtest/include/gtest/gtest.h"
|
||||
#include "third_party/skia/include/core/SkColor.h"
|
||||
#include "ui/chromeos/styles/cros_tokens_color_mappings.h"
|
||||
#include "ui/gfx/paint_vector_icon.h"
|
||||
#include "ui/gfx/vector_icon_types.h"
|
||||
|
||||
namespace ash {
|
||||
|
||||
@ -146,7 +146,8 @@ TEST_P(HoldingSpaceItemTest, InProgressCommands) {
|
||||
// It should be possible to update commands to a new value.
|
||||
std::vector<HoldingSpaceItem::InProgressCommand> in_progress_commands;
|
||||
in_progress_commands.push_back(HoldingSpaceItem::InProgressCommand(
|
||||
HoldingSpaceCommandId::kCancelItem, /*label_id=*/-1, &gfx::kNoneIcon,
|
||||
HoldingSpaceCommandId::kCancelItem, /*label_id=*/-1,
|
||||
&gfx::VectorIcon::EmptyIcon(),
|
||||
/*handler=*/base::DoNothing()));
|
||||
EXPECT_TRUE(holding_space_item->SetInProgressCommands(in_progress_commands));
|
||||
EXPECT_EQ(holding_space_item->in_progress_commands(), in_progress_commands);
|
||||
|
@ -27,7 +27,7 @@
|
||||
#include "testing/gtest/include/gtest/gtest.h"
|
||||
#include "ui/chromeos/styles/cros_tokens_color_mappings.h"
|
||||
#include "ui/color/color_id.h"
|
||||
#include "ui/gfx/paint_vector_icon.h"
|
||||
#include "ui/gfx/vector_icon_types.h"
|
||||
|
||||
namespace ash {
|
||||
namespace {
|
||||
@ -41,7 +41,7 @@ using testing::VariantWith;
|
||||
HoldingSpaceItem::InProgressCommand CreateInProgressCommand(
|
||||
HoldingSpaceCommandId command_id) {
|
||||
return HoldingSpaceItem::InProgressCommand(command_id, /*label_id=*/-1,
|
||||
&gfx::kNoneIcon,
|
||||
&gfx::VectorIcon::EmptyIcon(),
|
||||
/*handler=*/base::DoNothing());
|
||||
}
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
#include "base/functional/callback_helpers.h"
|
||||
#include "base/memory/raw_ptr_exclusion.h"
|
||||
#include "base/time/time.h"
|
||||
#include "ui/gfx/paint_vector_icon.h"
|
||||
#include "ui/gfx/vector_icon_types.h"
|
||||
|
||||
namespace ash {
|
||||
|
||||
@ -75,8 +75,10 @@ struct ASH_PUBLIC_EXPORT ToastData {
|
||||
std::u16string button_text;
|
||||
// RAW_PTR_EXCLUSION: Never allocated by PartitionAlloc (always points to a
|
||||
// global), so there is no benefit to using a raw_ptr, only cost.
|
||||
RAW_PTR_EXCLUSION const gfx::VectorIcon* button_icon = &gfx::kNoneIcon;
|
||||
RAW_PTR_EXCLUSION const gfx::VectorIcon* leading_icon = &gfx::kNoneIcon;
|
||||
RAW_PTR_EXCLUSION const gfx::VectorIcon* button_icon =
|
||||
&gfx::VectorIcon::EmptyIcon();
|
||||
RAW_PTR_EXCLUSION const gfx::VectorIcon* leading_icon =
|
||||
&gfx::VectorIcon::EmptyIcon();
|
||||
base::OnceClosure expired_callback;
|
||||
base::TimeTicks time_created;
|
||||
base::TimeTicks time_start_showing;
|
||||
|
@ -13,6 +13,7 @@
|
||||
#include "ash/public/cpp/ash_public_export.h"
|
||||
#include "base/memory/raw_ptr.h"
|
||||
#include "base/memory/scoped_refptr.h"
|
||||
#include "ui/gfx/vector_icon_types.h"
|
||||
#include "ui/message_center/public/cpp/notification.h"
|
||||
#include "ui/message_center/public/cpp/notification_types.h"
|
||||
#include "ui/message_center/public/cpp/notifier_id.h"
|
||||
@ -232,7 +233,7 @@ class ASH_PUBLIC_EXPORT SystemNotificationBuilder {
|
||||
scoped_refptr<message_center::NotificationDelegate> delegate);
|
||||
|
||||
// Set the small image shown in the notification.
|
||||
// Default: kNoneIcon
|
||||
// Default: VectorIcon::EmptyIcon()
|
||||
SystemNotificationBuilder& SetSmallImage(const gfx::VectorIcon& small_image);
|
||||
|
||||
// Set additional optional fields.
|
||||
@ -279,7 +280,7 @@ class ASH_PUBLIC_EXPORT SystemNotificationBuilder {
|
||||
std::optional<message_center::NotifierId> notifier_id_;
|
||||
NotificationCatalogName catalog_name_ = NotificationCatalogName::kNone;
|
||||
scoped_refptr<message_center::NotificationDelegate> delegate_ = nullptr;
|
||||
raw_ptr<const gfx::VectorIcon> small_image_ = &gfx::kNoneIcon;
|
||||
raw_ptr<const gfx::VectorIcon> small_image_ = &gfx::VectorIcon::EmptyIcon();
|
||||
message_center::RichNotificationData optional_fields_;
|
||||
message_center::SystemNotificationWarningLevel warning_level_ =
|
||||
message_center::SystemNotificationWarningLevel::NORMAL;
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include "base/functional/callback_helpers.h"
|
||||
#include "components/vector_icons/vector_icons.h"
|
||||
#include "testing/gtest/include/gtest/gtest.h"
|
||||
#include "ui/gfx/vector_icon_types.h"
|
||||
|
||||
namespace ash {
|
||||
|
||||
@ -24,7 +25,7 @@ TEST(SystemNotificationBuilderTest, TrivialSetters) {
|
||||
EXPECT_EQ(notification.display_source(), u"");
|
||||
EXPECT_FALSE(notification.origin_url().is_valid());
|
||||
EXPECT_EQ(notification.delegate(), nullptr);
|
||||
EXPECT_EQ(¬ification.vector_small_image(), &gfx::kNoneIcon);
|
||||
EXPECT_EQ(¬ification.vector_small_image(), &gfx::VectorIcon::EmptyIcon());
|
||||
EXPECT_EQ(notification.rich_notification_data().progress, 0);
|
||||
EXPECT_EQ(notification.system_notification_warning_level(),
|
||||
message_center::SystemNotificationWarningLevel::NORMAL);
|
||||
|
@ -10,10 +10,6 @@
|
||||
|
||||
namespace ash {
|
||||
|
||||
namespace {
|
||||
const gfx::VectorIcon kEmptyIcon;
|
||||
} // namespace
|
||||
|
||||
TestNearbyShareDelegate::TestNearbyShareDelegate() = default;
|
||||
|
||||
TestNearbyShareDelegate::~TestNearbyShareDelegate() = default;
|
||||
@ -53,7 +49,7 @@ void TestNearbyShareDelegate::DisableHighVisibility() {
|
||||
void TestNearbyShareDelegate::ShowNearbyShareSettings() const {}
|
||||
|
||||
const gfx::VectorIcon& TestNearbyShareDelegate::GetIcon(bool on_icon) const {
|
||||
return kEmptyIcon;
|
||||
return gfx::VectorIcon::EmptyIcon();
|
||||
}
|
||||
|
||||
std::u16string TestNearbyShareDelegate::GetPlaceholderFeatureName() const {
|
||||
|
@ -9,7 +9,7 @@
|
||||
#include "ash/test/pixel/ash_pixel_test_init_params.h"
|
||||
#include "base/test/scoped_feature_list.h"
|
||||
#include "chromeos/constants/chromeos_features.h"
|
||||
#include "ui/gfx/paint_vector_icon.h"
|
||||
#include "ui/gfx/vector_icon_types.h"
|
||||
#include "ui/message_center/message_center.h"
|
||||
#include "ui/message_center/public/cpp/notification.h"
|
||||
#include "ui/message_center/public/cpp/notifier_id.h"
|
||||
@ -66,7 +66,7 @@ TEST_P(ScalableIphPixelTest, NotificationNoBodyText) {
|
||||
u"NotificationTitle", /*message=*/u"", u"NotificationSourceName",
|
||||
GURL(), message_center::NotifierId(),
|
||||
message_center::RichNotificationData(),
|
||||
/*delegate=*/nullptr, gfx::kNoneIcon,
|
||||
/*delegate=*/nullptr, gfx::VectorIcon::EmptyIcon(),
|
||||
message_center::SystemNotificationWarningLevel::NORMAL);
|
||||
|
||||
message_center::MessageCenter* message_center =
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include "ui/compositor/animation_throughput_reporter.h"
|
||||
#include "ui/compositor/layer.h"
|
||||
#include "ui/gfx/animation/tween.h"
|
||||
#include "ui/gfx/paint_vector_icon.h"
|
||||
#include "ui/views/accessibility/view_accessibility.h"
|
||||
#include "ui/views/animation/animation_builder.h"
|
||||
#include "ui/views/controls/highlight_path_generator.h"
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include "ui/compositor/layer.h"
|
||||
#include "ui/gfx/geometry/rounded_corners_f.h"
|
||||
#include "ui/gfx/geometry/rrect_f.h"
|
||||
#include "ui/gfx/vector_icon_types.h"
|
||||
#include "ui/views/controls/focus_ring.h"
|
||||
#include "ui/views/controls/highlight_path_generator.h"
|
||||
#include "ui/views/controls/label.h"
|
||||
@ -132,7 +133,8 @@ LabeledSliderView::LabeledSliderView(TrayDetailedView* detailed_view,
|
||||
|
||||
// Creates and formats the device name view.
|
||||
device_name_view_ = detailed_view->AddScrollListCheckableItem(
|
||||
this, gfx::kNoneIcon, GetAudioDeviceName(device), device.active);
|
||||
this, gfx::VectorIcon::EmptyIcon(), GetAudioDeviceName(device),
|
||||
device.active);
|
||||
ConfigureDeviceNameView(device);
|
||||
|
||||
// Puts `unified_slider_view_` beneath `device_name_view_`.
|
||||
|
@ -9,7 +9,7 @@
|
||||
#include "ash/system/bluetooth/bluetooth_device_list_item_view.h"
|
||||
#include "base/check.h"
|
||||
#include "base/memory/raw_ptr.h"
|
||||
#include "ui/gfx/paint_vector_icon.h"
|
||||
#include "ui/gfx/vector_icon_types.h"
|
||||
#include "ui/views/view.h"
|
||||
|
||||
namespace ash {
|
||||
@ -132,7 +132,7 @@ BluetoothDeviceListControllerImpl::CreateSubHeaderIfMissingAndReorder(
|
||||
size_t index) {
|
||||
if (!sub_header) {
|
||||
sub_header = bluetooth_detailed_view_->AddDeviceListSubHeader(
|
||||
gfx::kNoneIcon, text_id);
|
||||
gfx::VectorIcon::EmptyIcon(), text_id);
|
||||
}
|
||||
bluetooth_detailed_view_->device_list()->ReorderChildView(sub_header, index);
|
||||
return sub_header;
|
||||
|
@ -72,6 +72,7 @@
|
||||
#include "ui/gfx/geometry/transform_util.h"
|
||||
#include "ui/gfx/paint_vector_icon.h"
|
||||
#include "ui/gfx/skia_util.h"
|
||||
#include "ui/gfx/vector_icon_types.h"
|
||||
#include "ui/views/accessibility/view_accessibility.h"
|
||||
#include "ui/views/background.h"
|
||||
#include "ui/views/controls/image_view.h"
|
||||
@ -104,7 +105,7 @@ HoldingSpaceItem::InProgressCommand CreateInProgressCommand(
|
||||
int label_id,
|
||||
HoldingSpaceItem::InProgressCommand::Handler handler = base::DoNothing()) {
|
||||
return HoldingSpaceItem::InProgressCommand(
|
||||
command_id, label_id, &gfx::kNoneIcon, std::move(handler));
|
||||
command_id, label_id, &gfx::VectorIcon::EmptyIcon(), std::move(handler));
|
||||
}
|
||||
|
||||
// A wrapper around `views::View::GetVisible()` with a null check for `view`.
|
||||
|
@ -12,6 +12,7 @@
|
||||
#include "ash/strings/grit/ash_strings.h"
|
||||
#include "base/strings/utf_string_conversions.h"
|
||||
#include "ui/base/l10n/l10n_util.h"
|
||||
#include "ui/gfx/vector_icon_types.h"
|
||||
#include "ui/message_center/message_center.h"
|
||||
#include "ui/message_center/public/cpp/message_center_constants.h"
|
||||
|
||||
@ -288,7 +289,7 @@ HotspotNotifier::CreateNotification(
|
||||
const bool use_hotspot_icon,
|
||||
scoped_refptr<message_center::NotificationDelegate> delegate) {
|
||||
const gfx::VectorIcon& icon =
|
||||
use_hotspot_icon ? kHotspotOnIcon : gfx::kNoneIcon;
|
||||
use_hotspot_icon ? kHotspotOnIcon : gfx::VectorIcon::EmptyIcon();
|
||||
std::unique_ptr<message_center::Notification> notification =
|
||||
ash::CreateSystemNotificationPtr(
|
||||
message_center::NOTIFICATION_TYPE_SIMPLE, notification_id, title_id,
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include "components/onc/onc_constants.h"
|
||||
#include "components/session_manager/session_manager_types.h"
|
||||
#include "ui/base/l10n/l10n_util.h"
|
||||
#include "ui/gfx/vector_icon_types.h"
|
||||
#include "ui/message_center/message_center.h"
|
||||
#include "ui/message_center/public/cpp/message_center_constants.h"
|
||||
|
||||
@ -194,7 +195,7 @@ void ManagedSimLockNotifier::ShowNotification() {
|
||||
message_center::RichNotificationData(),
|
||||
base::MakeRefCounted<message_center::ThunkNotificationDelegate>(
|
||||
weak_ptr_factory_.GetWeakPtr()),
|
||||
/*small_image=*/gfx::VectorIcon(),
|
||||
/*small_image=*/gfx::VectorIcon::EmptyIcon(),
|
||||
message_center::SystemNotificationWarningLevel::WARNING);
|
||||
notification->set_host_view_element_id(
|
||||
kCellularManagedSimLockNotificationElementId);
|
||||
|
@ -389,7 +389,7 @@ TEST_F(NotificationGroupingControllerTest, ParentNotificationMetadata) {
|
||||
auto* message_center = MessageCenter::Get();
|
||||
std::string id0, id1, id2;
|
||||
const GURL url(u"http://test-url.com/");
|
||||
const auto icon = gfx::VectorIcon();
|
||||
const auto& icon = gfx::VectorIcon::EmptyIcon();
|
||||
const auto small_image = gfx::Image();
|
||||
const std::u16string display_source0 = u"test_display_source0";
|
||||
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include "ui/compositor/layer_animation_sequence.h"
|
||||
#include "ui/compositor/layer_animator.h"
|
||||
#include "ui/gfx/interpolated_transform.h"
|
||||
#include "ui/gfx/paint_vector_icon.h"
|
||||
#include "ui/message_center/message_center.h"
|
||||
#include "ui/message_center/vector_icons.h"
|
||||
#include "ui/views/accessibility/view_accessibility.h"
|
||||
|
@ -46,6 +46,7 @@
|
||||
#include "ui/gfx/geometry/insets.h"
|
||||
#include "ui/gfx/geometry/size.h"
|
||||
#include "ui/gfx/image/image.h"
|
||||
#include "ui/gfx/paint_vector_icon.h"
|
||||
#include "ui/gfx/skia_paint_util.h"
|
||||
#include "ui/message_center/message_center.h"
|
||||
#include "ui/message_center/public/cpp/message_center_constants.h"
|
||||
|
@ -15,7 +15,7 @@
|
||||
#include "ash/system/palette/tools/laser_pointer_mode.h"
|
||||
#include "ash/system/palette/tools/magnifier_mode.h"
|
||||
#include "ash/system/palette/tools/marker_mode.h"
|
||||
#include "ui/gfx/paint_vector_icon.h"
|
||||
#include "ui/gfx/vector_icon_types.h"
|
||||
|
||||
namespace ash {
|
||||
|
||||
@ -43,7 +43,7 @@ void PaletteTool::OnDisable() {
|
||||
}
|
||||
|
||||
const gfx::VectorIcon& PaletteTool::GetActiveTrayIcon() const {
|
||||
return gfx::kNoneIcon;
|
||||
return gfx::VectorIcon::EmptyIcon();
|
||||
}
|
||||
|
||||
} // namespace ash
|
||||
|
@ -9,7 +9,7 @@
|
||||
#include "base/memory/raw_ptr.h"
|
||||
#include "ui/base/interaction/element_identifier.h"
|
||||
#include "ui/base/metadata/metadata_header_macros.h"
|
||||
#include "ui/gfx/paint_vector_icon.h"
|
||||
#include "ui/gfx/vector_icon_types.h"
|
||||
#include "ui/views/layout/flex_layout_view.h"
|
||||
|
||||
namespace views {
|
||||
@ -38,12 +38,13 @@ class ASH_EXPORT SystemToastView : public views::FlexLayoutView {
|
||||
kIconButton,
|
||||
};
|
||||
|
||||
SystemToastView(const std::u16string& text,
|
||||
ButtonType button_type = ButtonType::kNone,
|
||||
const std::u16string& button_text = std::u16string(),
|
||||
const gfx::VectorIcon* button_icon = &gfx::kNoneIcon,
|
||||
base::RepeatingClosure button_callback = base::DoNothing(),
|
||||
const gfx::VectorIcon* leading_icon = &gfx::kNoneIcon);
|
||||
SystemToastView(
|
||||
const std::u16string& text,
|
||||
ButtonType button_type = ButtonType::kNone,
|
||||
const std::u16string& button_text = std::u16string(),
|
||||
const gfx::VectorIcon* button_icon = &gfx::VectorIcon::EmptyIcon(),
|
||||
base::RepeatingClosure button_callback = base::DoNothing(),
|
||||
const gfx::VectorIcon* leading_icon = &gfx::VectorIcon::EmptyIcon());
|
||||
SystemToastView(const SystemToastView&) = delete;
|
||||
SystemToastView& operator=(const SystemToastView&) = delete;
|
||||
~SystemToastView() override;
|
||||
|
@ -12,7 +12,7 @@
|
||||
#include "ash/test/pixel/ash_pixel_test_init_params.h"
|
||||
#include "ui/chromeos/styles/cros_tokens_color_mappings.h"
|
||||
#include "ui/gfx/geometry/rect.h"
|
||||
#include "ui/gfx/paint_vector_icon.h"
|
||||
#include "ui/gfx/vector_icon_types.h"
|
||||
#include "ui/views/background.h"
|
||||
#include "ui/views/layout/flex_layout_view.h"
|
||||
#include "ui/views/view.h"
|
||||
@ -77,7 +77,8 @@ TEST_F(SystemToastViewPixelTest, WithLeadingIcon) {
|
||||
GetContentsView()->AddChildView(std::make_unique<SystemToastView>(
|
||||
/*text=*/kTestText, SystemToastView::ButtonType::kNone,
|
||||
/*button_text=*/std::u16string(),
|
||||
/*button_icon=*/&gfx::kNoneIcon, /*button_callback=*/base::DoNothing(),
|
||||
/*button_icon=*/&gfx::VectorIcon::EmptyIcon(),
|
||||
/*button_callback=*/base::DoNothing(),
|
||||
/*leading_icon=*/kTestIcon));
|
||||
|
||||
EXPECT_TRUE(GetPixelDiffer()->CompareUiComponentsOnPrimaryScreen(
|
||||
@ -106,7 +107,8 @@ TEST_F(SystemToastViewPixelTest, WithLeadingIconAndTextButton) {
|
||||
GetContentsView()->AddChildView(std::make_unique<SystemToastView>(
|
||||
/*text=*/kTestText, SystemToastView::ButtonType::kTextButton,
|
||||
/*button_text=*/kTestButtonText,
|
||||
/*button_icon=*/&gfx::kNoneIcon, /*button_callback=*/base::DoNothing(),
|
||||
/*button_icon=*/&gfx::VectorIcon::EmptyIcon(),
|
||||
/*button_callback=*/base::DoNothing(),
|
||||
/*leading_icon=*/kTestIcon));
|
||||
|
||||
EXPECT_TRUE(GetPixelDiffer()->CompareUiComponentsOnPrimaryScreen(
|
||||
@ -125,7 +127,8 @@ TEST_F(SystemToastViewPixelTest, Multiline_WithLeadingIcon) {
|
||||
GetContentsView()->AddChildView(std::make_unique<SystemToastView>(
|
||||
/*text=*/kTestLongText, SystemToastView::ButtonType::kNone,
|
||||
/*button_text=*/std::u16string(),
|
||||
/*button_icon=*/&gfx::kNoneIcon, /*button_callback=*/base::DoNothing(),
|
||||
/*button_icon=*/&gfx::VectorIcon::EmptyIcon(),
|
||||
/*button_callback=*/base::DoNothing(),
|
||||
/*leading_icon=*/kTestIcon));
|
||||
|
||||
EXPECT_TRUE(GetPixelDiffer()->CompareUiComponentsOnPrimaryScreen(
|
||||
@ -145,7 +148,8 @@ TEST_F(SystemToastViewPixelTest, Multiline_WithLeadingIconAndTextButton) {
|
||||
GetContentsView()->AddChildView(std::make_unique<SystemToastView>(
|
||||
/*text=*/kTestLongText, SystemToastView::ButtonType::kTextButton,
|
||||
/*button_text=*/kTestButtonText,
|
||||
/*button_icon=*/&gfx::kNoneIcon, /*button_callback=*/base::DoNothing(),
|
||||
/*button_icon=*/&gfx::VectorIcon::EmptyIcon(),
|
||||
/*button_callback=*/base::DoNothing(),
|
||||
/*leading_icon=*/kTestIcon));
|
||||
|
||||
EXPECT_TRUE(GetPixelDiffer()->CompareUiComponentsOnPrimaryScreen(
|
||||
|
@ -14,7 +14,7 @@
|
||||
#include "ash/style/icon_button.h"
|
||||
#include "ash/test/ash_test_base.h"
|
||||
#include "ui/chromeos/styles/cros_tokens_color_mappings.h"
|
||||
#include "ui/gfx/paint_vector_icon.h"
|
||||
#include "ui/gfx/vector_icon_types.h"
|
||||
#include "ui/views/controls/button/label_button.h"
|
||||
#include "ui/views/controls/image_view.h"
|
||||
#include "ui/views/controls/label.h"
|
||||
@ -73,7 +73,7 @@ TEST_F(SystemToastViewTest, WithLeadingIcon) {
|
||||
widget->SetContentsView(std::make_unique<SystemToastView>(
|
||||
/*text=*/kTestText, SystemToastView::ButtonType::kNone,
|
||||
/*button_text=*/std::u16string(),
|
||||
/*button_icon=*/&gfx::kNoneIcon,
|
||||
/*button_icon=*/&gfx::VectorIcon::EmptyIcon(),
|
||||
/*button_callback=*/base::DoNothing(), /*leading_icon=*/kTestIcon));
|
||||
|
||||
// Test that the appropriate toast elements were created.
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include "ui/gfx/canvas.h"
|
||||
#include "ui/gfx/font_list.h"
|
||||
#include "ui/gfx/image/canvas_image_source.h"
|
||||
#include "ui/gfx/paint_vector_icon.h"
|
||||
#include "ui/message_center/message_center.h"
|
||||
#include "ui/views/border.h"
|
||||
#include "ui/views/controls/image_view.h"
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include "ash/system/unified/notification_counter_view.h"
|
||||
#include "ash/test/ash_test_base.h"
|
||||
#include "ui/base/l10n/l10n_util.h"
|
||||
#include "ui/gfx/vector_icon_types.h"
|
||||
#include "ui/message_center/message_center.h"
|
||||
#include "ui/message_center/public/cpp/notification.h"
|
||||
#include "ui/views/accessibility/view_accessibility.h"
|
||||
@ -56,8 +57,8 @@ class NotificationIconsControllerTest : public AshTestBase {
|
||||
message_center::NotifierId(
|
||||
message_center::NotifierType::SYSTEM_COMPONENT, notifier_id,
|
||||
NotificationCatalogName::kTestCatalogName),
|
||||
rich_notification_data, nullptr /* delegate */, gfx::VectorIcon(),
|
||||
warning_level));
|
||||
rich_notification_data, nullptr /* delegate */,
|
||||
gfx::VectorIcon::EmptyIcon(), warning_level));
|
||||
notification_id_++;
|
||||
|
||||
return id;
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include "ui/base/metadata/metadata_impl_macros.h"
|
||||
#include "ui/base/resource/resource_bundle.h"
|
||||
#include "ui/compositor/layer.h"
|
||||
#include "ui/gfx/paint_vector_icon.h"
|
||||
#include "ui/views/accessibility/view_accessibility.h"
|
||||
#include "ui/views/controls/animated_image_view.h"
|
||||
#include "ui/views/controls/image_view.h"
|
||||
|
@ -23,7 +23,7 @@
|
||||
#include "testing/gtest/include/gtest/gtest.h"
|
||||
#include "ui/base/interaction/element_tracker.h"
|
||||
#include "ui/base/mojom/ui_base_types.mojom-shared.h"
|
||||
#include "ui/gfx/paint_vector_icon.h"
|
||||
#include "ui/gfx/vector_icon_types.h"
|
||||
#include "ui/views/metadata/view_factory.h"
|
||||
#include "ui/views/view.h"
|
||||
#include "ui/views/view_class_properties.h"
|
||||
@ -79,9 +79,10 @@ TEST_F(UserEducationUtilTest, CreateExtendedProperties) {
|
||||
// `GetHelpBubbleBodyIcon()` can be used to retrieve help bubble body icon from
|
||||
// extended properties.
|
||||
TEST_F(UserEducationUtilTest, CreateExtendedPropertiesWithBodyIcon) {
|
||||
EXPECT_EQ(
|
||||
&GetHelpBubbleBodyIcon(CreateExtendedProperties(gfx::kNoneIcon))->get(),
|
||||
&gfx::kNoneIcon);
|
||||
EXPECT_EQ(&GetHelpBubbleBodyIcon(
|
||||
CreateExtendedProperties(gfx::VectorIcon::EmptyIcon()))
|
||||
->get(),
|
||||
&gfx::VectorIcon::EmptyIcon());
|
||||
|
||||
// It is permissible to query help bubble body icon even when absent.
|
||||
EXPECT_EQ(GetHelpBubbleBodyIcon(HelpBubbleParams::ExtendedProperties()),
|
||||
|
@ -48,7 +48,6 @@
|
||||
#include "ui/gfx/geometry/rect_f.h"
|
||||
#include "ui/gfx/geometry/rounded_corners_f.h"
|
||||
#include "ui/gfx/geometry/skia_conversions.h"
|
||||
#include "ui/gfx/paint_vector_icon.h"
|
||||
#include "ui/gfx/text_constants.h"
|
||||
#include "ui/gfx/text_utils.h"
|
||||
#include "ui/gfx/vector_icon_types.h"
|
||||
@ -386,7 +385,7 @@ HelpBubbleViewAsh::HelpBubbleViewAsh(
|
||||
// Add the body icon (optional).
|
||||
constexpr int kBodyIconSize = 20;
|
||||
constexpr int kBodyIconBackgroundSize = 24;
|
||||
if (body_icon && (body_icon != &gfx::kNoneIcon)) {
|
||||
if (body_icon && (body_icon != &gfx::VectorIcon::EmptyIcon())) {
|
||||
icon_view_ = top_text_container->AddChildViewAt(
|
||||
views::Builder<views::ImageView>()
|
||||
.SetAccessibleName(params.body_icon_alt_text)
|
||||
|
@ -22,7 +22,7 @@
|
||||
#include "ui/color/color_provider.h"
|
||||
#include "ui/events/base_event_utils.h"
|
||||
#include "ui/events/event.h"
|
||||
#include "ui/gfx/paint_vector_icon.h"
|
||||
#include "ui/gfx/vector_icon_types.h"
|
||||
#include "ui/views/accessibility/view_accessibility.h"
|
||||
#include "ui/views/bubble/bubble_frame_view.h"
|
||||
#include "ui/views/controls/image_view.h"
|
||||
@ -120,12 +120,12 @@ INSTANTIATE_TEST_SUITE_P(
|
||||
HelpBubbleViewAshBodyIconTest,
|
||||
::testing::Combine(
|
||||
/*body_icon_from_params=*/::testing::Values(
|
||||
std::make_optional(std::cref(gfx::kNoneIcon)),
|
||||
std::make_optional(std::cref(gfx::VectorIcon::EmptyIcon())),
|
||||
std::make_optional(std::cref(vector_icons::kCelebrationIcon)),
|
||||
std::make_optional(std::cref(vector_icons::kHelpIcon)),
|
||||
std::nullopt),
|
||||
/*body_icon_from_extended_properties=*/::testing::Values(
|
||||
std::make_optional(std::cref(gfx::kNoneIcon)),
|
||||
std::make_optional(std::cref(gfx::VectorIcon::EmptyIcon())),
|
||||
std::make_optional(std::cref(vector_icons::kCelebrationIcon)),
|
||||
std::make_optional(std::cref(vector_icons::kHelpIcon)),
|
||||
std::nullopt)));
|
||||
@ -160,7 +160,7 @@ TEST_P(HelpBubbleViewAshBodyIconTest, BodyIcon) {
|
||||
// Cache `expected_body_icon` based on order of precedence.
|
||||
const gfx::VectorIcon& expected_body_icon =
|
||||
body_icon_from_extended_properties().value_or(
|
||||
body_icon_from_params().value_or(gfx::kNoneIcon));
|
||||
body_icon_from_params().value_or(gfx::VectorIcon::EmptyIcon()));
|
||||
|
||||
// Confirm body icon exists iff expected and is configured as expected.
|
||||
EXPECT_THAT(
|
||||
@ -168,7 +168,7 @@ TEST_P(HelpBubbleViewAshBodyIconTest, BodyIcon) {
|
||||
->GetUniqueViewAs<views::ImageView>(
|
||||
HelpBubbleViewAsh::kBodyIconIdForTesting,
|
||||
views::ElementTrackerViews::GetContextForView(help_bubble_view)),
|
||||
Conditional(&expected_body_icon != &gfx::kNoneIcon,
|
||||
Conditional(&expected_body_icon != &gfx::VectorIcon::EmptyIcon(),
|
||||
Property(&views::ImageView::GetImageModel,
|
||||
Eq(ui::ImageModel::FromVectorIcon(
|
||||
expected_body_icon,
|
||||
|
@ -56,7 +56,7 @@
|
||||
#include "ui/display/screen.h"
|
||||
#include "ui/display/tablet_state.h"
|
||||
#include "ui/events/base_event_utils.h"
|
||||
#include "ui/gfx/paint_vector_icon.h"
|
||||
#include "ui/gfx/vector_icon_types.h"
|
||||
#include "ui/views/interaction/element_tracker_views.h"
|
||||
#include "ui/views/view.h"
|
||||
|
||||
@ -78,7 +78,7 @@ CreateHelpBubbleExtendedProperties(HelpBubbleId help_bubble_id) {
|
||||
user_education_util::CreateExtendedProperties(
|
||||
ui::mojom::ModalType::kSystem),
|
||||
user_education_util::CreateExtendedProperties(
|
||||
/*body_icon=*/gfx::kNoneIcon));
|
||||
/*body_icon=*/gfx::VectorIcon::EmptyIcon()));
|
||||
}
|
||||
|
||||
user_education::HelpBubbleParams::ExtendedProperties
|
||||
|
@ -61,6 +61,7 @@
|
||||
#include "ui/display/display.h"
|
||||
#include "ui/display/screen.h"
|
||||
#include "ui/events/types/event_type.h"
|
||||
#include "ui/gfx/vector_icon_types.h"
|
||||
#include "ui/message_center/message_center.h"
|
||||
#include "ui/message_center/public/cpp/notification.h"
|
||||
#include "ui/message_center/public/cpp/notification_delegate.h"
|
||||
@ -168,7 +169,8 @@ MATCHER_P6(BubbleStep,
|
||||
arg.next_button_callback().is_null() != has_next_button &&
|
||||
util::GetHelpBubbleModalType(ext_props) ==
|
||||
ui::mojom::ModalType::kSystem &&
|
||||
&util::GetHelpBubbleBodyIcon(ext_props)->get() == &gfx::kNoneIcon;
|
||||
&util::GetHelpBubbleBodyIcon(ext_props)->get() ==
|
||||
&gfx::VectorIcon::EmptyIcon();
|
||||
}
|
||||
|
||||
MATCHER_P7(BubbleStep,
|
||||
@ -189,7 +191,8 @@ MATCHER_P7(BubbleStep,
|
||||
arg.body_text_id() == body_text_id && arg.arrow() == arrow &&
|
||||
Matches(body_text_matcher)(util::GetHelpBubbleBodyText(ext_props)) &&
|
||||
arg.next_button_callback().is_null() != has_next_button &&
|
||||
&util::GetHelpBubbleBodyIcon(ext_props)->get() == &gfx::kNoneIcon &&
|
||||
&util::GetHelpBubbleBodyIcon(ext_props)->get() ==
|
||||
&gfx::VectorIcon::EmptyIcon() &&
|
||||
util::GetHelpBubbleModalType(ext_props) ==
|
||||
ui::mojom::ModalType::kSystem;
|
||||
}
|
||||
@ -215,7 +218,8 @@ MATCHER_P8(BubbleStep,
|
||||
arg.body_text_id() == body_text_id && arg.arrow() == arrow &&
|
||||
Matches(body_text_matcher)(util::GetHelpBubbleBodyText(ext_props)) &&
|
||||
arg.next_button_callback().is_null() != has_next_button &&
|
||||
&util::GetHelpBubbleBodyIcon(ext_props)->get() == &gfx::kNoneIcon &&
|
||||
&util::GetHelpBubbleBodyIcon(ext_props)->get() ==
|
||||
&gfx::VectorIcon::EmptyIcon() &&
|
||||
util::GetHelpBubbleModalType(ext_props) ==
|
||||
ui::mojom::ModalType::kSystem;
|
||||
}
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include "ui/base/l10n/l10n_util.h"
|
||||
#include "ui/base/metadata/metadata_impl_macros.h"
|
||||
#include "ui/compositor/layer.h"
|
||||
#include "ui/gfx/vector_icon_types.h"
|
||||
#include "ui/views/controls/button/label_button.h"
|
||||
#include "ui/views/highlight_border.h"
|
||||
|
||||
@ -100,9 +101,9 @@ SplitViewSetupView::SplitViewSetupView(base::RepeatingClosure skip_callback,
|
||||
SystemToastView::ButtonType::kTextButton,
|
||||
/*button_text=*/
|
||||
l10n_util::GetStringUTF16(IDS_ASH_OVERVIEW_FASTER_SPLITSCREEN_TOAST_SKIP),
|
||||
/*button_icon=*/&gfx::kNoneIcon,
|
||||
/*button_icon=*/&gfx::VectorIcon::EmptyIcon(),
|
||||
/*button_callback=*/std::move(skip_callback),
|
||||
/*leading_icon=*/&gfx::kNoneIcon));
|
||||
/*leading_icon=*/&gfx::VectorIcon::EmptyIcon()));
|
||||
auto* dismiss_button = toast->button();
|
||||
dismiss_button->SetTooltipText(l10n_util::GetStringUTF16(
|
||||
IDS_ASH_OVERVIEW_FASTER_SPLITSCREEN_TOAST_DISMISS_WINDOW_SUGGESTIONS));
|
||||
|
@ -21,7 +21,6 @@
|
||||
#include "components/vector_icons/vector_icons.h"
|
||||
#include "ui/base/l10n/l10n_util.h"
|
||||
#include "ui/color/color_id.h"
|
||||
#include "ui/gfx/paint_vector_icon.h"
|
||||
#include "ui/gfx/vector_icon_types.h"
|
||||
#include "ui/views/vector_icons.h"
|
||||
|
||||
@ -136,14 +135,14 @@ const gfx::VectorIcon& AppContextMenu::GetMenuItemVectorIcon(int command_id,
|
||||
return views::kNewIncognitoWindowIcon;
|
||||
case ash::INSTALL:
|
||||
// Deprecated.
|
||||
return gfx::kNoneIcon;
|
||||
return gfx::VectorIcon::EmptyIcon();
|
||||
case ash::SETTINGS:
|
||||
return vector_icons::kSettingsIcon;
|
||||
case ash::USE_LAUNCH_TYPE_REGULAR:
|
||||
case ash::USE_LAUNCH_TYPE_WINDOW:
|
||||
case ash::USE_LAUNCH_TYPE_TABBED_WINDOW:
|
||||
// Check items use the default icon.
|
||||
return gfx::kNoneIcon;
|
||||
return gfx::VectorIcon::EmptyIcon();
|
||||
case ash::DEPRECATED_USE_LAUNCH_TYPE_PINNED:
|
||||
case ash::DEPRECATED_USE_LAUNCH_TYPE_FULLSCREEN:
|
||||
NOTREACHED();
|
||||
|
@ -116,7 +116,7 @@ void AppControlsNotifier::ShowNotification() {
|
||||
base::MakeRefCounted<message_center::HandleNotificationClickDelegate>(
|
||||
base::BindRepeating(&AppControlsNotifier::HandleClick,
|
||||
weak_ptr_factory_.GetWeakPtr())),
|
||||
/*small_image=*/gfx::VectorIcon(),
|
||||
/*small_image=*/gfx::VectorIcon::EmptyIcon(),
|
||||
message_center::SystemNotificationWarningLevel::NORMAL);
|
||||
|
||||
NotificationDisplayServiceFactory::GetForProfile(profile_)->Display(
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include "components/vector_icons/vector_icons.h"
|
||||
#include "ui/base/l10n/l10n_util.h"
|
||||
#include "ui/chromeos/styles/cros_tokens_color_mappings.h"
|
||||
#include "ui/gfx/paint_vector_icon.h"
|
||||
|
||||
namespace crostini {
|
||||
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include "chrome/grit/generated_resources.h"
|
||||
#include "chromeos/ash/components/dbus/gnubby/gnubby_client.h"
|
||||
#include "ui/base/l10n/l10n_util.h"
|
||||
#include "ui/gfx/paint_vector_icon.h"
|
||||
#include "ui/message_center/public/cpp/notification.h"
|
||||
#include "ui/message_center/public/cpp/notification_delegate.h"
|
||||
|
||||
@ -54,7 +55,7 @@ void GnubbyNotification::CreateNotification() {
|
||||
new message_center::HandleNotificationClickDelegate(
|
||||
base::BindRepeating(&GnubbyNotification::DismissNotification,
|
||||
weak_ptr_factory_.GetWeakPtr())),
|
||||
gfx::VectorIcon(), colorType);
|
||||
gfx::VectorIcon::EmptyIcon(), colorType);
|
||||
}
|
||||
|
||||
void GnubbyNotification::ShowNotification() {
|
||||
|
@ -120,7 +120,7 @@ void DeviceCommandResetEuiccJob::ShowResetEuiccNotification() {
|
||||
message_center::RichNotificationData(),
|
||||
base::MakeRefCounted<message_center::HandleNotificationClickDelegate>(
|
||||
base::DoNothingAs<void()>()),
|
||||
/*small_image=*/gfx::VectorIcon(),
|
||||
/*small_image=*/gfx::VectorIcon::EmptyIcon(),
|
||||
message_center::SystemNotificationWarningLevel::NORMAL);
|
||||
SystemNotificationHelper::GetInstance()->Display(notification);
|
||||
}
|
||||
|
@ -60,7 +60,7 @@
|
||||
#include "ui/base/resource/resource_bundle.h"
|
||||
#include "ui/gfx/image/image_skia.h"
|
||||
#include "ui/gfx/image/image_skia_operations.h"
|
||||
#include "ui/gfx/paint_vector_icon.h"
|
||||
#include "ui/gfx/vector_icon_types.h"
|
||||
#include "ui/message_center/public/cpp/notification.h"
|
||||
#include "ui/message_center/public/cpp/notification_delegate.h"
|
||||
#include "url/gurl.h"
|
||||
@ -501,7 +501,7 @@ bool ScalableIphDelegateImpl::ShowNotification(
|
||||
notification_image_id.value());
|
||||
}
|
||||
|
||||
const gfx::VectorIcon* icon = &gfx::kNoneIcon;
|
||||
const gfx::VectorIcon* icon = &gfx::VectorIcon::EmptyIcon();
|
||||
if (params.icon == ScalableIphDelegate::NotificationIcon::kRedeem) {
|
||||
icon = &chromeos::kRedeemIcon;
|
||||
}
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include "components/prefs/pref_service.h"
|
||||
#include "ui/base/l10n/l10n_util.h"
|
||||
#include "ui/chromeos/devicetype_utils.h"
|
||||
#include "ui/gfx/vector_icon_types.h"
|
||||
#include "ui/message_center/public/cpp/notification.h"
|
||||
|
||||
namespace ash {
|
||||
@ -87,7 +88,8 @@ void OnAvailableUpdateModes(Profile* profile,
|
||||
NotificationCatalogName::kTPMFirmwareUpdate),
|
||||
message_center::RichNotificationData(),
|
||||
base::MakeRefCounted<TPMFirmwareUpdateNotificationDelegate>(profile),
|
||||
gfx::kNoneIcon, message_center::SystemNotificationWarningLevel::WARNING);
|
||||
gfx::VectorIcon::EmptyIcon(),
|
||||
message_center::SystemNotificationWarningLevel::WARNING);
|
||||
|
||||
NotificationDisplayServiceFactory::GetForProfile(profile)->Display(
|
||||
NotificationHandler::Type::TRANSIENT, notification,
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include "components/strings/grit/components_strings.h"
|
||||
#include "third_party/cros_system_api/dbus/debugd/dbus-constants.h"
|
||||
#include "ui/base/l10n/l10n_util.h"
|
||||
#include "ui/gfx/vector_icon_types.h"
|
||||
#include "ui/message_center/public/cpp/notification.h"
|
||||
|
||||
namespace ash {
|
||||
@ -114,7 +115,8 @@ void U2FNotification::ShowNotification() {
|
||||
base::MakeRefCounted<message_center::HandleNotificationClickDelegate>(
|
||||
base::BindRepeating(&U2FNotification::OnNotificationClick,
|
||||
weak_factory_.GetWeakPtr())),
|
||||
gfx::kNoneIcon, message_center::SystemNotificationWarningLevel::WARNING);
|
||||
gfx::VectorIcon::EmptyIcon(),
|
||||
message_center::SystemNotificationWarningLevel::WARNING);
|
||||
notification.SetSystemPriority();
|
||||
notification.set_pinned(false);
|
||||
|
||||
|
@ -50,6 +50,7 @@
|
||||
#include "services/device/public/mojom/usb_enumeration_options.mojom.h"
|
||||
#include "ui/base/l10n/l10n_util.h"
|
||||
#include "ui/chromeos/styles/cros_tokens_color_mappings.h"
|
||||
#include "ui/gfx/paint_vector_icon.h"
|
||||
|
||||
namespace ash {
|
||||
|
||||
|
@ -38,8 +38,6 @@ std::string GetTimestampString() {
|
||||
base::Time::Now().ToDeltaSinceWindowsEpoch().InMicroseconds());
|
||||
}
|
||||
|
||||
const gfx::VectorIcon kEmptyIcon;
|
||||
|
||||
} // namespace
|
||||
|
||||
NearbyShareDelegateImpl::NearbyShareDelegateImpl(
|
||||
@ -245,7 +243,7 @@ const gfx::VectorIcon& NearbyShareDelegateImpl::GetIcon(bool on_icon) const {
|
||||
return on_icon ? kNearbyShareInternalIcon : kNearbyShareInternalOffIcon;
|
||||
}
|
||||
#endif // BUILDFLAG(GOOGLE_CHROME_BRANDING)
|
||||
return kEmptyIcon;
|
||||
return gfx::VectorIcon::EmptyIcon();
|
||||
}
|
||||
|
||||
std::u16string NearbyShareDelegateImpl::GetPlaceholderFeatureName() const {
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include "ui/chromeos/devicetype_utils.h"
|
||||
#include "ui/chromeos/shill_error.h"
|
||||
#include "ui/chromeos/strings/grit/ui_chromeos_strings.h"
|
||||
#include "ui/gfx/vector_icon_types.h"
|
||||
#include "ui/message_center/public/cpp/notification.h"
|
||||
|
||||
namespace ash {
|
||||
@ -657,7 +658,8 @@ void NetworkStateNotifier::ShowCarrierUnlockNotification() {
|
||||
new message_center::HandleNotificationClickDelegate(
|
||||
base::BindRepeating(&NetworkStateNotifier::ShowMobileDataSubpage,
|
||||
weak_ptr_factory_.GetWeakPtr())),
|
||||
gfx::kNoneIcon, message_center::SystemNotificationWarningLevel::NORMAL);
|
||||
gfx::VectorIcon::EmptyIcon(),
|
||||
message_center::SystemNotificationWarningLevel::NORMAL);
|
||||
SystemNotificationHelper::GetInstance()->Display(notification);
|
||||
}
|
||||
|
||||
|
@ -36,7 +36,7 @@
|
||||
#include "ui/color/color_id.h"
|
||||
#include "ui/display/screen.h"
|
||||
#include "ui/display/types/display_constants.h"
|
||||
#include "ui/gfx/paint_vector_icon.h"
|
||||
#include "ui/gfx/vector_icon_types.h"
|
||||
#include "ui/views/vector_icons.h"
|
||||
|
||||
namespace {
|
||||
@ -232,7 +232,7 @@ const gfx::VectorIcon& ShelfContextMenu::GetCommandIdVectorIcon(
|
||||
case ash::USE_LAUNCH_TYPE_WINDOW:
|
||||
case ash::USE_LAUNCH_TYPE_TABBED_WINDOW:
|
||||
// Check items use a default icon in touchable and default context menus.
|
||||
return gfx::kNoneIcon;
|
||||
return gfx::VectorIcon::EmptyIcon();
|
||||
case ash::DEPRECATED_USE_LAUNCH_TYPE_PINNED:
|
||||
case ash::DEPRECATED_USE_LAUNCH_TYPE_FULLSCREEN:
|
||||
NOTREACHED();
|
||||
@ -249,7 +249,7 @@ const gfx::VectorIcon& ShelfContextMenu::GetCommandIdVectorIcon(
|
||||
return views::kLinuxLowDensityIcon;
|
||||
case ash::SWAP_WITH_NEXT:
|
||||
case ash::SWAP_WITH_PREVIOUS:
|
||||
return gfx::kNoneIcon;
|
||||
return gfx::VectorIcon::EmptyIcon();
|
||||
case ash::LAUNCH_APP_SHORTCUT_FIRST:
|
||||
case ash::LAUNCH_APP_SHORTCUT_LAST:
|
||||
case ash::COMMAND_ID_COUNT:
|
||||
|
@ -369,7 +369,7 @@ void GetIconFromType(ContentSettingsType type,
|
||||
bool blocked,
|
||||
raw_ptr<const gfx::VectorIcon>* icon,
|
||||
raw_ptr<const gfx::VectorIcon>* badge) {
|
||||
*badge = &gfx::kNoneIcon;
|
||||
*badge = &gfx::VectorIcon::EmptyIcon();
|
||||
GetIconChromeRefresh(type, blocked, icon);
|
||||
}
|
||||
|
||||
@ -509,7 +509,7 @@ void ContentSettingImageModel::SetIcon(ContentSettingsType type, bool blocked) {
|
||||
|
||||
void ContentSettingImageModel::SetFramebustBlockedIcon() {
|
||||
icon_ = &kOpenInNewOffChromeRefreshIcon;
|
||||
icon_badge_ = &gfx::kNoneIcon;
|
||||
icon_badge_ = &gfx::VectorIcon::EmptyIcon();
|
||||
}
|
||||
|
||||
// Generic blocked content settings --------------------------------------------
|
||||
@ -1222,8 +1222,8 @@ int ContentSettingImageModel::AccessibilityAnnouncementStringId() const {
|
||||
ContentSettingImageModel::ContentSettingImageModel(
|
||||
ImageType image_type,
|
||||
bool image_type_should_notify_accessibility)
|
||||
: icon_(&gfx::kNoneIcon),
|
||||
icon_badge_(&gfx::kNoneIcon),
|
||||
: icon_(&gfx::VectorIcon::EmptyIcon()),
|
||||
icon_badge_(&gfx::VectorIcon::EmptyIcon()),
|
||||
image_type_(image_type),
|
||||
image_type_should_notify_accessibility_(
|
||||
image_type_should_notify_accessibility) {}
|
||||
|
@ -25,7 +25,6 @@
|
||||
#include "testing/gtest/include/gtest/gtest.h"
|
||||
#include "ui/base/l10n/l10n_util.h"
|
||||
#include "ui/gfx/color_palette.h"
|
||||
#include "ui/gfx/paint_vector_icon.h"
|
||||
#include "ui/gfx/vector_icon_types.h"
|
||||
|
||||
namespace gfx {
|
||||
@ -94,16 +93,17 @@ TEST_F(ContentSettingMediaImageModelTest, MediaUpdate) {
|
||||
kTestOrigin, {PageSpecificContentSettings::kCameraAccessed});
|
||||
auth_wrapper.SetMockMediaPermissionStatus(AVAuthorizationStatusAuthorized);
|
||||
content_setting_image_model->Update(web_contents());
|
||||
ExpectImageModelState(
|
||||
*content_setting_image_model, /*is_visible=*/true, /*has_icon=*/true,
|
||||
l10n_util::GetStringUTF16(IDS_CAMERA_ACCESSED), 0, &gfx::kNoneIcon);
|
||||
ExpectImageModelState(*content_setting_image_model, /*is_visible=*/true,
|
||||
/*has_icon=*/true,
|
||||
l10n_util::GetStringUTF16(IDS_CAMERA_ACCESSED), 0,
|
||||
&gfx::VectorIcon::EmptyIcon());
|
||||
auth_wrapper.SetMockMediaPermissionStatus(AVAuthorizationStatusDenied);
|
||||
content_setting_image_model->Update(web_contents());
|
||||
ExpectImageModelState(
|
||||
*content_setting_image_model, /*is_visible=*/true,
|
||||
/*has_icon=*/true,
|
||||
l10n_util::GetStringUTF16(IDS_CAMERA_TURNED_OFF_IN_MACOS),
|
||||
IDS_CAMERA_TURNED_OFF, &gfx::kNoneIcon);
|
||||
IDS_CAMERA_TURNED_OFF, &gfx::VectorIcon::EmptyIcon());
|
||||
auth_wrapper.SetMockMediaPermissionStatus(
|
||||
AVAuthorizationStatusNotDetermined);
|
||||
content_setting_image_model->Update(web_contents());
|
||||
@ -116,16 +116,17 @@ TEST_F(ContentSettingMediaImageModelTest, MediaUpdate) {
|
||||
kTestOrigin, {PageSpecificContentSettings::kMicrophoneAccessed});
|
||||
auth_wrapper.SetMockMediaPermissionStatus(AVAuthorizationStatusAuthorized);
|
||||
content_setting_image_model->Update(web_contents());
|
||||
ExpectImageModelState(
|
||||
*content_setting_image_model, /*is_visible=*/true, /*has_icon=*/true,
|
||||
l10n_util::GetStringUTF16(IDS_MICROPHONE_ACCESSED), 0, &gfx::kNoneIcon);
|
||||
ExpectImageModelState(*content_setting_image_model, /*is_visible=*/true,
|
||||
/*has_icon=*/true,
|
||||
l10n_util::GetStringUTF16(IDS_MICROPHONE_ACCESSED), 0,
|
||||
&gfx::VectorIcon::EmptyIcon());
|
||||
auth_wrapper.SetMockMediaPermissionStatus(AVAuthorizationStatusDenied);
|
||||
content_setting_image_model->Update(web_contents());
|
||||
ExpectImageModelState(
|
||||
*content_setting_image_model, /*is_visible=*/true,
|
||||
/*has_icon=*/true,
|
||||
l10n_util::GetStringUTF16(IDS_MIC_TURNED_OFF_IN_MACOS),
|
||||
IDS_MIC_TURNED_OFF, &gfx::kNoneIcon);
|
||||
IDS_MIC_TURNED_OFF, &gfx::VectorIcon::EmptyIcon());
|
||||
auth_wrapper.SetMockMediaPermissionStatus(
|
||||
AVAuthorizationStatusNotDetermined);
|
||||
content_setting_image_model->Update(web_contents());
|
||||
@ -143,14 +144,14 @@ TEST_F(ContentSettingMediaImageModelTest, MediaUpdate) {
|
||||
ExpectImageModelState(
|
||||
*content_setting_image_model, /*is_visible=*/true, /*has_icon=*/true,
|
||||
l10n_util::GetStringUTF16(IDS_MICROPHONE_CAMERA_ALLOWED), 0,
|
||||
&gfx::kNoneIcon);
|
||||
&gfx::VectorIcon::EmptyIcon());
|
||||
auth_wrapper.SetMockMediaPermissionStatus(AVAuthorizationStatusDenied);
|
||||
auth_wrapper.SetMockMediaPermissionStatus(AVAuthorizationStatusDenied);
|
||||
content_setting_image_model->Update(web_contents());
|
||||
ExpectImageModelState(
|
||||
*content_setting_image_model, /*is_visible=*/true, /*has_icon=*/true,
|
||||
l10n_util::GetStringUTF16(IDS_CAMERA_MIC_TURNED_OFF_IN_MACOS),
|
||||
IDS_CAMERA_TURNED_OFF, &gfx::kNoneIcon);
|
||||
IDS_CAMERA_TURNED_OFF, &gfx::VectorIcon::EmptyIcon());
|
||||
auth_wrapper.SetMockMediaPermissionStatus(
|
||||
AVAuthorizationStatusNotDetermined);
|
||||
auth_wrapper.SetMockMediaPermissionStatus(
|
||||
@ -177,7 +178,7 @@ TEST_F(ContentSettingMediaImageModelTest, MediaUpdate) {
|
||||
/*is_visible=*/true,
|
||||
/*has_icon=*/true,
|
||||
l10n_util::GetStringUTF16(IDS_CAMERA_BLOCKED), 0,
|
||||
&gfx::kNoneIcon);
|
||||
&gfx::VectorIcon::EmptyIcon());
|
||||
}
|
||||
|
||||
// Microphone blocked per site.
|
||||
@ -190,7 +191,7 @@ TEST_F(ContentSettingMediaImageModelTest, MediaUpdate) {
|
||||
/*is_visible=*/true,
|
||||
/*has_icon=*/true,
|
||||
l10n_util::GetStringUTF16(IDS_MICROPHONE_BLOCKED),
|
||||
0, &gfx::kNoneIcon);
|
||||
0, &gfx::VectorIcon::EmptyIcon());
|
||||
}
|
||||
|
||||
// Microphone & camera blocked per site
|
||||
@ -205,7 +206,7 @@ TEST_F(ContentSettingMediaImageModelTest, MediaUpdate) {
|
||||
*content_setting_image_model, /*is_visible=*/true,
|
||||
/*has_icon=*/true,
|
||||
l10n_util::GetStringUTF16(IDS_MICROPHONE_CAMERA_BLOCKED), 0,
|
||||
&gfx::kNoneIcon);
|
||||
&gfx::VectorIcon::EmptyIcon());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -18,7 +18,7 @@
|
||||
#include "components/vector_icons/vector_icons.h"
|
||||
#include "ui/base/l10n/l10n_util.h"
|
||||
#include "ui/base/metadata/metadata_impl_macros.h"
|
||||
#include "ui/gfx/paint_vector_icon.h"
|
||||
#include "ui/gfx/vector_icon_types.h"
|
||||
#include "ui/views/accessibility/view_accessibility.h"
|
||||
#include "ui/views/animation/ink_drop.h"
|
||||
|
||||
@ -132,7 +132,7 @@ const gfx::VectorIcon& LocalCardMigrationIconView::GetVectorIconBadge() const {
|
||||
LocalCardMigrationFlowStep::MIGRATION_FAILED) {
|
||||
return vector_icons::kBlockedBadgeIcon;
|
||||
}
|
||||
return gfx::kNoneIcon;
|
||||
return gfx::VectorIcon::EmptyIcon();
|
||||
}
|
||||
|
||||
ManageMigrationUiController* LocalCardMigrationIconView::GetController() const {
|
||||
|
@ -35,7 +35,7 @@
|
||||
#include "ui/color/color_provider.h"
|
||||
#include "ui/gfx/geometry/insets.h"
|
||||
#include "ui/gfx/geometry/size.h"
|
||||
#include "ui/gfx/paint_vector_icon.h"
|
||||
#include "ui/gfx/vector_icon_types.h"
|
||||
#include "ui/views/controls/button/image_button.h"
|
||||
#include "ui/views/controls/button/image_button_factory.h"
|
||||
#include "ui/views/controls/button/radio_button.h"
|
||||
@ -154,7 +154,7 @@ void ContentSettingBubbleContents::ListItemContainer::AddItem(
|
||||
*item.image, ui::kColorLabelForeground,
|
||||
GetLayoutConstant(LOCATION_BAR_ICON_SIZE),
|
||||
item.has_blocked_badge ? &vector_icons::kBlockedBadgeIcon
|
||||
: &gfx::kNoneIcon));
|
||||
: &gfx::VectorIcon::EmptyIcon()));
|
||||
}
|
||||
|
||||
std::unique_ptr<views::View> item_contents;
|
||||
|
@ -37,6 +37,7 @@
|
||||
#include "extensions/test/test_extension_dir.h"
|
||||
#include "testing/gmock/include/gmock/gmock.h"
|
||||
#include "ui/gfx/image/image_unittest_util.h"
|
||||
#include "ui/gfx/paint_vector_icon.h"
|
||||
#include "ui/views/controls/styled_label.h"
|
||||
#include "ui/views/vector_icons.h"
|
||||
#include "ui/views/view_utils.h"
|
||||
|
@ -21,7 +21,7 @@
|
||||
#include "ui/color/color_id.h"
|
||||
#include "ui/color/color_provider.h"
|
||||
#include "ui/gfx/color_utils.h"
|
||||
#include "ui/gfx/paint_vector_icon.h"
|
||||
#include "ui/gfx/vector_icon_types.h"
|
||||
#include "ui/views/background.h"
|
||||
#include "ui/views/controls/highlight_path_generator.h"
|
||||
#include "ui/views/interaction/element_tracker_views.h"
|
||||
@ -166,7 +166,7 @@ const gfx::VectorIcon& OmniboxChipButton::GetIcon() const {
|
||||
return const_cast<decltype(*icon_)>(*icon_);
|
||||
}
|
||||
|
||||
return gfx::kNoneIcon;
|
||||
return gfx::VectorIcon::EmptyIcon();
|
||||
}
|
||||
|
||||
ui::ColorId OmniboxChipButton::GetForegroundColorId() const {
|
||||
|
@ -11,7 +11,6 @@
|
||||
#include "ui/base/metadata/metadata_header_macros.h"
|
||||
#include "ui/base/models/image_model.h"
|
||||
#include "ui/gfx/animation/slide_animation.h"
|
||||
#include "ui/gfx/paint_vector_icon.h"
|
||||
#include "ui/gfx/vector_icon_types.h"
|
||||
#include "ui/views/controls/button/md_text_button.h"
|
||||
|
||||
@ -97,7 +96,7 @@ class OmniboxChipButton : public views::MdTextButton {
|
||||
// without text.
|
||||
bool fully_collapsed_ = false;
|
||||
|
||||
raw_ptr<const gfx::VectorIcon> icon_ = &gfx::kNoneIcon;
|
||||
raw_ptr<const gfx::VectorIcon> icon_ = &gfx::VectorIcon::EmptyIcon();
|
||||
|
||||
base::ObserverList<Observer> observers_;
|
||||
};
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include "ui/events/event.h"
|
||||
#include "ui/gfx/color_utils.h"
|
||||
#include "ui/gfx/paint_vector_icon.h"
|
||||
#include "ui/gfx/vector_icon_types.h"
|
||||
#include "ui/native_theme/native_theme.h"
|
||||
#include "ui/views/accessibility/view_accessibility.h"
|
||||
#include "ui/views/animation/flood_fill_ink_drop_ripple.h"
|
||||
@ -213,7 +214,7 @@ void PageActionIconView::ExecuteCommand(ExecuteSource source) {
|
||||
}
|
||||
|
||||
const gfx::VectorIcon& PageActionIconView::GetVectorIconBadge() const {
|
||||
return gfx::kNoneIcon;
|
||||
return gfx::VectorIcon::EmptyIcon();
|
||||
}
|
||||
|
||||
ui::ImageModel PageActionIconView::GetSizedIconImage(int size) const {
|
||||
|
@ -11,7 +11,7 @@
|
||||
#include "third_party/skia/include/core/SkBitmap.h"
|
||||
#include "ui/events/test/event_generator.h"
|
||||
#include "ui/gfx/color_palette.h"
|
||||
#include "ui/gfx/paint_vector_icon.h"
|
||||
#include "ui/gfx/vector_icon_types.h"
|
||||
#include "ui/views/accessibility/view_accessibility.h"
|
||||
#include "ui/views/controls/button/button.h"
|
||||
#include "ui/views/widget/widget_utils.h"
|
||||
@ -96,7 +96,7 @@ class TestPageActionIconView : public PageActionIconView {
|
||||
// PageActionIconView:
|
||||
void OnExecuting(ExecuteSource execute_source) override {}
|
||||
const gfx::VectorIcon& GetVectorIcon() const override {
|
||||
return gfx::kNoneIcon;
|
||||
return gfx::VectorIcon::EmptyIcon();
|
||||
}
|
||||
void UpdateImpl() override {}
|
||||
|
||||
|
@ -37,7 +37,7 @@
|
||||
#include "components/vector_icons/vector_icons.h"
|
||||
#include "ui/base/l10n/l10n_util.h"
|
||||
#include "ui/color/color_id.h"
|
||||
#include "ui/gfx/paint_vector_icon.h"
|
||||
#include "ui/gfx/vector_icon_types.h"
|
||||
#include "ui/views/bubble/bubble_frame_view.h"
|
||||
#include "ui/views/controls/button/image_button.h"
|
||||
#include "ui/views/controls/button/image_button_factory.h"
|
||||
@ -464,7 +464,7 @@ const ui::ImageModel PageInfoViewFactory::GetPermissionIcon(
|
||||
return ui::ImageModel::FromVectorIcon(*icon, ui::kColorIcon, GetIconSize());
|
||||
}
|
||||
|
||||
icon = &gfx::kNoneIcon;
|
||||
icon = &gfx::VectorIcon::EmptyIcon();
|
||||
switch (info.type) {
|
||||
case ContentSettingsType::COOKIES:
|
||||
icon = &vector_icons::kDatabaseIcon;
|
||||
@ -594,7 +594,7 @@ const ui::ImageModel PageInfoViewFactory::GetChosenObjectIcon(
|
||||
// is not currently conncted to the system.
|
||||
// TODO(crbug.com/40672237): Check the connected status of devices and
|
||||
// change the icon to one that reflects that status.
|
||||
const gfx::VectorIcon* icon = &gfx::kNoneIcon;
|
||||
const gfx::VectorIcon* icon = &gfx::VectorIcon::EmptyIcon();
|
||||
switch (object.ui_info->content_settings_type) {
|
||||
case ContentSettingsType::USB_CHOOSER_DATA:
|
||||
icon = &vector_icons::kUsbIcon;
|
||||
|
@ -24,7 +24,7 @@
|
||||
#include "ui/color/color_id.h"
|
||||
#include "ui/color/color_provider.h"
|
||||
#include "ui/gfx/color_utils.h"
|
||||
#include "ui/gfx/paint_vector_icon.h"
|
||||
#include "ui/gfx/vector_icon_types.h"
|
||||
#include "ui/views/background.h"
|
||||
#include "ui/views/controls/highlight_path_generator.h"
|
||||
#include "ui/views/painter.h"
|
||||
@ -203,7 +203,7 @@ const gfx::VectorIcon& PermissionChipView::GetIcon() const {
|
||||
return const_cast<decltype(*icon_)>(*icon_);
|
||||
}
|
||||
|
||||
return gfx::kNoneIcon;
|
||||
return gfx::VectorIcon::EmptyIcon();
|
||||
}
|
||||
|
||||
SkColor PermissionChipView::GetForegroundColor() const {
|
||||
|
@ -15,7 +15,6 @@
|
||||
#include "ui/base/metadata/metadata_header_macros.h"
|
||||
#include "ui/base/models/image_model.h"
|
||||
#include "ui/gfx/animation/slide_animation.h"
|
||||
#include "ui/gfx/paint_vector_icon.h"
|
||||
#include "ui/gfx/vector_icon_types.h"
|
||||
#include "ui/views/controls/button/md_text_button.h"
|
||||
#include "ui/views/view_tracker.h"
|
||||
@ -153,7 +152,7 @@ class PermissionChipView : public views::MdTextButton {
|
||||
bool fully_collapsed_ = false;
|
||||
bool is_divider_visible_ = false;
|
||||
|
||||
raw_ptr<const gfx::VectorIcon> icon_ = &gfx::kNoneIcon;
|
||||
raw_ptr<const gfx::VectorIcon> icon_ = &gfx::VectorIcon::EmptyIcon();
|
||||
|
||||
base::ObserverList<Observer> observers_;
|
||||
};
|
||||
|
@ -25,7 +25,7 @@
|
||||
#include "ui/base/ui_base_features.h"
|
||||
#include "ui/display/screen.h"
|
||||
#include "ui/gfx/geometry/rect.h"
|
||||
#include "ui/gfx/paint_vector_icon.h"
|
||||
#include "ui/gfx/vector_icon_types.h"
|
||||
#include "ui/views/bubble/bubble_frame_view.h"
|
||||
#include "ui/views/controls/button/md_text_button.h"
|
||||
#include "ui/views/controls/label.h"
|
||||
@ -137,7 +137,7 @@ void EmbeddedPermissionPromptBaseView::Show() {
|
||||
}
|
||||
|
||||
const gfx::VectorIcon& EmbeddedPermissionPromptBaseView::GetIcon() const {
|
||||
return gfx::kNoneIcon;
|
||||
return gfx::VectorIcon::EmptyIcon();
|
||||
}
|
||||
|
||||
bool EmbeddedPermissionPromptBaseView::ShowLoadingIcon() const {
|
||||
|
@ -25,7 +25,7 @@
|
||||
#include "net/dns/mock_host_resolver.h"
|
||||
#include "third_party/blink/public/common/features.h"
|
||||
#include "ui/base/l10n/l10n_util.h"
|
||||
#include "ui/gfx/paint_vector_icon.h"
|
||||
#include "ui/gfx/vector_icon_types.h"
|
||||
#include "ui/views/interaction/interaction_test_util_views.h"
|
||||
#include "ui/views/interaction/interactive_views_test.h"
|
||||
#include "ui/views/view_utils.h"
|
||||
@ -171,7 +171,7 @@ IN_PROC_BROWSER_TEST_F(MidiPermissionsFlowInteractiveUITest,
|
||||
EXPECT_EQ(element_view->get_icon_for_testing(),
|
||||
&vector_icons::kMidiOffChromeRefreshIcon);
|
||||
EXPECT_EQ(element_view->get_icon_badge_for_testing(),
|
||||
&gfx::kNoneIcon);
|
||||
&gfx::VectorIcon::EmptyIcon());
|
||||
EXPECT_EQ(element_view->get_tooltip_text_for_testing(),
|
||||
l10n_util::GetStringUTF16(
|
||||
IDS_BLOCKED_MIDI_SYSEX_MESSAGE));
|
||||
@ -191,7 +191,7 @@ IN_PROC_BROWSER_TEST_F(MidiPermissionsFlowInteractiveUITest,
|
||||
EXPECT_EQ(element_view->get_icon_for_testing(),
|
||||
&vector_icons::kMidiChromeRefreshIcon);
|
||||
EXPECT_EQ(element_view->get_icon_badge_for_testing(),
|
||||
&gfx::kNoneIcon);
|
||||
&gfx::VectorIcon::EmptyIcon());
|
||||
EXPECT_EQ(element_view->get_tooltip_text_for_testing(),
|
||||
l10n_util::GetStringUTF16(
|
||||
IDS_ALLOWED_MIDI_SYSEX_MESSAGE));
|
||||
|
@ -17,7 +17,7 @@
|
||||
#include "content/public/test/browser_test_utils.h"
|
||||
#include "net/dns/mock_host_resolver.h"
|
||||
#include "ui/base/ui_base_features.h"
|
||||
#include "ui/gfx/paint_vector_icon.h"
|
||||
#include "ui/gfx/vector_icon_types.h"
|
||||
#include "ui/views/interaction/interaction_test_util_views.h"
|
||||
|
||||
namespace {
|
||||
@ -120,7 +120,7 @@ IN_PROC_BROWSER_TEST_F(PermissionIndicatorsInteractiveUITest,
|
||||
CheckViewProperty(
|
||||
ContentSettingImageView::kMediaActivityIndicatorElementId,
|
||||
&ContentSettingImageView::get_icon_badge_for_testing,
|
||||
&gfx::kNoneIcon),
|
||||
&gfx::VectorIcon::EmptyIcon()),
|
||||
ExecuteJs(kWebContentsElementId, "stopCamera"),
|
||||
WaitForHide(ContentSettingImageView::kMediaActivityIndicatorElementId));
|
||||
}
|
||||
@ -146,7 +146,7 @@ IN_PROC_BROWSER_TEST_F(PermissionIndicatorsInteractiveUITest,
|
||||
CheckViewProperty(
|
||||
ContentSettingImageView::kMediaActivityIndicatorElementId,
|
||||
&ContentSettingImageView::get_icon_badge_for_testing,
|
||||
&gfx::kNoneIcon),
|
||||
&gfx::VectorIcon::EmptyIcon()),
|
||||
ExecuteJs(kWebContentsElementId, "requestCamera"),
|
||||
// `getUserMedia` is async, so wait until media stream is opened.
|
||||
WaitForStateChange(kWebContentsElementId, GetCameraStreamStateChange()),
|
||||
@ -159,7 +159,7 @@ IN_PROC_BROWSER_TEST_F(PermissionIndicatorsInteractiveUITest,
|
||||
CheckViewProperty(
|
||||
ContentSettingImageView::kMediaActivityIndicatorElementId,
|
||||
&ContentSettingImageView::get_icon_badge_for_testing,
|
||||
&gfx::kNoneIcon),
|
||||
&gfx::VectorIcon::EmptyIcon()),
|
||||
ExecuteJs(kWebContentsElementId, "stopCamera"),
|
||||
ExecuteJs(kWebContentsElementId, "stopMic"),
|
||||
WaitForHide(ContentSettingImageView::kMediaActivityIndicatorElementId));
|
||||
|
@ -87,6 +87,7 @@
|
||||
#include "ui/gfx/image/canvas_image_source.h"
|
||||
#include "ui/gfx/image/image.h"
|
||||
#include "ui/gfx/image/image_skia_operations.h"
|
||||
#include "ui/gfx/paint_vector_icon.h"
|
||||
#include "ui/strings/grit/ui_strings.h"
|
||||
#include "ui/views/accessibility/view_accessibility.h"
|
||||
|
||||
|
@ -50,6 +50,7 @@
|
||||
#include "ui/gfx/canvas.h"
|
||||
#include "ui/gfx/image/canvas_image_source.h"
|
||||
#include "ui/gfx/image/image_skia_operations.h"
|
||||
#include "ui/gfx/paint_vector_icon.h"
|
||||
#include "ui/gfx/vector_icon_types.h"
|
||||
#include "ui/strings/grit/ui_strings.h"
|
||||
#include "ui/views/accessibility/view_accessibility.h"
|
||||
@ -1042,7 +1043,7 @@ void ProfileMenuViewBase::AddFeatureButton(const std::u16string& text,
|
||||
views::BoxLayout::Orientation::kVertical));
|
||||
}
|
||||
|
||||
if (&icon == &gfx::kNoneIcon) {
|
||||
if (&icon == &gfx::VectorIcon::EmptyIcon()) {
|
||||
features_container_->AddChildView(std::make_unique<HoverButton>(
|
||||
base::BindRepeating(&ProfileMenuViewBase::ButtonPressed,
|
||||
base::Unretained(this), std::move(action)),
|
||||
|
@ -24,7 +24,7 @@
|
||||
#include "ui/base/metadata/metadata_impl_macros.h"
|
||||
#include "ui/base/models/image_model.h"
|
||||
#include "ui/color/color_id.h"
|
||||
#include "ui/gfx/paint_vector_icon.h"
|
||||
#include "ui/gfx/vector_icon_types.h"
|
||||
#include "ui/views/bubble/bubble_dialog_delegate_view.h"
|
||||
#include "ui/views/layout/box_layout.h"
|
||||
#include "ui/views/layout/flex_layout_view.h"
|
||||
@ -191,10 +191,11 @@ class ProfileMenuViewBase : public content::WebContentsDelegate,
|
||||
void AddShortcutFeatureButton(const gfx::VectorIcon& icon,
|
||||
const std::u16string& text,
|
||||
base::RepeatingClosure action);
|
||||
void AddFeatureButton(const std::u16string& text,
|
||||
base::RepeatingClosure action,
|
||||
const gfx::VectorIcon& icon = gfx::kNoneIcon,
|
||||
float icon_to_image_ratio = 1.0f);
|
||||
void AddFeatureButton(
|
||||
const std::u16string& text,
|
||||
base::RepeatingClosure action,
|
||||
const gfx::VectorIcon& icon = gfx::VectorIcon::EmptyIcon(),
|
||||
float icon_to_image_ratio = 1.0f);
|
||||
void SetProfileManagementHeading(const std::u16string& heading);
|
||||
void AddAvailableProfile(const ui::ImageModel& image_model,
|
||||
const std::u16string& name,
|
||||
|
@ -11,8 +11,8 @@
|
||||
#include "ui/base/l10n/l10n_util.h"
|
||||
#include "ui/base/metadata/metadata_impl_macros.h"
|
||||
#include "ui/compositor/layer.h"
|
||||
#include "ui/gfx/paint_vector_icon.h"
|
||||
#include "ui/gfx/scoped_canvas.h"
|
||||
#include "ui/gfx/vector_icon_types.h"
|
||||
#include "ui/strings/grit/ui_strings.h"
|
||||
#include "ui/views/accessibility/view_accessibility.h"
|
||||
#include "ui/views/animation/ink_drop.h"
|
||||
@ -160,7 +160,8 @@ bool SharingIconView::IsTriggerableEvent(const ui::Event& event) {
|
||||
}
|
||||
|
||||
const gfx::VectorIcon& SharingIconView::GetVectorIconBadge() const {
|
||||
return should_show_error_ ? vector_icons::kBlockedBadgeIcon : gfx::kNoneIcon;
|
||||
return should_show_error_ ? vector_icons::kBlockedBadgeIcon
|
||||
: gfx::VectorIcon::EmptyIcon();
|
||||
}
|
||||
|
||||
void SharingIconView::OnExecuting(
|
||||
@ -173,7 +174,8 @@ views::BubbleDialogDelegate* SharingIconView::GetBubble() const {
|
||||
|
||||
const gfx::VectorIcon& SharingIconView::GetVectorIcon() const {
|
||||
auto* controller = GetController();
|
||||
return controller ? controller->GetVectorIcon() : gfx::kNoneIcon;
|
||||
return controller ? controller->GetVectorIcon()
|
||||
: gfx::VectorIcon::EmptyIcon();
|
||||
}
|
||||
|
||||
void SharingIconView::SetAccessibleIsIgnoredIfNeeded() {
|
||||
|
@ -18,7 +18,7 @@
|
||||
#include "third_party/skia/include/core/SkBitmap.h"
|
||||
#include "ui/events/test/event_generator.h"
|
||||
#include "ui/gfx/color_palette.h"
|
||||
#include "ui/gfx/paint_vector_icon.h"
|
||||
#include "ui/gfx/vector_icon_types.h"
|
||||
#include "ui/views/accessibility/view_accessibility.h"
|
||||
#include "ui/views/controls/button/button.h"
|
||||
#include "ui/views/widget/widget_utils.h"
|
||||
@ -85,7 +85,7 @@ class TestSharingIconView : public SharingIconView {
|
||||
// PageActionIconView:
|
||||
void OnExecuting(ExecuteSource execute_source) override {}
|
||||
const gfx::VectorIcon& GetVectorIcon() const override {
|
||||
return gfx::kNoneIcon;
|
||||
return gfx::VectorIcon::EmptyIcon();
|
||||
}
|
||||
void UpdateImpl() override {}
|
||||
};
|
||||
|
@ -79,12 +79,10 @@ views::View* FocusedViewOf(views::Widget* widget) {
|
||||
return widget->GetFocusManager()->GetFocusedView();
|
||||
}
|
||||
|
||||
const gfx::VectorIcon kEmptyIcon;
|
||||
|
||||
const std::vector<sharing_hub::SharingHubAction> kFirstPartyActions = {
|
||||
{0, u"Feed to Dino", &kEmptyIcon, "feed-to-dino", 0},
|
||||
{1, u"Reverse Star", &kEmptyIcon, "reverse-star", 0},
|
||||
{2, u"Pastelify", &kEmptyIcon, "pastelify", 0},
|
||||
{0, u"Feed to Dino", &gfx::VectorIcon::EmptyIcon(), "feed-to-dino", 0},
|
||||
{1, u"Reverse Star", &gfx::VectorIcon::EmptyIcon(), "reverse-star", 0},
|
||||
{2, u"Pastelify", &gfx::VectorIcon::EmptyIcon(), "pastelify", 0},
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
@ -59,7 +59,6 @@ class ControlButtonHighlightPathGenerator
|
||||
|
||||
const int TabStripControlButton::kIconSize = 16;
|
||||
const gfx::Size TabStripControlButton::kButtonSize{28, 28};
|
||||
const gfx::VectorIcon kEmptyIcon;
|
||||
|
||||
TabStripControlButton::TabStripControlButton(
|
||||
TabStripController* tab_strip_controller,
|
||||
@ -82,7 +81,7 @@ TabStripControlButton::TabStripControlButton(
|
||||
Edge animated_flat_edge)
|
||||
: TabStripControlButton(tab_strip_controller,
|
||||
std::move(callback),
|
||||
kEmptyIcon,
|
||||
gfx::VectorIcon::EmptyIcon(),
|
||||
text,
|
||||
fixed_flat_edge,
|
||||
animated_flat_edge) {}
|
||||
|
@ -32,16 +32,13 @@
|
||||
#include "ui/color/color_id.h"
|
||||
#include "ui/gfx/canvas.h"
|
||||
#include "ui/gfx/geometry/insets.h"
|
||||
#include "ui/gfx/vector_icon_types.h"
|
||||
#include "ui/views/accessibility/view_accessibility.h"
|
||||
#include "ui/views/controls/button/button.h"
|
||||
#include "ui/views/controls/button/button_controller.h"
|
||||
#include "ui/views/view_class_properties.h"
|
||||
#include "ui/views/view_utils.h"
|
||||
|
||||
namespace {
|
||||
const gfx::VectorIcon kEmptyIcon;
|
||||
} // namespace
|
||||
|
||||
DEFINE_UI_CLASS_PROPERTY_TYPE(PinnedToolbarActionFlexPriority)
|
||||
DEFINE_UI_CLASS_PROPERTY_KEY(
|
||||
std::underlying_type_t<PinnedToolbarActionFlexPriority>,
|
||||
@ -456,7 +453,7 @@ void PinnedActionToolbarButtonActionViewInterface::OnViewChangedImpl(
|
||||
if (image_model.IsVectorIcon()) {
|
||||
action_view_->SetVectorIcon(action_view_->IsIconVisible()
|
||||
? *image_model.GetVectorIcon().vector_icon()
|
||||
: kEmptyIcon);
|
||||
: gfx::VectorIcon::EmptyIcon());
|
||||
} else {
|
||||
action_view_->SetImageModel(
|
||||
views::Button::STATE_NORMAL,
|
||||
|
@ -29,6 +29,7 @@
|
||||
#include "components/vector_icons/vector_icons.h"
|
||||
#include "ui/base/l10n/l10n_util.h"
|
||||
#include "ui/base/mojom/menu_source_type.mojom.h"
|
||||
#include "ui/gfx/paint_vector_icon.h"
|
||||
#include "ui/menus/simple_menu_model.h"
|
||||
#include "ui/views/controls/menu/menu_item_view.h"
|
||||
#include "ui/views/controls/menu/menu_model_adapter.h"
|
||||
|
@ -175,7 +175,7 @@ NotificationTesterHandler::GetRichDataSmallImageFromString(
|
||||
return kSmartphoneIcon;
|
||||
}
|
||||
|
||||
return gfx::kNoneIcon;
|
||||
return gfx::VectorIcon::EmptyIcon();
|
||||
}
|
||||
|
||||
std::vector<message_center::ButtonInfo>
|
||||
|
@ -27,8 +27,7 @@ int InfoBarDelegate::GetIconId() const {
|
||||
}
|
||||
|
||||
const gfx::VectorIcon& InfoBarDelegate::GetVectorIcon() const {
|
||||
static gfx::VectorIcon empty_icon;
|
||||
return empty_icon;
|
||||
return gfx::VectorIcon::EmptyIcon();
|
||||
}
|
||||
|
||||
ui::ImageModel InfoBarDelegate::GetIcon() const {
|
||||
|
@ -64,17 +64,6 @@ constexpr bool kIsAndroid = BUILDFLAG(IS_ANDROID);
|
||||
|
||||
namespace {
|
||||
|
||||
#if (!BUILDFLAG(IS_ANDROID) || BUILDFLAG(ENABLE_VR)) && !BUILDFLAG(IS_IOS)
|
||||
// Used for `SEARCH_SUGGEST_TAIL` and `NULL_RESULT_MESSAGE` (e.g. starter pack)
|
||||
// type suggestion icons.
|
||||
|
||||
const gfx::VectorIcon& GetEmptyIcon() {
|
||||
static const gfx::VectorIcon instance;
|
||||
return instance;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
bool IsTrivialClassification(const ACMatchClassifications& classifications) {
|
||||
return classifications.empty() ||
|
||||
((classifications.size() == 1) &&
|
||||
@ -593,7 +582,7 @@ const gfx::VectorIcon& AutocompleteMatch::GetVectorIcon(
|
||||
// Found), fallthrough to use the empty icon.
|
||||
switch (iph_type) {
|
||||
case IphType::kNone:
|
||||
return GetEmptyIcon();
|
||||
return gfx::VectorIcon::EmptyIcon();
|
||||
case IphType::kGemini:
|
||||
return omnibox::kSparkIcon;
|
||||
case IphType::kFeaturedEnterpriseSearch:
|
||||
@ -601,7 +590,7 @@ const gfx::VectorIcon& AutocompleteMatch::GetVectorIcon(
|
||||
case IphType::kHistoryEmbeddingsSettingsPromo:
|
||||
return omnibox::kSparkIcon;
|
||||
case IphType::kHistoryEmbeddingsDisclaimer:
|
||||
return GetEmptyIcon();
|
||||
return gfx::VectorIcon::EmptyIcon();
|
||||
case IphType::kHistoryScopePromo:
|
||||
return vector_icons::kHistoryChromeRefreshIcon;
|
||||
case IphType::kHistoryEmbeddingsScopePromo:
|
||||
@ -610,7 +599,7 @@ const gfx::VectorIcon& AutocompleteMatch::GetVectorIcon(
|
||||
|
||||
case Type::SEARCH_SUGGEST_TAIL:
|
||||
case Type::HISTORY_EMBEDDINGS_ANSWER:
|
||||
return GetEmptyIcon();
|
||||
return gfx::VectorIcon::EmptyIcon();
|
||||
|
||||
case Type::DOCUMENT_SUGGESTION:
|
||||
switch (document_type) {
|
||||
|
@ -11,7 +11,7 @@
|
||||
#include "content/public/browser/web_contents.h"
|
||||
|
||||
#if !BUILDFLAG(IS_ANDROID)
|
||||
#include "ui/gfx/paint_vector_icon.h"
|
||||
#include "ui/gfx/vector_icon_types.h"
|
||||
#endif
|
||||
|
||||
namespace permissions {
|
||||
@ -65,7 +65,7 @@ IconId PermissionsClient::GetOverrideIconId(RequestType request_type) {
|
||||
#if BUILDFLAG(IS_ANDROID)
|
||||
return 0;
|
||||
#else
|
||||
return gfx::kNoneIcon;
|
||||
return gfx::VectorIcon::EmptyIcon();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -20,7 +20,6 @@
|
||||
#else
|
||||
#include "components/permissions/vector_icons/vector_icons.h"
|
||||
#include "components/vector_icons/vector_icons.h"
|
||||
#include "ui/gfx/paint_vector_icon.h"
|
||||
#include "ui/gfx/vector_icon_types.h"
|
||||
#endif // BUILDFLAG(IS_ANDROID)
|
||||
|
||||
@ -167,14 +166,14 @@ const gfx::VectorIcon& GetBlockedIconIdDesktop(RequestType type) {
|
||||
return vector_icons::kStorageAccessOffIcon;
|
||||
case RequestType::kIdentityProvider:
|
||||
// TODO(crbug.com/40252825): use a dedicated icon
|
||||
return gfx::kNoneIcon;
|
||||
return gfx::VectorIcon::EmptyIcon();
|
||||
case RequestType::kKeyboardLock:
|
||||
return vector_icons::kKeyboardLockOffIcon;
|
||||
case RequestType::kPointerLock:
|
||||
return vector_icons::kPointerLockOffIcon;
|
||||
case RequestType::kWebAppInstallation:
|
||||
// TODO(crbug.com/333795265): provide a dedicated icon.
|
||||
return gfx::kNoneIcon;
|
||||
return gfx::VectorIcon::EmptyIcon();
|
||||
default:
|
||||
NOTREACHED();
|
||||
}
|
||||
|
@ -179,8 +179,7 @@ net::CertStatus LensOmniboxClient::GetCertStatus() const {
|
||||
}
|
||||
|
||||
const gfx::VectorIcon& LensOmniboxClient::GetVectorIcon() const {
|
||||
static const gfx::VectorIcon kEmptyVectorIcon = {};
|
||||
return kEmptyVectorIcon;
|
||||
return gfx::VectorIcon::EmptyIcon();
|
||||
}
|
||||
|
||||
std::optional<lens::proto::LensOverlaySuggestInputs>
|
||||
|
@ -18,7 +18,6 @@
|
||||
#include "remoting/host/it2me/it2me_confirmation_dialog.h"
|
||||
#include "ui/base/l10n/l10n_util.h"
|
||||
#include "ui/base/ui_base_types.h"
|
||||
#include "ui/gfx/paint_vector_icon.h"
|
||||
#include "ui/gfx/vector_icon_types.h"
|
||||
#include "ui/message_center/message_center.h"
|
||||
#include "ui/message_center/public/cpp/notification.h"
|
||||
@ -68,7 +67,7 @@ class It2MeConfirmationDialogChromeOS : public It2MeConfirmationDialog {
|
||||
const gfx::VectorIcon& GetIcon() const {
|
||||
switch (style_) {
|
||||
case DialogStyle::kConsumer:
|
||||
return gfx::kNoneIcon;
|
||||
return gfx::VectorIcon::EmptyIcon();
|
||||
case DialogStyle::kEnterprise:
|
||||
return chromeos::kEnterpriseIcon;
|
||||
}
|
||||
|
@ -441,7 +441,10 @@ class VectorIconSource : public CanvasImageSource {
|
||||
|
||||
VectorIconSource(const std::string& definition, int dip_size, SkColor color)
|
||||
: CanvasImageSource(Size(dip_size, dip_size)),
|
||||
data_(kNoneIcon, dip_size, color, &kNoneIcon),
|
||||
data_(VectorIcon::EmptyIcon(),
|
||||
dip_size,
|
||||
color,
|
||||
&VectorIcon::EmptyIcon()),
|
||||
path_(PathFromSource(definition)) {}
|
||||
|
||||
VectorIconSource(const VectorIconSource&) = delete;
|
||||
@ -510,15 +513,13 @@ IconDescription::IconDescription(const VectorIcon& icon,
|
||||
: icon(icon),
|
||||
dip_size(dip_size),
|
||||
color(color),
|
||||
badge_icon(badge_icon ? *badge_icon : kNoneIcon) {
|
||||
badge_icon(badge_icon ? *badge_icon : VectorIcon::EmptyIcon()) {
|
||||
if (dip_size == 0)
|
||||
this->dip_size = GetDefaultSizeOfVectorIcon(icon);
|
||||
}
|
||||
|
||||
IconDescription::~IconDescription() {}
|
||||
|
||||
const VectorIcon kNoneIcon = {};
|
||||
|
||||
void PaintVectorIcon(Canvas* canvas, const VectorIcon& icon, SkColor color) {
|
||||
PaintVectorIcon(canvas, icon, GetDefaultSizeOfVectorIcon(icon), color);
|
||||
}
|
||||
@ -550,7 +551,8 @@ ImageSkia CreateVectorIcon(const VectorIcon& icon, SkColor color) {
|
||||
ImageSkia CreateVectorIcon(const VectorIcon& icon,
|
||||
int dip_size,
|
||||
SkColor color) {
|
||||
return CreateVectorIcon(IconDescription(icon, dip_size, color, &kNoneIcon));
|
||||
return CreateVectorIcon(
|
||||
IconDescription(icon, dip_size, color, &VectorIcon::EmptyIcon()));
|
||||
}
|
||||
|
||||
ImageSkia CreateVectorIconWithBadge(const VectorIcon& icon,
|
||||
|
@ -36,8 +36,6 @@ struct COMPONENT_EXPORT(GFX) IconDescription {
|
||||
const raw_ref<const VectorIcon> badge_icon;
|
||||
};
|
||||
|
||||
COMPONENT_EXPORT(GFX) extern const VectorIcon kNoneIcon;
|
||||
|
||||
// Draws a vector icon identified by |id| onto |canvas| at (0, 0). |color| is
|
||||
// used as the fill. The size will come from the .icon file (the 1x version, if
|
||||
// multiple versions exist).
|
||||
|
@ -98,17 +98,29 @@ struct VectorIconRep {
|
||||
|
||||
// A vector icon that stores one or more representations to be used for various
|
||||
// scale factors and pixel dimensions.
|
||||
//
|
||||
// Because icons are returned and even stored as references, dynamically
|
||||
// constructing one isn't safe. Use `EmptyIcon` for empty icons, and the
|
||||
// autogenerated named icon constants for others.
|
||||
// TODO(crbug.com/343248822): Make these types easy to use safely.
|
||||
struct VectorIcon {
|
||||
VectorIcon() = default;
|
||||
static const VectorIcon& EmptyIcon() {
|
||||
static constexpr VectorIcon kEmptyIcon;
|
||||
return kEmptyIcon;
|
||||
}
|
||||
|
||||
constexpr VectorIcon(const VectorIconRep* reps_data,
|
||||
size_t reps_size,
|
||||
const char* name)
|
||||
: reps(reps_data, reps_size), name(name) {}
|
||||
|
||||
// Copying is problematic because the output of `PaintVectorIcon()` is cached
|
||||
// keyed on `VectorIcon*`, and because of the dangling ref issues mentioned
|
||||
// above.
|
||||
VectorIcon(const VectorIcon&) = delete;
|
||||
VectorIcon& operator=(const VectorIcon&) = delete;
|
||||
|
||||
bool is_empty() const { return reps.empty(); }
|
||||
constexpr bool is_empty() const { return reps.empty(); }
|
||||
|
||||
base::raw_span<const VectorIconRep> reps;
|
||||
|
||||
@ -117,7 +129,8 @@ struct VectorIcon {
|
||||
// should be careful to ensure this is unique.
|
||||
const char* name = nullptr;
|
||||
|
||||
bool operator<(const VectorIcon& other) const;
|
||||
private:
|
||||
constexpr VectorIcon() = default;
|
||||
};
|
||||
|
||||
} // namespace gfx
|
||||
|
@ -20,7 +20,6 @@
|
||||
#include "ui/gfx/color_palette.h"
|
||||
#include "ui/gfx/geometry/skia_conversions.h"
|
||||
#include "ui/gfx/image/image.h"
|
||||
#include "ui/gfx/paint_vector_icon.h"
|
||||
#include "ui/gfx/vector_icon_types.h"
|
||||
#include "ui/message_center/public/cpp/message_center_public_export.h"
|
||||
#include "ui/message_center/public/cpp/notification_delegate.h"
|
||||
@ -110,7 +109,7 @@ struct MESSAGE_CENTER_PUBLIC_EXPORT ButtonInfo {
|
||||
gfx::Image icon;
|
||||
|
||||
// Vector icon to that's used for icon-only notification buttons.
|
||||
raw_ptr<const gfx::VectorIcon> vector_icon = &gfx::kNoneIcon;
|
||||
raw_ptr<const gfx::VectorIcon> vector_icon = &gfx::VectorIcon::EmptyIcon();
|
||||
|
||||
// Accessible name to be used for the button's tooltip. Required when creating
|
||||
// an icon-only notification button.
|
||||
@ -191,7 +190,8 @@ class MESSAGE_CENTER_PUBLIC_EXPORT RichNotificationData {
|
||||
// retain VectorIcon reference. https://crbug.com/760866
|
||||
// RAW_PTR_EXCLUSION: Never allocated by PartitionAlloc (always points to a
|
||||
// global), so there is no benefit to using a raw_ptr, only cost.
|
||||
RAW_PTR_EXCLUSION const gfx::VectorIcon* vector_small_image = &gfx::kNoneIcon;
|
||||
RAW_PTR_EXCLUSION const gfx::VectorIcon* vector_small_image =
|
||||
&gfx::VectorIcon::EmptyIcon();
|
||||
|
||||
// Vector image to display on the parent notification of this notification,
|
||||
// illustrating the source of the group notification that this notification
|
||||
@ -200,7 +200,7 @@ class MESSAGE_CENTER_PUBLIC_EXPORT RichNotificationData {
|
||||
// RAW_PTR_EXCLUSION: Never allocated by PartitionAlloc (always points to a
|
||||
// global), so there is no benefit to using a raw_ptr, only cost.
|
||||
RAW_PTR_EXCLUSION const gfx::VectorIcon* parent_vector_small_image =
|
||||
&gfx::kNoneIcon;
|
||||
&gfx::VectorIcon::EmptyIcon();
|
||||
|
||||
// Items to display on the notification. Only applicable for notifications
|
||||
// that have type NOTIFICATION_TYPE_MULTIPLE.
|
||||
|
@ -104,7 +104,7 @@ TEST_F(ImageButtonFactoryWidgetTest, AccessibleCheckedStateChange) {
|
||||
CreateVectorToggleImageButton(Button::PressedCallback());
|
||||
ui::AXNodeData data;
|
||||
const ui::ImageModel& image =
|
||||
ui::ImageModel::FromVectorIcon(gfx::VectorIcon(), 23, 56);
|
||||
ui::ImageModel::FromVectorIcon(gfx::VectorIcon::EmptyIcon(), 23, 56);
|
||||
toggle_image_button->SetToggledImageModel(Button::STATE_NORMAL, image);
|
||||
EXPECT_EQ(data.GetCheckedState(), ax::mojom::CheckedState::kNone);
|
||||
|
||||
|
Reference in New Issue
Block a user