OLD | NEW |
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_TAB_STRIP_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_TABS_TAB_STRIP_H_ |
6 #define CHROME_BROWSER_UI_VIEWS_TABS_TAB_STRIP_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_TABS_TAB_STRIP_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 void MoveTab(int from_model_index, | 106 void MoveTab(int from_model_index, |
107 int to_model_index, | 107 int to_model_index, |
108 const TabRendererData& data); | 108 const TabRendererData& data); |
109 | 109 |
110 // Removes a tab at the specified index. | 110 // Removes a tab at the specified index. |
111 void RemoveTabAt(int model_index); | 111 void RemoveTabAt(int model_index); |
112 | 112 |
113 // Sets the tab data at the specified model index. | 113 // Sets the tab data at the specified model index. |
114 void SetTabData(int model_index, const TabRendererData& data); | 114 void SetTabData(int model_index, const TabRendererData& data); |
115 | 115 |
| 116 // Returns true if the tab is not partly or fully clipped (due to overflow), |
| 117 // and the tab couldn't become partly clipped due to changing the selected tab |
| 118 // (for example, if currently the strip has the last tab selected, and |
| 119 // changing that to the first tab would cause |tab| to be pushed over enough |
| 120 // to clip). |
| 121 bool ShouldTabBeVisible(const Tab* tab) const; |
| 122 |
116 // Invoked from the controller when the close initiates from the TabController | 123 // Invoked from the controller when the close initiates from the TabController |
117 // (the user clicked the tab close button or middle clicked the tab). This is | 124 // (the user clicked the tab close button or middle clicked the tab). This is |
118 // invoked from Close. Because of unload handlers Close is not always | 125 // invoked from Close. Because of unload handlers Close is not always |
119 // immediately followed by RemoveTabAt. | 126 // immediately followed by RemoveTabAt. |
120 void PrepareForCloseAt(int model_index, CloseTabSource source); | 127 void PrepareForCloseAt(int model_index, CloseTabSource source); |
121 | 128 |
122 // Invoked when the selection changes from |old_selection| to | 129 // Invoked when the selection changes from |old_selection| to |
123 // |new_selection|. | 130 // |new_selection|. |
124 void SetSelection(const ui::ListSelectionModel& old_selection, | 131 void SetSelection(const ui::ListSelectionModel& old_selection, |
125 const ui::ListSelectionModel& new_selection); | 132 const ui::ListSelectionModel& new_selection); |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
330 // NOTE: this does *not* invoke GenerateIdealBounds, it uses the bounds | 337 // NOTE: this does *not* invoke GenerateIdealBounds, it uses the bounds |
331 // currently set in ideal_bounds. | 338 // currently set in ideal_bounds. |
332 void AnimateToIdealBounds(); | 339 void AnimateToIdealBounds(); |
333 | 340 |
334 // Returns whether the highlight button should be highlighted after a remove. | 341 // Returns whether the highlight button should be highlighted after a remove. |
335 bool ShouldHighlightCloseButtonAfterRemove(); | 342 bool ShouldHighlightCloseButtonAfterRemove(); |
336 | 343 |
337 // Invoked from Layout if the size changes or layout is really needed. | 344 // Invoked from Layout if the size changes or layout is really needed. |
338 void DoLayout(); | 345 void DoLayout(); |
339 | 346 |
| 347 // Sets the visibility state of all tabs based on ShouldTabBeVisible(). |
| 348 void SetTabVisibility(); |
| 349 |
340 // Drags the active tab by |delta|. |initial_positions| is the x-coordinates | 350 // Drags the active tab by |delta|. |initial_positions| is the x-coordinates |
341 // of the tabs when the drag started. | 351 // of the tabs when the drag started. |
342 void DragActiveTab(const std::vector<int>& initial_positions, int delta); | 352 void DragActiveTab(const std::vector<int>& initial_positions, int delta); |
343 | 353 |
344 // Sets the ideal bounds x-coordinates to |positions|. | 354 // Sets the ideal bounds x-coordinates to |positions|. |
345 void SetIdealBoundsFromPositions(const std::vector<int>& positions); | 355 void SetIdealBoundsFromPositions(const std::vector<int>& positions); |
346 | 356 |
347 // Stacks the dragged tabs. This is used if the drag operation is | 357 // Stacks the dragged tabs. This is used if the drag operation is |
348 // MOVE_VISIBLE_TABS and the tabs don't fill the tabstrip. When this happens | 358 // MOVE_VISIBLE_TABS and the tabs don't fill the tabstrip. When this happens |
349 // the active tab follows the mouse and the other tabs stack around it. | 359 // the active tab follows the mouse and the other tabs stack around it. |
(...skipping 15 matching lines...) Expand all Loading... |
365 void CalculateBoundsForDraggedTabs(const Tabs& tabs, | 375 void CalculateBoundsForDraggedTabs(const Tabs& tabs, |
366 std::vector<gfx::Rect>* bounds); | 376 std::vector<gfx::Rect>* bounds); |
367 | 377 |
368 // Returns the size needed for the specified tabs. This is invoked during drag | 378 // Returns the size needed for the specified tabs. This is invoked during drag |
369 // and drop to calculate offsets and positioning. | 379 // and drop to calculate offsets and positioning. |
370 int GetSizeNeededForTabs(const Tabs& tabs); | 380 int GetSizeNeededForTabs(const Tabs& tabs); |
371 | 381 |
372 // Returns the number of mini-tabs. | 382 // Returns the number of mini-tabs. |
373 int GetMiniTabCount() const; | 383 int GetMiniTabCount() const; |
374 | 384 |
375 // Returns the last tab in the strip. | 385 // Returns the last tab in the strip that's actually visible. This will be |
| 386 // the actual last tab unless the strip is in the overflow state. |
376 const Tab* GetLastVisibleTab() const; | 387 const Tab* GetLastVisibleTab() const; |
377 | 388 |
378 // Adds the tab at |index| to |tabs_closing_map_| and removes the tab from | 389 // Adds the tab at |index| to |tabs_closing_map_| and removes the tab from |
379 // |tabs_|. | 390 // |tabs_|. |
380 void RemoveTabFromViewModel(int index); | 391 void RemoveTabFromViewModel(int index); |
381 | 392 |
382 // Cleans up the Tab from the TabStrip. This is called from the tab animation | 393 // Cleans up the Tab from the TabStrip. This is called from the tab animation |
383 // code and is not a general-purpose method. | 394 // code and is not a general-purpose method. |
384 void RemoveAndDeleteTab(Tab* tab); | 395 void RemoveAndDeleteTab(Tab* tab); |
385 | 396 |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
660 bool immersive_style_; | 671 bool immersive_style_; |
661 | 672 |
662 // Our observers. | 673 // Our observers. |
663 typedef ObserverList<TabStripObserver> TabStripObservers; | 674 typedef ObserverList<TabStripObserver> TabStripObservers; |
664 TabStripObservers observers_; | 675 TabStripObservers observers_; |
665 | 676 |
666 DISALLOW_COPY_AND_ASSIGN(TabStrip); | 677 DISALLOW_COPY_AND_ASSIGN(TabStrip); |
667 }; | 678 }; |
668 | 679 |
669 #endif // CHROME_BROWSER_UI_VIEWS_TABS_TAB_STRIP_H_ | 680 #endif // CHROME_BROWSER_UI_VIEWS_TABS_TAB_STRIP_H_ |
OLD | NEW |