| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 #include "chrome/browser/tabs/tab_strip_model_order_controller.h" | 5 #include "chrome/browser/tabs/tab_strip_model_order_controller.h" |
| 6 | 6 |
| 7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
| 8 #include "chrome/browser/tab_contents/tab_contents.h" | 8 #include "chrome/browser/tab_contents/tab_contents.h" |
| 9 #elif defined(OS_MACOSX) || (OS_LINUX) | 9 #elif defined(OS_MACOSX) || (OS_LINUX) |
| 10 // TODO(port): remove this when the mock of TabContents is removed | 10 // TODO(port): remove this when the mock of TabContents is removed |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 int TabStripModelOrderController::DetermineInsertionIndex( | 27 int TabStripModelOrderController::DetermineInsertionIndex( |
| 28 TabContents* new_contents, | 28 TabContents* new_contents, |
| 29 PageTransition::Type transition, | 29 PageTransition::Type transition, |
| 30 bool foreground) { | 30 bool foreground) { |
| 31 int tab_count = tabstrip_->count(); | 31 int tab_count = tabstrip_->count(); |
| 32 if (!tab_count) | 32 if (!tab_count) |
| 33 return 0; | 33 return 0; |
| 34 | 34 |
| 35 if (transition == PageTransition::LINK && tabstrip_->selected_index() != -1) { | 35 if (transition == PageTransition::LINK && tabstrip_->selected_index() != -1) { |
| 36 if (foreground) { | 36 if (foreground) { |
| 37 // If the page was opened in the foreground by a link click in another tab
, | 37 // If the page was opened in the foreground by a link click in another |
| 38 // insert it adjacent to the tab that opened that link. | 38 // tab, insert it adjacent to the tab that opened that link. |
| 39 // TODO(beng): (http://b/1085481) may want to open right of all locked | 39 // TODO(beng): (http://b/1085481) may want to open right of all locked |
| 40 // tabs? | 40 // tabs? |
| 41 return tabstrip_->selected_index() + 1; | 41 return tabstrip_->selected_index() + 1; |
| 42 } | 42 } |
| 43 NavigationController* opener = | 43 NavigationController* opener = |
| 44 tabstrip_->GetSelectedTabContents()->controller(); | 44 tabstrip_->GetSelectedTabContents()->controller(); |
| 45 // Get the index of the next item opened by this tab, and insert before | 45 // Get the index of the next item opened by this tab, and insert before |
| 46 // it... | 46 // it... |
| 47 int index = tabstrip_->GetIndexOfLastTabContentsOpenedBy( | 47 int index = tabstrip_->GetIndexOfLastTabContentsOpenedBy( |
| 48 opener, tabstrip_->selected_index()); | 48 opener, tabstrip_->selected_index()); |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 /////////////////////////////////////////////////////////////////////////////// | 123 /////////////////////////////////////////////////////////////////////////////// |
| 124 // TabStripModelOrderController, private: | 124 // TabStripModelOrderController, private: |
| 125 | 125 |
| 126 int TabStripModelOrderController::GetValidIndex(int index, | 126 int TabStripModelOrderController::GetValidIndex(int index, |
| 127 int removing_index) const { | 127 int removing_index) const { |
| 128 if (removing_index < index) | 128 if (removing_index < index) |
| 129 index = std::max(0, index - 1); | 129 index = std::max(0, index - 1); |
| 130 return index; | 130 return index; |
| 131 } | 131 } |
| 132 | 132 |
| OLD | NEW |