Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Side by Side Diff: ui/app_list/pagination_controller.h

Issue 524503003: Refactor app list scrolling: introduce the PaginationController class. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ares-appgrid-vertical-scroll
Patch Set: Fix GN and Gyp. Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/app_list/app_list.gyp ('k') | ui/app_list/pagination_controller.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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.
4
5 #ifndef UI_APP_LIST_PAGINATION_CONTROLLER_H_
6 #define UI_APP_LIST_PAGINATION_CONTROLLER_H_
7
8 #include "ui/app_list/app_list_export.h"
9
10 namespace gfx {
11 class Vector2d;
12 class Rect;
13 }
14
15 namespace ui {
16 class GestureEvent;
17 }
18
19 namespace app_list {
20
21 class PaginationModel;
22
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 ScrollAxis { SCROLL_AXIS_HORIZONTAL, SCROLL_AXIS_VERTICAL };
28
29 // Creates a PaginationController. Does not take ownership of |model|. The
30 // |model| is required to outlive this PaginationController. |scroll_axis|
31 // specifies the axis in which the pages will scroll.
32 PaginationController(PaginationModel* model, ScrollAxis scroll_axis);
33
34 ScrollAxis scroll_axis() const { return scroll_axis_; }
35
36 // Handles a mouse wheel or touchpad scroll event in the area represented by
37 // the PaginationModel. |offset| is the number of units scrolled in each axis.
38 // Returns true if the event was captured and there was some room to scroll.
39 bool OnScroll(const gfx::Vector2d& offset);
40
41 // Handles a touch gesture event in the area represented by the
42 // PaginationModel. Returns true if the event was captured.
43 bool OnGestureEvent(const ui::GestureEvent& event, const gfx::Rect& bounds);
44
45 private:
46 PaginationModel* pagination_model_; // Not owned.
47 ScrollAxis scroll_axis_;
48 };
49
50 } // namespace app_list
51
52 #endif // UI_APP_LIST_PAGINATION_CONTROLLER_H_
OLDNEW
« no previous file with comments | « ui/app_list/app_list.gyp ('k') | ui/app_list/pagination_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698