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

Side by Side Diff: ui/arc/notification/arc_custom_notification_view.cc

Issue 2291193003: arc: Fix mouse scroll on notification (Closed)
Patch Set: comment on why not forward touches Created 4 years, 3 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "components/exo/notification_surface.h" 7 #include "components/exo/notification_surface.h"
8 #include "components/exo/surface.h" 8 #include "components/exo/surface.h"
9 #include "third_party/skia/include/core/SkColor.h" 9 #include "third_party/skia/include/core/SkColor.h"
10 #include "ui/base/l10n/l10n_util.h" 10 #include "ui/base/l10n/l10n_util.h"
(...skipping 22 matching lines...) Expand all
33 // ui::EventHandler 33 // ui::EventHandler
34 void OnEvent(ui::Event* event) override { 34 void OnEvent(ui::Event* event) override {
35 // Do not forward event targeted to the floating close button so that 35 // Do not forward event targeted to the floating close button so that
36 // keyboard press and tap are handled properly. 36 // keyboard press and tap are handled properly.
37 if (owner_->floating_close_button_widget_ && event->target() && 37 if (owner_->floating_close_button_widget_ && event->target() &&
38 owner_->floating_close_button_widget_->GetNativeWindow() == 38 owner_->floating_close_button_widget_->GetNativeWindow() ==
39 event->target()) { 39 event->target()) {
40 return; 40 return;
41 } 41 }
42 42
43 owner_->OnEvent(event); 43 if (event->IsScrollEvent()) {
44 ForwardScrollEvent(event->AsScrollEvent());
45 } else if (event->IsMouseWheelEvent()) {
46 ForwardMouseWheelEvent(event->AsMouseWheelEvent());
47 } else if (!event->IsTouchEvent()) {
48 // Forward the rest events to |owner_| except touches because View
49 // should no longer receive touch events. See View::OnTouchEvent.
50 owner_->OnEvent(event);
51 }
52 }
53
54 void ForwardScrollEvent(ui::ScrollEvent* event) {
55 views::Widget* widget = owner_->GetWidget();
56 if (!widget)
57 return;
58
59 event->target()->ConvertEventToTarget(widget->GetNativeWindow(), event);
60 widget->OnScrollEvent(event);
61 }
62
63 void ForwardMouseWheelEvent(ui::MouseWheelEvent* event) {
64 views::Widget* widget = owner_->GetWidget();
65 if (!widget)
66 return;
67
68 event->target()->ConvertEventToTarget(widget->GetNativeWindow(), event);
69 widget->OnMouseEvent(event);
44 } 70 }
45 71
46 ArcCustomNotificationView* const owner_; 72 ArcCustomNotificationView* const owner_;
47 73
48 DISALLOW_COPY_AND_ASSIGN(EventForwarder); 74 DISALLOW_COPY_AND_ASSIGN(EventForwarder);
49 }; 75 };
50 76
51 class ArcCustomNotificationView::SlideHelper 77 class ArcCustomNotificationView::SlideHelper
52 : public ui::LayerAnimationObserver { 78 : public ui::LayerAnimationObserver {
53 public: 79 public:
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 } else if (!item_->pinned() && !floating_close_button_widget_) { 345 } else if (!item_->pinned() && !floating_close_button_widget_) {
320 CreateFloatingCloseButton(); 346 CreateFloatingCloseButton();
321 } 347 }
322 } 348 }
323 349
324 void ArcCustomNotificationView::OnItemNotificationSurfaceRemoved() { 350 void ArcCustomNotificationView::OnItemNotificationSurfaceRemoved() {
325 SetSurface(nullptr); 351 SetSurface(nullptr);
326 } 352 }
327 353
328 } // namespace arc 354 } // namespace arc
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698