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

Unified Diff: chrome/browser/ui/touch/tabs/touch_tab_strip.h

Issue 6750007: Scrolling Tabs (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Addressing Scott's review comments Created 9 years, 8 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
« no previous file with comments | « chrome/browser/ui/touch/tabs/touch_tab.cc ('k') | chrome/browser/ui/touch/tabs/touch_tab_strip.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/touch/tabs/touch_tab_strip.h
diff --git a/chrome/browser/ui/touch/tabs/touch_tab_strip.h b/chrome/browser/ui/touch/tabs/touch_tab_strip.h
index 1ba8b400d714fbd6c572db608c284a3797c6d418..ad36618412f115272e45fe3943d6d6b75c916eb3 100644
--- a/chrome/browser/ui/touch/tabs/touch_tab_strip.h
+++ b/chrome/browser/ui/touch/tabs/touch_tab_strip.h
@@ -19,6 +19,7 @@ class TouchTab;
// - It implements the TabStripModelObserver interface, and acts as a
// container for Tabs, and is also responsible for creating them.
//
+// TODO(wyck): Use transformable views for scrolling.
///////////////////////////////////////////////////////////////////////////////
class TouchTabStrip : public BaseTabStrip {
public:
@@ -48,6 +49,12 @@ class TouchTabStrip : public BaseTabStrip {
bool initial_drag);
virtual int GetSizeNeededForTabs(const std::vector<BaseTab*>& tabs);
+ // views::View overrides:
+ virtual bool OnMousePressed(const views::MouseEvent& event) OVERRIDE;
+ virtual bool OnMouseDragged(const views::MouseEvent& event) OVERRIDE;
+ virtual void OnMouseReleased(const views::MouseEvent& event) OVERRIDE;
+ virtual void OnMouseCaptureLost() OVERRIDE;
+
// Retrieves the Tab at the specified index. Remember, the specified index
// is in terms of tab_data, *not* the model.
TouchTab* GetTabAtTabDataIndex(int tab_data_index) const;
@@ -64,6 +71,28 @@ class TouchTabStrip : public BaseTabStrip {
View* parent,
View* child) OVERRIDE;
+ // Adjusts the state of scroll interaction when a mouse press occurs at the
+ // given point. Sets an appropriate |initial_scroll_offset_|.
+ void BeginScroll(const gfx::Point& point);
+
+ // Adjusts the state of scroll interaction when the mouse is dragged to the
+ // given point. If the scroll is not beyond the minimum threshold, the tabs
+ // will not actually scroll.
+ void ContinueScroll(const gfx::Point& point);
+
+ // Adjusts the state of scroll interaction when the mouse is released. Either
+ // scrolls to the final mouse release point or selects the current tab
+ // depending on whether the mouse was dragged beyone the minimum threshold.
+ void EndScroll(const gfx::Point& point);
+
+ // Adjust the state of scroll interaction when the mouse capture is lost. It
+ // scrolls back to the original position before the scroll began.
+ void CancelScroll();
+
+ // Adjust the positions of the tabs to perform a scroll of |delta_x| relative
+ // to the |initial_scroll_offset_|.
+ void ScrollTo(int delta_x);
+
// True if PrepareForCloseAt has been invoked. When true remove animations
// preserve current tab bounds.
bool in_tab_close_;
@@ -74,6 +103,29 @@ class TouchTabStrip : public BaseTabStrip {
// The view that was tapped last.
View* last_tapped_view_;
+ // Records the mouse x coordinate at the start of a drag operation.
+ int initial_mouse_x_;
+
+ // Records the scroll offset at the time of the start of a drag operation.
+ int initial_scroll_offset_;
+
+ // The current offset of the view. Positive scroll offsets move the icons to
+ // the left. Negative scroll offsets move the icons to the right.
+ int scroll_offset_;
+
+ // State of the scrolling interaction. Will be true once the drag has been
+ // displaced beyond the minimum dragging threshold.
+ bool scrolling_;
+
+ // Records the tab that was under the initial mouse press. Must match the
+ // tab that was under the final mouse release in order for the tab to
+ // be selected.
+ TouchTab* initial_tab_;
+
+ // The minimum value that |scroll_offset_| can have. Based on the total
+ // width of all the content to be scrolled, less the viewport size.
+ int min_scroll_offset_;
+
DISALLOW_COPY_AND_ASSIGN(TouchTabStrip);
};
« no previous file with comments | « chrome/browser/ui/touch/tabs/touch_tab.cc ('k') | chrome/browser/ui/touch/tabs/touch_tab_strip.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698