Skip to content

Commit

Permalink
Reland "[M115] Update icon for the Tailored Security desktop notifica…
Browse files Browse the repository at this point in the history
…tion"

This is a reland of commit a2070b1

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 d498f2b)
>
> Bug: 1414214
> Change-Id: I6f83423290d0237857a1926c3693efc649c65e6d
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4521439
> Reviewed-by: Ted Choc <tedchoc@chromium.org>
> Reviewed-by: Daniel Rubery <drubery@chromium.org>
> Reviewed-by: Javier Castro <jacastro@chromium.org>
> Commit-Queue: Awad Osman <awado@google.com>
> 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: 1d71a33-refs/heads/main@{#1148114}

Bug: 1414214
Change-Id: I88329f5530575c5a25462a8ade0cc27ed126ff85
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4595261
Commit-Queue: Awad Osman <awado@google.com>
Reviewed-by: Ted Choc <tedchoc@chromium.org>
Cr-Commit-Position: refs/branch-heads/5790@{#453}
Cr-Branched-From: 1d71a33-refs/heads/main@{#1148114}
  • Loading branch information
Awad Osman authored and Chromium LUCI CQ committed Jun 7, 2023
1 parent 978b2c5 commit 1a079d4
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
1 change: 1 addition & 0 deletions chrome/app/theme/theme_resources.grd
Expand Up @@ -358,6 +358,7 @@
<structure type="chrome_scaled_image" name="IDR_WEBSTORE_ICON_24" file="google_chrome/webstore_icon_24.png" />
<structure type="chrome_scaled_image" name="IDR_WEBSTORE_ICON_32" file="google_chrome/webstore_icon_32.png" />
<structure type="chrome_scaled_image" name="IDR_TRANSLATE_TAB_WORDMARK" file="google_chrome/translate_tab_wordmark.png" />
<structure type="chrome_scaled_image" name="IDR_TAILORED_SECURITY_UNCONSENTED_NOTIFICATION" file="google_chrome/safer_with_google_blue_shield.png" />
</if>
</if>
<if expr="not is_android">
Expand Down
Expand Up @@ -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"
Expand Down Expand Up @@ -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;
Expand All @@ -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,
Expand Down

0 comments on commit 1a079d4

Please sign in to comment.