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

Side by Side Diff: chrome/browser/ui/tabs/tab_strip_model_order_controller.cc

Issue 10702029: Move tab functions off Browser into browser_tabstrip and browser_tabrestore. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 5 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
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 #include "chrome/browser/ui/tabs/tab_strip_model_order_controller.h" 5 #include "chrome/browser/ui/tabs/tab_strip_model_order_controller.h"
6 6
7 #include "chrome/browser/ui/tab_contents/tab_contents.h" 7 #include "chrome/browser/ui/tab_contents/tab_contents.h"
8 #include "content/public/browser/web_contents.h" 8 #include "content/public/browser/web_contents.h"
9 9
10 using content::NavigationController; 10 using content::NavigationController;
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 // If the tab was in a group, shift selection to the next tab in the group. 91 // If the tab was in a group, shift selection to the next tab in the group.
92 int index = tabstrip_->GetIndexOfNextTabContentsOpenedBy(parent_opener, 92 int index = tabstrip_->GetIndexOfNextTabContentsOpenedBy(parent_opener,
93 removing_index, 93 removing_index,
94 false); 94 false);
95 if (index != TabStripModel::kNoTab) 95 if (index != TabStripModel::kNoTab)
96 return GetValidIndex(index, removing_index); 96 return GetValidIndex(index, removing_index);
97 97
98 // If we can't find a subsequent group member, just fall back to the 98 // If we can't find a subsequent group member, just fall back to the
99 // parent_opener itself. Note that we use "group" here since opener is 99 // parent_opener itself. Note that we use "group" here since opener is
100 // reset by select operations.. 100 // reset by select operations..
101 index = tabstrip_->GetIndexOfController(parent_opener); 101 index = tabstrip_->GetIndexOfWebContents(parent_opener->GetWebContents());
102 if (index != TabStripModel::kNoTab) 102 if (index != TabStripModel::kNoTab)
103 return GetValidIndex(index, removing_index); 103 return GetValidIndex(index, removing_index);
104 } 104 }
105 105
106 // No opener set, fall through to the default handler... 106 // No opener set, fall through to the default handler...
107 int selected_index = tabstrip_->active_index(); 107 int selected_index = tabstrip_->active_index();
108 if (selected_index >= (tab_count - 1)) 108 if (selected_index >= (tab_count - 1))
109 return selected_index - 1; 109 return selected_index - 1;
110 110
111 return selected_index; 111 return selected_index;
(...skipping 29 matching lines...) Expand all
141 141
142 /////////////////////////////////////////////////////////////////////////////// 142 ///////////////////////////////////////////////////////////////////////////////
143 // TabStripModelOrderController, private: 143 // TabStripModelOrderController, private:
144 144
145 int TabStripModelOrderController::GetValidIndex( 145 int TabStripModelOrderController::GetValidIndex(
146 int index, int removing_index) const { 146 int index, int removing_index) const {
147 if (removing_index < index) 147 if (removing_index < index)
148 index = std::max(0, index - 1); 148 index = std::max(0, index - 1);
149 return index; 149 return index;
150 } 150 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/tabs/tab_strip_model.cc ('k') | chrome/browser/ui/tabs/tab_strip_model_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698