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

Unified Diff: chrome/browser/tabs/tab_strip_model_order_controller.cc

Issue 2821011: Removes phantom tabs. (Closed)
Patch Set: Created 10 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/tabs/tab_strip_model_order_controller.cc
diff --git a/chrome/browser/tabs/tab_strip_model_order_controller.cc b/chrome/browser/tabs/tab_strip_model_order_controller.cc
index a967bd9ba829fa824e1240881f8632cf48348fe3..f7742085ab95c0289a615b7d2184de49de511a73 100644
--- a/chrome/browser/tabs/tab_strip_model_order_controller.cc
+++ b/chrome/browser/tabs/tab_strip_model_order_controller.cc
@@ -64,8 +64,7 @@ int TabStripModelOrderController::DetermineInsertionIndexForAppending() {
}
int TabStripModelOrderController::DetermineNewSelectedIndex(
- int removing_index,
- bool is_remove) const {
+ int removing_index) const {
int tab_count = tabstrip_->count();
DCHECK(removing_index >= 0 && removing_index < tab_count);
NavigationController* parent_opener =
@@ -79,7 +78,7 @@ int TabStripModelOrderController::DetermineNewSelectedIndex(
removing_index,
false);
if (index != TabStripModel::kNoTab)
- return GetValidIndex(index, removing_index, is_remove);
+ return GetValidIndex(index, removing_index);
if (parent_opener) {
// If the tab was in a group, shift selection to the next tab in the group.
@@ -87,19 +86,19 @@ int TabStripModelOrderController::DetermineNewSelectedIndex(
removing_index,
false);
if (index != TabStripModel::kNoTab)
- return GetValidIndex(index, removing_index, is_remove);
+ return GetValidIndex(index, removing_index);
// If we can't find a subsequent group member, just fall back to the
// parent_opener itself. Note that we use "group" here since opener is
// reset by select operations..
index = tabstrip_->GetIndexOfController(parent_opener);
if (index != TabStripModel::kNoTab)
- return GetValidIndex(index, removing_index, is_remove);
+ return GetValidIndex(index, removing_index);
}
// No opener set, fall through to the default handler...
int selected_index = tabstrip_->selected_index();
- if (is_remove && selected_index >= (tab_count - 1))
+ if (selected_index >= (tab_count - 1))
return selected_index - 1;
return selected_index;
}
@@ -133,9 +132,6 @@ void TabStripModelOrderController::TabSelectedAt(TabContents* old_contents,
// TabStripModelOrderController, private:
int TabStripModelOrderController::GetValidIndex(int index,
- int removing_index,
- bool is_remove) const {
- if (is_remove && removing_index < index)
- index = std::max(0, index - 1);
- return index;
+ int removing_index) const {
+ return removing_index < index ? std::max(0, index - 1) : index;
}
« no previous file with comments | « chrome/browser/tabs/tab_strip_model_order_controller.h ('k') | chrome/browser/tabs/tab_strip_model_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698