Move VariationsRegistrySyncerWin to ChromeVariationsServiceClient
[chromium-blink-merge.git] / ui / app_list / pagination_controller.h
blob5281dc1bfb073091503182bbbf897ce4143bbc1d
1 // Copyright 2014 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.
5 #ifndef UI_APP_LIST_PAGINATION_CONTROLLER_H_
6 #define UI_APP_LIST_PAGINATION_CONTROLLER_H_
8 #include "ui/app_list/app_list_export.h"
10 namespace gfx {
11 class Vector2d;
12 class Rect;
15 namespace ui {
16 class GestureEvent;
19 namespace app_list {
21 class PaginationModel;
23 // Receives user scroll events from various sources (mouse wheel, touchpad,
24 // touch gestures) and manipulates a PaginationModel as necessary.
25 class APP_LIST_EXPORT PaginationController {
26 public:
27 enum ScrollEventType { SCROLL_MOUSE_WHEEL, SCROLL_TOUCHPAD };
29 enum ScrollAxis { SCROLL_AXIS_HORIZONTAL, SCROLL_AXIS_VERTICAL };
31 // Creates a PaginationController. Does not take ownership of |model|. The
32 // |model| is required to outlive this PaginationController. |scroll_axis|
33 // specifies the axis in which the pages will scroll.
34 PaginationController(PaginationModel* model, ScrollAxis scroll_axis);
36 ScrollAxis scroll_axis() const { return scroll_axis_; }
38 // Handles a mouse wheel or touchpad scroll event in the area represented by
39 // the PaginationModel. |offset| is the number of units scrolled in each axis.
40 // Returns true if the event was captured and there was some room to scroll.
41 bool OnScroll(const gfx::Vector2d& offset, ScrollEventType type);
43 // Handles a touch gesture event in the area represented by the
44 // PaginationModel. Returns true if the event was captured.
45 bool OnGestureEvent(const ui::GestureEvent& event, const gfx::Rect& bounds);
47 private:
48 PaginationModel* pagination_model_; // Not owned.
49 ScrollAxis scroll_axis_;
52 } // namespace app_list
54 #endif // UI_APP_LIST_PAGINATION_CONTROLLER_H_