| 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..0fab351417b9a8c0ccf7f7f608473c7fea56f751
|
| --- /dev/null
|
| +++ b/ui/compositor/overscroll/ui_scroll_input_manager.cc
|
| @@ -0,0 +1,39 @@
|
| +// 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() {}
|
| +
|
| +bool UIScrollInputManager::OnScrollEvent(const ScrollEvent& event) {
|
| + // Decide whether to HandleScrollBegin() based only on whether the
|
| + // InputHandler last handled an "End" (i.e. do not use properties on |event|).
|
| + // This is because, 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. So,
|
| + // when handling the fling portion, HandleScrollBegin() must be invoked, even
|
| + // though |event| will not be a "begin" phase.
|
| + if (!scrolling_layer_)
|
| + scrolling_layer_ = input_wrapper_->HandleScrollBegin(event);
|
| + if (!scrolling_layer_)
|
| + return false;
|
| +
|
| + input_wrapper_->HandleScrollUpdate(event, scrolling_layer_);
|
| + if (event.momentum_phase() == EventMomentumPhase::END) {
|
| + input_wrapper_->HandleScrollEnd(event);
|
| + scrolling_layer_ = cc::ElementId();
|
| + }
|
| + return true;
|
| +}
|
| +
|
| +} // namespace ui
|
|
|