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..5b28eecf02b84efc61a8839d1d198c7b4ab1ee9b 100644 |
--- a/ui/arc/notification/arc_custom_notification_view.cc |
+++ b/ui/arc/notification/arc_custom_notification_view.cc |
@@ -125,19 +125,19 @@ 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)); |
+ |
+ constexpr int kPaddingFromBorder = 4; |
+ constexpr int kImageSize = 16; |
+ constexpr int kTouchExtendedPadding = |
yoshiki
2016/08/24 09:24:32
nit: could you mention about units in comment? I a
xiyuan
2016/08/24 15:26:50
Done.
|
+ 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)); |
@@ -257,11 +257,23 @@ void ArcCustomNotificationView::Layout() { |
} |
void ArcCustomNotificationView::OnKeyEvent(ui::KeyEvent* event) { |
+ // Do not handle event targeted to the floating close button. |
+ if (floating_close_button_widget_ && event->target() && |
+ floating_close_button_widget_->GetNativeWindow() == event->target()) { |
+ return; |
+ } |
+ |
// Forward to parent CustomNotificationView to handle keyboard dismissal. |
parent()->OnKeyEvent(event); |
} |
void ArcCustomNotificationView::OnGestureEvent(ui::GestureEvent* event) { |
+ // Do not handle event targeted to the floating close button. |
+ if (floating_close_button_widget_ && event->target() && |
+ floating_close_button_widget_->GetNativeWindow() == event->target()) { |
+ return; |
+ } |
+ |
// Forward to parent CustomNotificationView to handle sliding out. |
parent()->OnGestureEvent(event); |
slide_helper_->Update(); |