Chromium Code Reviews| 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 b3f1259860239a647c0826374c8c8bb7a35de6e8..d34be77ed3548857f6a6060a68b5042b4ce11851 100644 |
| --- a/ui/arc/notification/arc_custom_notification_view.cc |
| +++ b/ui/arc/notification/arc_custom_notification_view.cc |
| @@ -64,41 +64,35 @@ class ArcCustomNotificationView::EventForwarder : public ui::EventHandler { |
| return; |
| } |
| - if (event->IsScrollEvent()) { |
| - ForwardScrollEvent(event->AsScrollEvent()); |
| - } else if (event->IsMouseWheelEvent()) { |
| - ForwardMouseWheelEvent(event->AsMouseWheelEvent()); |
| - } else if (!event->IsTouchEvent() && event->type() != ui::ET_GESTURE_TAP) { |
| - // TODO(yoshiki): Use a better tigger (eg. focusing EditText on |
| - // notification) than clicking (crbug.com/697379). |
| - if (event->type() == ui::ET_MOUSE_PRESSED) |
| - owner_->ActivateToast(); |
| - |
| - // Forward the rest events to |owner_| except for: |
| - // 1. Touches, because View should no longer receive touch events. |
| - // See View::OnTouchEvent. |
| - // 2. Tap gestures are handled on the Android side, so ignore them. |
| - // See crbug.com/709911. |
| - owner_->OnEvent(event); |
| - } |
| - } |
| - |
| - void ForwardScrollEvent(ui::ScrollEvent* event) { |
| - views::Widget* widget = owner_->GetWidget(); |
| - if (!widget) |
| - return; |
| - |
| - event->target()->ConvertEventToTarget(widget->GetNativeWindow(), event); |
| - widget->OnScrollEvent(event); |
| - } |
| + // TODO(yoshiki): Use a better tigger (eg. focusing EditText on |
| + // notification) than clicking (crbug.com/697379). |
| + if (event->type() == ui::ET_MOUSE_PRESSED) |
| + owner_->ActivateToast(); |
| - void ForwardMouseWheelEvent(ui::MouseWheelEvent* event) { |
| views::Widget* widget = owner_->GetWidget(); |
| if (!widget) |
| return; |
| - event->target()->ConvertEventToTarget(widget->GetNativeWindow(), event); |
| - widget->OnMouseEvent(event); |
| + // Forward the events to the containing widget, except for: |
| + // 1. Touches, because View should no longer receive touch events. |
| + // See View::OnTouchEvent. |
| + // 2. Tap gestures are handled on the Android side, so ignore them. |
| + // See crbug.com/709911. |
| + if (event->IsLocatedEvent()) { |
| + ui::LocatedEvent* located_event = event->AsLocatedEvent(); |
| + located_event->target()->ConvertEventToTarget(widget->GetNativeWindow(), |
| + located_event); |
| + if (located_event->type() == ui::ET_MOUSE_MOVED) |
| + widget->OnMouseEvent(located_event->AsMouseEvent()); |
| + else if (located_event->IsScrollEvent()) |
| + widget->OnScrollEvent(located_event->AsScrollEvent()); |
| + else if (located_event->IsGestureEvent() && |
| + event->type() != ui::ET_GESTURE_TAP) |
| + widget->OnGestureEvent(located_event->AsGestureEvent()); |
| + } else { |
| + if (event->IsKeyEvent()) |
| + widget->OnKeyEvent(event->AsKeyEvent()); |
|
yoshiki
2017/05/16 08:09:12
Is this necessary? I think key events are passed t
Eliot Courtney
2017/05/16 09:15:54
Good catch - yes this is not necessary, and ends u
|
| + } |
| } |
| ArcCustomNotificationView* const owner_; |
| @@ -202,6 +196,11 @@ class ArcCustomNotificationView::ContentViewDelegate |
| owner_->UpdateControlButtonsVisibility(); |
| } |
| + void OnSlideChanged() override { |
| + if (owner_->slide_helper_) |
| + owner_->slide_helper_->Update(); |
| + } |
| + |
| private: |
| ArcCustomNotificationView* const owner_; |
| @@ -572,20 +571,6 @@ void ArcCustomNotificationView::OnPaint(gfx::Canvas* canvas) { |
| contents_bounds.height(), false); |
| } |
| -void ArcCustomNotificationView::OnKeyEvent(ui::KeyEvent* event) { |
| - // Forward to parent CustomNotificationView to handle keyboard dismissal. |
| - parent()->OnKeyEvent(event); |
| -} |
| - |
| -void ArcCustomNotificationView::OnGestureEvent(ui::GestureEvent* event) { |
| - // Forward to parent CustomNotificationView to handle sliding out. |
| - parent()->OnGestureEvent(event); |
| - |
| - // |slide_helper_| could be null before |surface_| is attached. |
| - if (slide_helper_) |
| - slide_helper_->Update(); |
| -} |
| - |
| void ArcCustomNotificationView::OnMouseEntered(const ui::MouseEvent&) { |
| UpdateControlButtonsVisibility(); |
| } |