| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_TABS_TAB_STRIP_MODEL_ORDER_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_TABS_TAB_STRIP_MODEL_ORDER_CONTROLLER_H_ |
| 6 #define CHROME_BROWSER_TABS_TAB_STRIP_MODEL_ORDER_CONTROLLER_H_ | 6 #define CHROME_BROWSER_TABS_TAB_STRIP_MODEL_ORDER_CONTROLLER_H_ |
| 7 | 7 |
| 8 #include "chrome/browser/tabs/tab_strip_model.h" | 8 #include "chrome/browser/tabs/tab_strip_model.h" |
| 9 #include "chrome/common/page_transition_types.h" | 9 #include "chrome/common/page_transition_types.h" |
| 10 | 10 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 | 31 |
| 32 // Determine where to place a newly opened tab by using the supplied | 32 // Determine where to place a newly opened tab by using the supplied |
| 33 // transition and foreground flag to figure out how it was opened. | 33 // transition and foreground flag to figure out how it was opened. |
| 34 int DetermineInsertionIndex(TabContents* new_contents, | 34 int DetermineInsertionIndex(TabContents* new_contents, |
| 35 PageTransition::Type transition, | 35 PageTransition::Type transition, |
| 36 bool foreground); | 36 bool foreground); |
| 37 | 37 |
| 38 // Returns the index to append tabs at. | 38 // Returns the index to append tabs at. |
| 39 int DetermineInsertionIndexForAppending(); | 39 int DetermineInsertionIndexForAppending(); |
| 40 | 40 |
| 41 // Determine where to shift selection after a tab is closed is made phantom. | 41 // Determine where to shift selection after a tab is closed. |
| 42 // If |is_remove| is false, the tab is not being removed but rather made | 42 int DetermineNewSelectedIndex(int removed_index) const; |
| 43 // phantom (see description of phantom tabs in TabStripModel). | |
| 44 int DetermineNewSelectedIndex(int removed_index, | |
| 45 bool is_remove) const; | |
| 46 | 43 |
| 47 // Overridden from TabStripModelObserver: | 44 // Overridden from TabStripModelObserver: |
| 48 virtual void TabSelectedAt(TabContents* old_contents, | 45 virtual void TabSelectedAt(TabContents* old_contents, |
| 49 TabContents* new_contents, | 46 TabContents* new_contents, |
| 50 int index, | 47 int index, |
| 51 bool user_gesture); | 48 bool user_gesture); |
| 52 | 49 |
| 53 private: | 50 private: |
| 54 // Returns a valid index to be selected after the tab at |removing_index| is | 51 // Returns a valid index to be selected after the tab at |removing_index| is |
| 55 // closed. If |index| is after |removing_index| and |is_remove| is true, | 52 // closed. |
| 56 // |index| is adjusted to reflect the fact that |removing_index| is going | 53 int GetValidIndex(int index, int removing_index) const; |
| 57 // away. This also skips any phantom tabs. | |
| 58 int GetValidIndex(int index, int removing_index, bool is_remove) const; | |
| 59 | 54 |
| 60 TabStripModel* tabstrip_; | 55 TabStripModel* tabstrip_; |
| 61 | 56 |
| 62 TabStripModel::InsertionPolicy insertion_policy_; | 57 TabStripModel::InsertionPolicy insertion_policy_; |
| 63 | 58 |
| 64 DISALLOW_COPY_AND_ASSIGN(TabStripModelOrderController); | 59 DISALLOW_COPY_AND_ASSIGN(TabStripModelOrderController); |
| 65 }; | 60 }; |
| 66 | 61 |
| 67 #endif // CHROME_BROWSER_TABS_TAB_STRIP_MODEL_ORDER_CONTROLLER_H_ | 62 #endif // CHROME_BROWSER_TABS_TAB_STRIP_MODEL_ORDER_CONTROLLER_H_ |
| OLD | NEW |