| Index: ui/compositor/overscroll/ui_scroll_input_manager.cc
|
| diff --git a/ui/compositor/overscroll/ui_scroll_input_manager.cc b/ui/compositor/overscroll/ui_scroll_input_manager.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..2771d4c6a90e4099a9bd184628b0e0521521098d
|
| --- /dev/null
|
| +++ b/ui/compositor/overscroll/ui_scroll_input_manager.cc
|
| @@ -0,0 +1,37 @@
|
| +// Copyright 2016 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.
|
| +
|
| +#include "ui/compositor/overscroll/ui_scroll_input_manager.h"
|
| +
|
| +#include "base/logging.h"
|
| +#include "ui/compositor/overscroll/ui_input_handler.h"
|
| +#include "ui/events/event.h"
|
| +
|
| +namespace ui {
|
| +
|
| +UIScrollInputManager::UIScrollInputManager(
|
| + const base::WeakPtr<cc::InputHandler>& input_handler)
|
| + : input_wrapper_(new UIInputHandler(input_handler)) {}
|
| +
|
| +UIScrollInputManager::~UIScrollInputManager() {}
|
| +
|
| +void UIScrollInputManager::OnScrollEvent(const ScrollEvent& event) {
|
| + // On Mac, an event ending the non-fling portion of a scroll can't be
|
| + // distinguished from an event ending a scroll that won't fling. The start of
|
| + // the fling is therefore made identifiable by being an an update only (not a
|
| + // "begin"). But since the InputHandler has already been told of the end,
|
| + // treat the first momentum fling as a "resume" by holding state.
|
| + if (!scrolling_) {
|
| + scrolling_ = true;
|
| + input_wrapper_->HandleScrollBegin(event);
|
| + }
|
| + input_wrapper_->HandleScrollUpdate(event);
|
| + if (event.momentum_phase() & EM_PHASE_END) {
|
| + DCHECK(scrolling_);
|
| + scrolling_ = false;
|
| + input_wrapper_->HandleScrollEnd(event);
|
| + }
|
| +}
|
| +
|
| +} // namespace ui
|
|
|