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

Unified 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: Rebase. Created 6 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: ui/app_list/pagination_controller.h
diff --git a/ui/app_list/pagination_controller.h b/ui/app_list/pagination_controller.h
new file mode 100644
index 0000000000000000000000000000000000000000..a10d2d43d71bd8a295b70ef65c140cac8e979b0e
--- /dev/null
+++ b/ui/app_list/pagination_controller.h
@@ -0,0 +1,52 @@
+// Copyright 2014 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 UI_APP_LIST_PAGINATION_CONTROLLER_H_
+#define UI_APP_LIST_PAGINATION_CONTROLLER_H_
+
+#include "ui/app_list/app_list_export.h"
+
+namespace gfx {
+class Point;
+class Rect;
+}
+
+namespace ui {
+class GestureEvent;
+class ScrollEvent;
calamity 2014/09/01 01:49:30 Unnecessary forward declaration.
Matt Giuca 2014/09/01 03:02:26 Done.
+}
+
+namespace app_list {
+
+class PaginationModel;
+
+// Receives user scroll events from various sources (mouse wheel, touchpad,
+// touch gestures) and manipulates a PaginationModel as necessary.
+class APP_LIST_EXPORT PaginationController {
+ public:
+ enum ScrollAxis { SCROLL_AXIS_HORIZONTAL, SCROLL_AXIS_VERTICAL };
+
+ // Creates a PaginationController. Does not take ownership of |model|. The
+ // |model| is required to outlive this PaginationController. |scroll_axis|
+ // specifies the axis in which the pages will scroll.
+ PaginationController(PaginationModel* model, ScrollAxis scroll_axis);
+
+ ScrollAxis scroll_axis() const { return scroll_axis_; }
+
+ // Handles a mouse wheel or touchpad scroll event in the area represented by
+ // the PaginationModel. |offset| is the number of units scrolled in each axis.
+ bool OnScroll(const gfx::Point& offset);
calamity 2014/09/01 01:49:30 This API seems kinda weird. The fact that OnGestur
Matt Giuca 2014/09/01 03:02:26 I agree that this should return a bool instead of
calamity 2014/09/01 05:50:32 Ack.
+
+ // Handles a touch gesture event in the area represented by the
+ // PaginationModel.
+ void OnGestureEvent(ui::GestureEvent* event, const gfx::Rect& bounds);
+
+ private:
+ PaginationModel* pagination_model_; // Not owned.
+ ScrollAxis scroll_axis_;
+};
+
+} // namespace app_list
+
+#endif // UI_APP_LIST_PAGINATION_CONTROLLER_H_

Powered by Google App Engine
This is Rietveld 408576698