Commit 8c005939 authored by Joe DeBlasio's avatar Joe DeBlasio Committed by Commit Bot

Add banner to safety tips.

This CL adds a banner to the Safety Tip bubble on desktop platforms. It
introduces two UIs: one for URL lookalikes, and one for suspicious
sites.

It now looks like this:
https://drive.google.com/file/d/1RppvDBXThzzbu5CknJ_-nYP6iKkXH8l6/view

Bug: 1013401
Change-Id: Id2eef386ddeedc89535f8e8097a8348bf2572558
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1865539Reviewed-by: default avatarMitsuru Oshima <oshima@chromium.org>
Commit-Queue: Joe DeBlasio <jdeblasio@chromium.org>
Cr-Commit-Position: refs/heads/master@{#706656}
parent 79e9069d
...@@ -251,6 +251,10 @@ ...@@ -251,6 +251,10 @@
<structure type="chrome_scaled_image" name="IDR_RESET_WARNING" file="cros/reset_warning.png" /> <structure type="chrome_scaled_image" name="IDR_RESET_WARNING" file="cros/reset_warning.png" />
</if> </if>
<structure type="chrome_scaled_image" name="IDR_RESTORE_BUTTON_MASK" file="common/restore_button_mask.png" /> <structure type="chrome_scaled_image" name="IDR_RESTORE_BUTTON_MASK" file="common/restore_button_mask.png" />
<if expr="not is_android">
<structure type="chrome_scaled_image" name="IDR_SAFETY_TIP_LOOKALIKE_ILLUSTRATION" file="common/safety_tip_lookalike_illustration.png" />
<structure type="chrome_scaled_image" name="IDR_SAFETY_TIP_SUSPICIOUS_ILLUSTRATION" file="common/safety_tip_suspicious_illustration.png" />
</if>
<structure type="chrome_scaled_image" name="IDR_SCREEN_CAPTURE_NOTIFICATION_GRIP" file="screen_capture_notification_grip.png" /> <structure type="chrome_scaled_image" name="IDR_SCREEN_CAPTURE_NOTIFICATION_GRIP" file="screen_capture_notification_grip.png" />
<if expr="chromeos"> <if expr="chromeos">
<structure type="chrome_scaled_image" name="IDR_SECONDARY_USER_SETTINGS" file="cros/secondary_user_settings.png" /> <structure type="chrome_scaled_image" name="IDR_SECONDARY_USER_SETTINGS" file="cros/secondary_user_settings.png" />
......
...@@ -32,6 +32,25 @@ ...@@ -32,6 +32,25 @@
using security_state::SafetyTipStatus; using security_state::SafetyTipStatus;
namespace {
int GetSafetyTipBannerId(security_state::SafetyTipStatus safety_tip_status) {
switch (safety_tip_status) {
case security_state::SafetyTipStatus::kBadReputation:
return IDR_SAFETY_TIP_SUSPICIOUS_ILLUSTRATION;
case security_state::SafetyTipStatus::kLookalike:
return IDR_SAFETY_TIP_LOOKALIKE_ILLUSTRATION;
case security_state::SafetyTipStatus::kBadKeyword:
case security_state::SafetyTipStatus::kUnknown:
case security_state::SafetyTipStatus::kNone:
NOTREACHED();
}
NOTREACHED();
return IDR_SAFETY_TIP_SUSPICIOUS_ILLUSTRATION;
}
} // namespace
SafetyTipPageInfoBubbleView::SafetyTipPageInfoBubbleView( SafetyTipPageInfoBubbleView::SafetyTipPageInfoBubbleView(
views::View* anchor_view, views::View* anchor_view,
const gfx::Rect& anchor_rect, const gfx::Rect& anchor_rect,
...@@ -91,7 +110,15 @@ SafetyTipPageInfoBubbleView::SafetyTipPageInfoBubbleView( ...@@ -91,7 +110,15 @@ SafetyTipPageInfoBubbleView::SafetyTipPageInfoBubbleView(
bubble_col_set->AddColumn(views::GridLayout::LEADING, views::GridLayout::FILL, bubble_col_set->AddColumn(views::GridLayout::LEADING, views::GridLayout::FILL,
1.0, views::GridLayout::USE_PREF, 0, 0); 1.0, views::GridLayout::USE_PREF, 0, 0);
// TODO(crbug/996731): Add banner once available. See crrev/c/1816805/7. ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
const gfx::ImageSkia* image =
rb.GetNativeImageNamed(GetSafetyTipBannerId(safety_tip_status))
.ToImageSkia();
auto image_view = std::make_unique<NonAccessibleImageView>();
image_view->SetImage(*image);
views::BubbleFrameView* frame_view = GetBubbleFrameView();
CHECK(frame_view);
frame_view->SetHeaderView(std::move(image_view));
auto bottom_view = std::make_unique<views::View>(); auto bottom_view = std::make_unique<views::View>();
views::GridLayout* bottom_layout = views::GridLayout* bottom_layout =
......
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