Skip to content

Commit f9c03ea

Browse files
cdesouza-chromiummkarolin
authored andcommitted
[cr133] VectorIcon default constructor made private
This change corrects all places where a default vector was being used to now use `VectorIcon::EmptyIcon()`, which is the correct way to retrieve a default empty vector icon. Chromium change: https://chromium.googlesource.com/chromium/src/+/76462a6abb5b146cca49f95c8559d548304ad77b commit 76462a6abb5b146cca49f95c8559d548304ad77b Author: Peter Kasting <[email protected]> Date: Thu Jan 2 13:00:15 2025 -0800 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
1 parent 4aa6504 commit f9c03ea

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

chromium_src/chrome/browser/ui/content_settings/content_setting_image_model.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
#include "brave/browser/ui/content_settings/brave_content_setting_image_models.h"
99
#include "brave/components/vector_icons/vector_icons.h"
10+
#include "ui/gfx/vector_icon_types.h"
1011

1112
#define GenerateContentSettingImageModels \
1213
GenerateContentSettingImageModels_ChromiumImpl
@@ -27,7 +28,8 @@ void ContentSettingImageModel::GetIconFromType(
2728
raw_ptr<const gfx::VectorIcon>* icon,
2829
raw_ptr<const gfx::VectorIcon>* badge) {
2930
if (type == ContentSettingsType::AUTOPLAY) {
30-
*badge = (blocked ? &vector_icons::kBlockedBadgeIcon : &gfx::kNoneIcon);
31+
*badge = (blocked ? &vector_icons::kBlockedBadgeIcon
32+
: &gfx::VectorIcon::EmptyIcon());
3133
*icon = &kAutoplayStatusIcon;
3234
} else {
3335
::GetIconFromType(type, blocked, icon, badge);

chromium_src/chrome/browser/ui/views/profiles/profile_menu_view.cc

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,6 @@
66
#include "chrome/app/vector_icons/vector_icons.h"
77
#include "ui/gfx/vector_icon_types.h"
88

9-
namespace {
10-
constexpr gfx::VectorIcon kGuestMenuEmptyArtIcon;
11-
} // namespace
12-
13-
#define kGuestMenuArtIcon kGuestMenuEmptyArtIcon
9+
#define kGuestMenuArtIcon gfx::VectorIcon::EmptyIcon()
1410
#include "src/chrome/browser/ui/views/profiles/profile_menu_view.cc"
1511
#undef kGuestMenuArtIcon

0 commit comments

Comments
 (0)