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

Side by Side Diff: chrome/browser/ui/views/tabs/touch_tab_strip_layout.h

Issue 10409016: Makes the touch tabstrip scroll so that tabs opened in the background (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 7 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
« no previous file with comments | « no previous file | chrome/browser/ui/views/tabs/touch_tab_strip_layout.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_VIEWS_TABS_TOUCH_TAB_STRIP_LAYOUT_H_ 5 #ifndef CHROME_BROWSER_UI_VIEWS_TABS_TOUCH_TAB_STRIP_LAYOUT_H_
6 #define CHROME_BROWSER_UI_VIEWS_TABS_TOUCH_TAB_STRIP_LAYOUT_H_ 6 #define CHROME_BROWSER_UI_VIEWS_TABS_TOUCH_TAB_STRIP_LAYOUT_H_
7 #pragma once 7 #pragma once
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "ui/gfx/size.h" 10 #include "ui/gfx/size.h"
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 private: 89 private:
90 friend class TouchTabStripLayoutTest; 90 friend class TouchTabStripLayoutTest;
91 91
92 // Sets the x-coordinate normal tabs start at, width mini-tab count and 92 // Sets the x-coordinate normal tabs start at, width mini-tab count and
93 // active index at once. 93 // active index at once.
94 void Reset(int x, int width, int mini_tab_count, int active_index); 94 void Reset(int x, int width, int mini_tab_count, int active_index);
95 95
96 // Resets to an ideal layout state. 96 // Resets to an ideal layout state.
97 void ResetToIdealState(); 97 void ResetToIdealState();
98 98
99 // Makes |index| visible. This is used when a new tab is added that isn't
100 // active.
101 void MakeVisible(int index);
102
99 // Returns the x-coordinate for the active tab constrained by the current tab 103 // Returns the x-coordinate for the active tab constrained by the current tab
100 // counts. 104 // counts.
101 int ConstrainActiveX(int x) const; 105 int ConstrainActiveX(int x) const;
102 106
103 // Reset the bounds of the active tab (based on ConstrainActiveX()) and resets 107 // Reset the bounds of the active tab (based on ConstrainActiveX()) and resets
104 // the bounds of the remaining tabs by way of LayoutUsingCurrent*. 108 // the bounds of the remaining tabs by way of LayoutUsingCurrent*.
105 void SetActiveBoundsAndLayoutFromActiveTab(); 109 void SetActiveBoundsAndLayoutFromActiveTab();
106 110
107 // Sets the bounds of the tabs after |index| relative to the position of the 111 // Sets the bounds of the tabs after |index| relative to the position of the
108 // tab at |index|. Each tab is placed |tab_offset()| pixels after the previous 112 // tab at |index|. Each tab is placed |tab_offset()| pixels after the previous
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 // against the right side. 152 // against the right side.
149 int GetMaxXCompressed(int index) const; 153 int GetMaxXCompressed(int index) const;
150 154
151 // Returns the min x-coordinate for the tab at |index|. This is relative 155 // Returns the min x-coordinate for the tab at |index|. This is relative
152 // to the |active_index()| and is only useful when the active tab is pushed 156 // to the |active_index()| and is only useful when the active tab is pushed
153 // against the left side. 157 // against the left side.
154 int GetMinXCompressed(int index) const; 158 int GetMinXCompressed(int index) const;
155 159
156 // Width needed to display |count| tabs. 160 // Width needed to display |count| tabs.
157 int width_for_count(int count) const { 161 int width_for_count(int count) const {
158 return count == 0 ? 0 : 162 return (count * size_.width()) + (std::max(count - 1, 0) * padding_);
159 (count * size_.width()) + (std::max(count - 1, 0) * padding_);
160 } 163 }
161 164
162 // Padding needed for |count| stacked tabs. 165 // Padding needed for |count| stacked tabs.
163 int stacked_padding_for_count(int count) const { 166 int stacked_padding_for_count(int count) const {
164 return std::min(count, max_stacked_count_) * stacked_padding_; 167 return std::min(count, max_stacked_count_) * stacked_padding_;
165 } 168 }
166 169
167 // Max stacked padding. 170 // Max stacked padding.
168 int max_stacked_width() const { 171 int max_stacked_width() const {
169 return stacked_padding_ * max_stacked_count_; 172 return stacked_padding_ * max_stacked_count_;
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 // Number of mini-tabs. 213 // Number of mini-tabs.
211 int mini_tab_count_; 214 int mini_tab_count_;
212 215
213 // Index of the active tab. 216 // Index of the active tab.
214 int active_index_; 217 int active_index_;
215 218
216 DISALLOW_COPY_AND_ASSIGN(TouchTabStripLayout); 219 DISALLOW_COPY_AND_ASSIGN(TouchTabStripLayout);
217 }; 220 };
218 221
219 #endif // CHROME_BROWSER_UI_VIEWS_TABS_TOUCH_TAB_STRIP_LAYOUT_H_ 222 #endif // CHROME_BROWSER_UI_VIEWS_TABS_TOUCH_TAB_STRIP_LAYOUT_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/views/tabs/touch_tab_strip_layout.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698