Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(352)

Unified Diff: ui/arc/notification/arc_custom_notification_view.cc

Issue 2269143004: arc: Update notification close button image (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comment padding consts are in DIPs and move floating close button test into EventForwarder Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | ui/resources/default_100_percent/common/arc_notification_close.png » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/arc/notification/arc_custom_notification_view.cc
diff --git a/ui/arc/notification/arc_custom_notification_view.cc b/ui/arc/notification/arc_custom_notification_view.cc
index 7c171d135e83284eb7e9c0fb9552c9c629cf99d3..b17c2344b27f5c27eac41b543205558d04edd53c 100644
--- a/ui/arc/notification/arc_custom_notification_view.cc
+++ b/ui/arc/notification/arc_custom_notification_view.cc
@@ -31,7 +31,17 @@ class ArcCustomNotificationView::EventForwarder : public ui::EventHandler {
private:
// ui::EventHandler
- void OnEvent(ui::Event* event) override { owner_->OnEvent(event); }
+ void OnEvent(ui::Event* event) override {
+ // Do not forward event targeted to the floating close button so that
+ // keyboard press and tap are handled properly.
+ if (owner_->floating_close_button_widget_ && event->target() &&
+ owner_->floating_close_button_widget_->GetNativeWindow() ==
+ event->target()) {
+ return;
+ }
+
+ owner_->OnEvent(event);
+ }
ArcCustomNotificationView* const owner_;
@@ -125,19 +135,20 @@ void ArcCustomNotificationView::CreateFloatingCloseButton() {
floating_close_button_ = new views::ImageButton(this);
floating_close_button_->set_background(
views::Background::CreateSolidBackground(SK_ColorTRANSPARENT));
- floating_close_button_->SetBorder(
- views::Border::CreateEmptyBorder(5, 5, 5, 5));
+
+ // The sizes below are in DIPs.
+ constexpr int kPaddingFromBorder = 4;
+ constexpr int kImageSize = 16;
+ constexpr int kTouchExtendedPadding =
+ message_center::kControlButtonSize - kImageSize - kPaddingFromBorder;
+ floating_close_button_->SetBorder(views::Border::CreateEmptyBorder(
+ kPaddingFromBorder, kTouchExtendedPadding, kTouchExtendedPadding,
+ kPaddingFromBorder));
ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
floating_close_button_->SetImage(
views::CustomButton::STATE_NORMAL,
- rb.GetImageSkiaNamed(IDR_NOTIFICATION_CLOSE));
- floating_close_button_->SetImage(
- views::CustomButton::STATE_HOVERED,
- rb.GetImageSkiaNamed(IDR_NOTIFICATION_CLOSE_HOVER));
- floating_close_button_->SetImage(
- views::CustomButton::STATE_PRESSED,
- rb.GetImageSkiaNamed(IDR_NOTIFICATION_CLOSE_PRESSED));
+ rb.GetImageSkiaNamed(IDR_ARC_NOTIFICATION_CLOSE));
floating_close_button_->set_animate_on_state_change(false);
floating_close_button_->SetAccessibleName(l10n_util::GetStringUTF16(
IDS_MESSAGE_CENTER_CLOSE_NOTIFICATION_BUTTON_ACCESSIBLE_NAME));
« no previous file with comments | « no previous file | ui/resources/default_100_percent/common/arc_notification_close.png » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698