From 1a079d4ec9299ced90c6060bf2efdd04bd517c58 Mon Sep 17 00:00:00 2001 From: Awad Osman Date: Wed, 7 Jun 2023 15:34:58 +0000 Subject: [PATCH] Reland "[M115] Update icon for the Tailored Security desktop notification" This is a reland of commit a2070b10c66c1ef50ffd947779a185d3837c01f5 Original change's description: > [M115] Update icon for the Tailored Security desktop notification > > This change replaces the old blue checkmark icon for the Tailored > security desktop notification and updates it to the blue google shield > icon depending on the status of our feature flag. > > Old Screenshot: https://screenshot.googleplex.com/5YU6iApKaoYFPL7.png > New Screenshot: https://screenshot.googleplex.com/AnuUPcDYJZ5j4wb.png > > (cherry picked from commit d498f2bd440f959551d5f800b9e8119ec5472922) > > Bug: 1414214 > Change-Id: I6f83423290d0237857a1926c3693efc649c65e6d > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4521439 > Reviewed-by: Ted Choc > Reviewed-by: Daniel Rubery > Reviewed-by: Javier Castro > Commit-Queue: Awad Osman > Cr-Original-Commit-Position: refs/heads/main@{#1152046} > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4591271 > Cr-Commit-Position: refs/branch-heads/5790@{#386} > Cr-Branched-From: 1d71a337b1f6e707a13ae074dca1e2c34905eb9f-refs/heads/main@{#1148114} Bug: 1414214 Change-Id: I88329f5530575c5a25462a8ade0cc27ed126ff85 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4595261 Commit-Queue: Awad Osman Reviewed-by: Ted Choc Cr-Commit-Position: refs/branch-heads/5790@{#453} Cr-Branched-From: 1d71a337b1f6e707a13ae074dca1e2c34905eb9f-refs/heads/main@{#1148114} --- chrome/app/theme/theme_resources.grd | 1 + .../notification_handler_desktop.cc | 23 ++++++++++++++----- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/chrome/app/theme/theme_resources.grd b/chrome/app/theme/theme_resources.grd index cbc877b14bca5b..0aec5267f58ec7 100644 --- a/chrome/app/theme/theme_resources.grd +++ b/chrome/app/theme/theme_resources.grd @@ -358,6 +358,7 @@ + diff --git a/chrome/browser/safe_browsing/tailored_security/notification_handler_desktop.cc b/chrome/browser/safe_browsing/tailored_security/notification_handler_desktop.cc index 054c3576404fb2..f15e0883358081 100644 --- a/chrome/browser/safe_browsing/tailored_security/notification_handler_desktop.cc +++ b/chrome/browser/safe_browsing/tailored_security/notification_handler_desktop.cc @@ -18,6 +18,7 @@ #include "chrome/grit/chromium_strings.h" #include "chrome/grit/generated_resources.h" #include "chrome/grit/google_chrome_strings.h" +#include "chrome/grit/theme_resources.h" #include "components/prefs/pref_service.h" #include "components/safe_browsing/core/browser/tailored_security_service/tailored_security_outcome.h" #include "components/safe_browsing/core/common/features.h" @@ -111,6 +112,16 @@ void TailoredSecurityNotificationHandler::OnClick( std::move(completed_closure).Run(); } +ui::ImageModel GetNotificationIcon() { +#if BUILDFLAG(GOOGLE_CHROME_BRANDING) + return ui::ImageModel::FromResourceId( + IDR_TAILORED_SECURITY_UNCONSENTED_NOTIFICATION); +#else + return ui::ImageModel::FromVectorIcon(kSafetyCheckIcon, ui::kColorAccent, + message_center::kNotificationIconSize); +#endif +} + void DisplayTailoredSecurityUnconsentedPromotionNotification(Profile* profile) { std::string notification_id = kTailoredSecurityUnconsentedPromotionNotificationId; @@ -132,12 +143,12 @@ void DisplayTailoredSecurityUnconsentedPromotionNotification(Profile* profile) { #else const message_center::NotifierId notifier_id = GetNotifierId(); #endif - - // TODO(crbug/1257622): Confirm with UX that it's appropriate to use the - // blue color here. - auto icon = - ui::ImageModel::FromVectorIcon(kSafetyCheckIcon, ui::kColorAccent, - message_center::kNotificationIconSize); + auto icon = (base::FeatureList::IsEnabled( + safe_browsing::kTailoredSecurityUpdatedMessages)) + ? GetNotificationIcon() + : ui::ImageModel::FromVectorIcon( + kSafetyCheckIcon, ui::kColorAccent, + message_center::kNotificationIconSize); LogUnconsentedOutcome(TailoredSecurityOutcome::kShown); message_center::Notification notification( message_center::NOTIFICATION_TYPE_SIMPLE, notification_id, title,