Chromium Code Reviews| Index: content/browser/renderer_host/mouse_wheel_phase_handler.h |
| diff --git a/content/browser/renderer_host/mouse_wheel_phase_handler.h b/content/browser/renderer_host/mouse_wheel_phase_handler.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..7d0fe9ed6fae7da6eb393b44576ee0bad44c2f06 |
| --- /dev/null |
| +++ b/content/browser/renderer_host/mouse_wheel_phase_handler.h |
| @@ -0,0 +1,49 @@ |
| +// Copyright (c) 2017 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef MOUSE_WHEEL_PHASE_HANDLER_H_ |
| +#define MOUSE_WHEEL_PHASE_HANDLER_H_ |
| + |
| +#include "base/timer/timer.h" |
| +#include "content/browser/renderer_host/render_widget_host_delegate.h" |
| +#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.
|
| +#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.
|
| + |
| +namespace content { |
| +// The duration after which a synthetic wheel with zero deltas and |
| +// phase = |kPhaseEnded| will be sent after the last wheel event. |
| +const int64_t kDefaultMouseWheelLatchingTransactionMs = 100; |
| + |
| +class MouseWheelPhaseHandler { |
| + public: |
| + MouseWheelPhaseHandler(RenderWidgetHostImpl* host, |
| + RenderWidgetHostViewBase* host_view); |
|
tdresser
2017/06/05 15:19:08
Should the parameters be const?
sahel
2017/06/05 19:05:43
Done.
|
| + ~MouseWheelPhaseHandler() {} |
| + |
| + void AddPhaseIfNeededAndScheduleEndEvent( |
| + blink::WebMouseWheelEvent& mouse_wheel_event, |
| + bool should_route_event); |
| + void DispatchPendingWheelEndEvent(); |
| + void IgnorePendingWheelEndEvent(); |
| + bool HasPendingWheelEndEvent() { |
|
tdresser
2017/06/05 15:19:08
Can this be const?
sahel
2017/06/05 19:05:43
Done.
|
| + return mouse_wheel_end_dispatch_timer_.IsRunning(); |
| + } |
| + |
| + private: |
| + void SendSyntheticWheelEventWithPhaseEnded( |
| + blink::WebMouseWheelEvent last_mouse_wheel_event, |
| + bool should_route_event); |
| + void ScheduleMouseWheelEndDispatching(blink::WebMouseWheelEvent wheel_event, |
| + bool should_route_event); |
| + |
| + RenderWidgetHostImpl* const host_; |
| + RenderWidgetHostViewBase* const host_view_; |
| + base::OneShotTimer mouse_wheel_end_dispatch_timer_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(MouseWheelPhaseHandler); |
| +}; |
| + |
| +} // namespace content |
| + |
| +#endif // MOUSE_WHEEL_PHASE_HANDLER_H_ |