summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/automation/automation_provider.cc5
-rw-r--r--chrome/browser/browser.cc7
-rw-r--r--chrome/browser/browser.h4
-rw-r--r--chrome/browser/sessions/tab_restore_service.cc4
-rw-r--r--chrome/browser/tabs/tab_strip_model.cc11
-rw-r--r--chrome/browser/tabs/tab_strip_model.h4
-rw-r--r--chrome/browser/tabs/tab_strip_model_order_controller.cc2
-rw-r--r--chrome/browser/tabs/tab_strip_model_unittest.cc2
8 files changed, 12 insertions, 27 deletions
diff --git a/chrome/browser/automation/automation_provider.cc b/chrome/browser/automation/automation_provider.cc
index 9e87744..5b8b205 100644
--- a/chrome/browser/automation/automation_provider.cc
+++ b/chrome/browser/automation/automation_provider.cc
@@ -878,7 +878,7 @@ void AutomationProvider::RemoveLoginHandler(NavigationController* tab) {
int AutomationProvider::GetIndexForNavigationController(
const NavigationController* controller, const Browser* parent) const {
DCHECK(parent);
- return parent->GetIndexOfController(controller);
+ return parent->GetIndexOfTabContents(controller->tab_contents());
}
void AutomationProvider::OnMessageReceived(const IPC::Message& message) {
@@ -1784,7 +1784,8 @@ void AutomationProvider::GetTabIndex(int handle, int* tabstrip_index) {
if (tab_tracker_->ContainsHandle(handle)) {
NavigationController* tab = tab_tracker_->GetResource(handle);
Browser* browser = Browser::GetBrowserForController(tab, NULL);
- *tabstrip_index = browser->tabstrip_model()->GetIndexOfController(tab);
+ *tabstrip_index = browser->tabstrip_model()->GetIndexOfTabContents(
+ tab->tab_contents());
}
}
diff --git a/chrome/browser/browser.cc b/chrome/browser/browser.cc
index 45c6108..e3bd3fe 100644
--- a/chrome/browser/browser.cc
+++ b/chrome/browser/browser.cc
@@ -1179,7 +1179,8 @@ Browser* Browser::GetBrowserForController(
const NavigationController* controller, int* index_result) {
BrowserList::const_iterator it;
for (it = BrowserList::begin(); it != BrowserList::end(); ++it) {
- int index = (*it)->tabstrip_model_.GetIndexOfController(controller);
+ int index = (*it)->tabstrip_model_.GetIndexOfTabContents(
+ controller->tab_contents());
if (index != TabStripModel::kNoTab) {
if (index_result)
*index_result = index;
@@ -2272,7 +2273,7 @@ void Browser::ScheduleUIUpdate(const TabContents* source,
// this for any tab so they start & stop quickly, but the source can be
// NULL, so we have to check for that.
tabstrip_model_.UpdateTabContentsStateAt(
- tabstrip_model_.GetIndexOfController(&source->controller()), true);
+ tabstrip_model_.GetIndexOfTabContents(source), true);
}
// If the only updates were synchronously handled above, we're done.
@@ -2346,7 +2347,7 @@ void Browser::ProcessPendingUIUpdates() {
if (flags & TabContents::INVALIDATE_TAB) {
tabstrip_model_.UpdateTabContentsStateAt(
- tabstrip_model_.GetIndexOfController(&contents->controller()), false);
+ tabstrip_model_.GetIndexOfTabContents(contents), false);
window_->UpdateTitleBar();
if (contents == GetSelectedTabContents()) {
diff --git a/chrome/browser/browser.h b/chrome/browser/browser.h
index 2a5db13..db5a35f 100644
--- a/chrome/browser/browser.h
+++ b/chrome/browser/browser.h
@@ -197,8 +197,8 @@ class Browser : public TabStripModelDelegate,
int tab_count() const { return tabstrip_model_.count(); }
int selected_index() const { return tabstrip_model_.selected_index(); }
- int GetIndexOfController(const NavigationController* controller) const {
- return tabstrip_model_.GetIndexOfController(controller);
+ int GetIndexOfTabContents(const TabContents* contents) const {
+ return tabstrip_model_.GetIndexOfTabContents(contents);
}
TabContents* GetTabContentsAt(int index) const {
return tabstrip_model_.GetTabContentsAt(index);
diff --git a/chrome/browser/sessions/tab_restore_service.cc b/chrome/browser/sessions/tab_restore_service.cc
index 5399c21..592921e 100644
--- a/chrome/browser/sessions/tab_restore_service.cc
+++ b/chrome/browser/sessions/tab_restore_service.cc
@@ -353,8 +353,8 @@ void TabRestoreService::PopulateTab(Tab* tab,
// Browser may be NULL during unit tests.
if (browser) {
tab->browser_id = browser->session_id().id();
- tab->tabstrip_index =
- browser->tabstrip_model()->GetIndexOfController(controller);
+ tab->tabstrip_index = browser->tabstrip_model()->GetIndexOfTabContents(
+ controller->tab_contents());
}
}
diff --git a/chrome/browser/tabs/tab_strip_model.cc b/chrome/browser/tabs/tab_strip_model.cc
index e1a93f3..58b15f5 100644
--- a/chrome/browser/tabs/tab_strip_model.cc
+++ b/chrome/browser/tabs/tab_strip_model.cc
@@ -199,17 +199,6 @@ int TabStripModel::GetIndexOfTabContents(const TabContents* contents) const {
return kNoTab;
}
-int TabStripModel::GetIndexOfController(
- const NavigationController* controller) const {
- int index = 0;
- TabContentsDataVector::const_iterator iter = contents_data_.begin();
- for (; iter != contents_data_.end(); ++iter, ++index) {
- if (&(*iter)->contents->controller() == controller)
- return index;
- }
- return kNoTab;
-}
-
void TabStripModel::UpdateTabContentsStateAt(int index, bool loading_only) {
DCHECK(ContainsIndex(index));
diff --git a/chrome/browser/tabs/tab_strip_model.h b/chrome/browser/tabs/tab_strip_model.h
index 7f496c8..266860c 100644
--- a/chrome/browser/tabs/tab_strip_model.h
+++ b/chrome/browser/tabs/tab_strip_model.h
@@ -306,10 +306,6 @@ class TabStripModel : public NotificationObserver {
// is not in this TabStripModel.
int GetIndexOfTabContents(const TabContents* contents) const;
- // Returns the index of the specified NavigationController, or -1 if it is
- // not in this TabStripModel.
- int GetIndexOfController(const NavigationController* controller) const;
-
// Notify any observers that the TabContents at the specified index has
// changed in some way. Loading only specifies whether only the loading state
// has changed.
diff --git a/chrome/browser/tabs/tab_strip_model_order_controller.cc b/chrome/browser/tabs/tab_strip_model_order_controller.cc
index 1db0525..70530b0 100644
--- a/chrome/browser/tabs/tab_strip_model_order_controller.cc
+++ b/chrome/browser/tabs/tab_strip_model_order_controller.cc
@@ -78,7 +78,7 @@ int TabStripModelOrderController::DetermineNewSelectedIndex(
// 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);
+ index = tabstrip_->GetIndexOfTabContents(parent_opener->tab_contents());
if (index != TabStripModel::kNoTab)
return GetValidIndex(index, removing_index);
}
diff --git a/chrome/browser/tabs/tab_strip_model_unittest.cc b/chrome/browser/tabs/tab_strip_model_unittest.cc
index a5b63a7..6e2dd80 100644
--- a/chrome/browser/tabs/tab_strip_model_unittest.cc
+++ b/chrome/browser/tabs/tab_strip_model_unittest.cc
@@ -372,8 +372,6 @@ TEST_F(TabStripModelTest, TestBasicAPI) {
EXPECT_EQ(contents1, tabstrip.GetTabContentsAt(1));
EXPECT_EQ(0, tabstrip.GetIndexOfTabContents(contents2));
EXPECT_EQ(1, tabstrip.GetIndexOfTabContents(contents1));
- EXPECT_EQ(0, tabstrip.GetIndexOfController(&contents2->controller()));
- EXPECT_EQ(1, tabstrip.GetIndexOfController(&contents1->controller()));
}
// Test UpdateTabContentsStateAt