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

Side by Side 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 reviewer issues Created 9 years, 9 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_UI_TOUCH_TABS_TOUCH_TAB_STRIP_H_ 5 #ifndef CHROME_BROWSER_UI_TOUCH_TABS_TOUCH_TAB_STRIP_H_
6 #define CHROME_BROWSER_UI_TOUCH_TABS_TOUCH_TAB_STRIP_H_ 6 #define CHROME_BROWSER_UI_TOUCH_TABS_TOUCH_TAB_STRIP_H_
7 #pragma once 7 #pragma once
8 8
9 #include "chrome/browser/ui/views/tabs/base_tab_strip.h" 9 #include "chrome/browser/ui/views/tabs/base_tab_strip.h"
10 10
(...skipping 30 matching lines...) Expand all
41 virtual void StartInsertTabAnimation(int model_index); 41 virtual void StartInsertTabAnimation(int model_index);
42 virtual void AnimateToIdealBounds(); 42 virtual void AnimateToIdealBounds();
43 virtual bool ShouldHighlightCloseButtonAfterRemove(); 43 virtual bool ShouldHighlightCloseButtonAfterRemove();
44 virtual void GenerateIdealBounds(); 44 virtual void GenerateIdealBounds();
45 virtual void LayoutDraggedTabsAt(const std::vector<BaseTab*>& tabs, 45 virtual void LayoutDraggedTabsAt(const std::vector<BaseTab*>& tabs,
46 BaseTab* active_tab, 46 BaseTab* active_tab,
47 const gfx::Point& location, 47 const gfx::Point& location,
48 bool initial_drag); 48 bool initial_drag);
49 virtual int GetSizeNeededForTabs(const std::vector<BaseTab*>& tabs); 49 virtual int GetSizeNeededForTabs(const std::vector<BaseTab*>& tabs);
50 50
51 // views::View overrides:
52 virtual bool OnMousePressed(const views::MouseEvent& event) OVERRIDE;
53 virtual bool OnMouseDragged(const views::MouseEvent& event) OVERRIDE;
54 virtual void OnMouseReleased(const views::MouseEvent& event,
55 bool canceled) OVERRIDE;
56
51 // Retrieves the Tab at the specified index. Remember, the specified index 57 // Retrieves the Tab at the specified index. Remember, the specified index
52 // is in terms of tab_data, *not* the model. 58 // is in terms of tab_data, *not* the model.
53 TouchTab* GetTabAtTabDataIndex(int tab_data_index) const; 59 TouchTab* GetTabAtTabDataIndex(int tab_data_index) const;
54 60
55 private: 61 private:
56 void Init(); 62 void Init();
57 63
58 // Overridden from views::View. 64 // Overridden from views::View.
59 virtual gfx::Size GetPreferredSize() OVERRIDE; 65 virtual gfx::Size GetPreferredSize() OVERRIDE;
60 virtual void PaintChildren(gfx::Canvas* canvas) OVERRIDE; 66 virtual void PaintChildren(gfx::Canvas* canvas) OVERRIDE;
61 virtual views::View::TouchStatus OnTouchEvent( 67 virtual views::View::TouchStatus OnTouchEvent(
62 const views::TouchEvent& event) OVERRIDE; 68 const views::TouchEvent& event) OVERRIDE;
63 virtual void ViewHierarchyChanged(bool is_add, 69 virtual void ViewHierarchyChanged(bool is_add,
64 View* parent, 70 View* parent,
65 View* child) OVERRIDE; 71 View* child) OVERRIDE;
66 72
73 // Adjusts the state of scroll interaction when a mouse press occurs at the
74 // given point. Sets an appropriate |initial_scroll_offset_|.
75 void BeginScroll(const gfx::Point& point);
rjkroege 2011/03/28 22:07:40 not to make your life difficult... maybe there cou
wyck 2011/03/30 15:53:11 I'm assuming you're talking about the gestures for
76
77 // Adjusts the state of scroll interaction when the mouse is dragged to the
78 // given point. If the scroll is not beyond the minimum threshold, the tabs
79 // will not actually scroll.
80 void ContinueScroll(const gfx::Point& point);
81
82 // Adjusts the state of scroll interaction when the mouse is released. Either
83 // scrolls to the final mouse release point or selects the current tab
84 // depending on whether the mouse was dragged beyone the minimum threshold.
85 void EndScroll(const gfx::Point& point);
86
87 // Adjust the positions of the tabs to perform a scroll of |delta_x| relative
88 // to the |initial_scroll_offset_|.
89 void ScrollTo(int delta_x);
90
67 // True if PrepareForCloseAt has been invoked. When true remove animations 91 // True if PrepareForCloseAt has been invoked. When true remove animations
68 // preserve current tab bounds. 92 // preserve current tab bounds.
69 bool in_tab_close_; 93 bool in_tab_close_;
70 94
71 // Last time the tabstrip was tapped. 95 // Last time the tabstrip was tapped.
72 base::Time last_tap_time_; 96 base::Time last_tap_time_;
73 97
74 // The view that was tapped last. 98 // The view that was tapped last.
75 View* last_tapped_view_; 99 View* last_tapped_view_;
76 100
101 // Records the mouse x coordinate at the start of a drag operation.
102 int initial_mouse_x_;
103
104 // Records the scroll offset at the time of the start of a drag operation.
105 int initial_scroll_offset_;
rjkroege 2011/03/28 22:07:40 we should be moving towards floats... all these th
wyck 2011/03/30 15:53:11 Noted, but will input devices operate in the float
106
107 // The current offset of the view. Positive scroll offsets move the icons to
108 // the left. Negative scroll offsets move the icons to the right.
109 int scroll_offset_;
110
111 // State of the scrolling interaction. Will be true once the drag has been
112 // displaced beyond the minimum dragging threshold.
113 bool scrolling_;
114
115 // Records the tab that was under the initial mouse press. Must match the
116 // tab that was under the final mouse release in order for the tab to
117 // be selected.
118 TouchTab* initial_tab_;
119
120 // The minimum value that |scroll_offset_| can have. Based on the total
121 // width of all the content to be scrolled, less the viewport size.
122 int min_scroll_offset_;
123
77 DISALLOW_COPY_AND_ASSIGN(TouchTabStrip); 124 DISALLOW_COPY_AND_ASSIGN(TouchTabStrip);
78 }; 125 };
79 126
80 #endif // CHROME_BROWSER_UI_TOUCH_TABS_TOUCH_TAB_STRIP_H_ 127 #endif // CHROME_BROWSER_UI_TOUCH_TABS_TOUCH_TAB_STRIP_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698