| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ui/arc/notification/arc_custom_notification_view.h" | 5 #include "ui/arc/notification/arc_custom_notification_view.h" |
| 6 | 6 |
| 7 #include "ash/wm/window_util.h" | 7 #include "ash/wm/window_util.h" |
| 8 #include "base/auto_reset.h" | 8 #include "base/auto_reset.h" |
| 9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 #include "components/exo/notification_surface.h" | 10 #include "components/exo/notification_surface.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 if (owner_->floating_control_buttons_widget_ && event->target() && | 41 if (owner_->floating_control_buttons_widget_ && event->target() && |
| 42 owner_->floating_control_buttons_widget_->GetNativeWindow() == | 42 owner_->floating_control_buttons_widget_->GetNativeWindow() == |
| 43 event->target()) { | 43 event->target()) { |
| 44 return; | 44 return; |
| 45 } | 45 } |
| 46 | 46 |
| 47 if (event->IsScrollEvent()) { | 47 if (event->IsScrollEvent()) { |
| 48 ForwardScrollEvent(event->AsScrollEvent()); | 48 ForwardScrollEvent(event->AsScrollEvent()); |
| 49 } else if (event->IsMouseWheelEvent()) { | 49 } else if (event->IsMouseWheelEvent()) { |
| 50 ForwardMouseWheelEvent(event->AsMouseWheelEvent()); | 50 ForwardMouseWheelEvent(event->AsMouseWheelEvent()); |
| 51 } else if (!event->IsTouchEvent()) { | 51 } else if (!event->IsTouchEvent() && event->type() != ui::ET_GESTURE_TAP) { |
| 52 // TODO(yoshiki): Use a better tigger (eg. focusing EditText on | 52 // TODO(yoshiki): Use a better tigger (eg. focusing EditText on |
| 53 // notification) than clicking (crbug.com/697379). | 53 // notification) than clicking (crbug.com/697379). |
| 54 if (event->type() == ui::ET_MOUSE_PRESSED) | 54 if (event->type() == ui::ET_MOUSE_PRESSED) |
| 55 owner_->ActivateToast(); | 55 owner_->ActivateToast(); |
| 56 | 56 |
| 57 // Forward the rest events to |owner_| except touches because View | 57 // Forward the rest events to |owner_| except for: |
| 58 // should no longer receive touch events. See View::OnTouchEvent. | 58 // 1. Touches, because View should no longer receive touch events. |
| 59 // See View::OnTouchEvent. |
| 60 // 2. Tap gestures are handled on the Android side, so ignore them. |
| 61 // See crbug.com/709911. |
| 59 owner_->OnEvent(event); | 62 owner_->OnEvent(event); |
| 60 } | 63 } |
| 61 } | 64 } |
| 62 | 65 |
| 63 void ForwardScrollEvent(ui::ScrollEvent* event) { | 66 void ForwardScrollEvent(ui::ScrollEvent* event) { |
| 64 views::Widget* widget = owner_->GetWidget(); | 67 views::Widget* widget = owner_->GetWidget(); |
| 65 if (!widget) | 68 if (!widget) |
| 66 return; | 69 return; |
| 67 | 70 |
| 68 event->target()->ConvertEventToTarget(widget->GetNativeWindow(), event); | 71 event->target()->ConvertEventToTarget(widget->GetNativeWindow(), event); |
| (...skipping 548 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 617 | 620 |
| 618 void ArcCustomNotificationView::OnNotificationSurfaceRemoved( | 621 void ArcCustomNotificationView::OnNotificationSurfaceRemoved( |
| 619 exo::NotificationSurface* surface) { | 622 exo::NotificationSurface* surface) { |
| 620 if (surface->notification_id() != notification_key_) | 623 if (surface->notification_id() != notification_key_) |
| 621 return; | 624 return; |
| 622 | 625 |
| 623 SetSurface(nullptr); | 626 SetSurface(nullptr); |
| 624 } | 627 } |
| 625 | 628 |
| 626 } // namespace arc | 629 } // namespace arc |
| OLD | NEW |