OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2017 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef MOUSE_WHEEL_PHASE_HANDLER_H_ | |
6 #define MOUSE_WHEEL_PHASE_HANDLER_H_ | |
7 | |
8 #include "base/timer/timer.h" | |
9 #include "content/browser/renderer_host/render_widget_host_delegate.h" | |
10 #include "content/browser/renderer_host/render_widget_host_impl.h" | |
tdresser
2017/06/05 15:19:08
Forward declare instead of include.
sahel
2017/06/05 19:05:43
Done.
| |
11 #include "content/browser/renderer_host/render_widget_host_view_base.h" | |
tdresser
2017/06/05 15:19:08
Forward declare instead of include.
sahel
2017/06/05 19:05:43
Done.
| |
12 | |
13 namespace content { | |
14 // The duration after which a synthetic wheel with zero deltas and | |
15 // phase = |kPhaseEnded| will be sent after the last wheel event. | |
16 const int64_t kDefaultMouseWheelLatchingTransactionMs = 100; | |
17 | |
18 class MouseWheelPhaseHandler { | |
19 public: | |
20 MouseWheelPhaseHandler(RenderWidgetHostImpl* host, | |
21 RenderWidgetHostViewBase* host_view); | |
tdresser
2017/06/05 15:19:08
Should the parameters be const?
sahel
2017/06/05 19:05:43
Done.
| |
22 ~MouseWheelPhaseHandler() {} | |
23 | |
24 void AddPhaseIfNeededAndScheduleEndEvent( | |
25 blink::WebMouseWheelEvent& mouse_wheel_event, | |
26 bool should_route_event); | |
27 void DispatchPendingWheelEndEvent(); | |
28 void IgnorePendingWheelEndEvent(); | |
29 bool HasPendingWheelEndEvent() { | |
tdresser
2017/06/05 15:19:08
Can this be const?
sahel
2017/06/05 19:05:43
Done.
| |
30 return mouse_wheel_end_dispatch_timer_.IsRunning(); | |
31 } | |
32 | |
33 private: | |
34 void SendSyntheticWheelEventWithPhaseEnded( | |
35 blink::WebMouseWheelEvent last_mouse_wheel_event, | |
36 bool should_route_event); | |
37 void ScheduleMouseWheelEndDispatching(blink::WebMouseWheelEvent wheel_event, | |
38 bool should_route_event); | |
39 | |
40 RenderWidgetHostImpl* const host_; | |
41 RenderWidgetHostViewBase* const host_view_; | |
42 base::OneShotTimer mouse_wheel_end_dispatch_timer_; | |
43 | |
44 DISALLOW_COPY_AND_ASSIGN(MouseWheelPhaseHandler); | |
45 }; | |
46 | |
47 } // namespace content | |
48 | |
49 #endif // MOUSE_WHEEL_PHASE_HANDLER_H_ | |
OLD | NEW |