summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-12 17:44:44 +0000
committersky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-12 17:44:44 +0000
commit1ea49d5727a9e6ba1375030c5e38b992ca4015e8 (patch)
tree0e6e49879c0ec583c6a3da445bfd0a1ba370e674
parenta34f012a19f0915ba5ebc9ba8049763651839515 (diff)
downloadchromium_src-1ea49d5727a9e6ba1375030c5e38b992ca4015e8.zip
chromium_src-1ea49d5727a9e6ba1375030c5e38b992ca4015e8.tar.gz
chromium_src-1ea49d5727a9e6ba1375030c5e38b992ca4015e8.tar.bz2
Renames TabStripModel and Browser's selected_index to
active_index. I plan on renaming more, but wanted to start with this one. BUG=none TEST=none R=ben@chromium.org Review URL: http://codereview.chromium.org/6823064 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@81268 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/aeropeek_manager.cc2
-rw-r--r--chrome/browser/autocomplete/autocomplete_edit_view_browsertest.cc4
-rw-r--r--chrome/browser/automation/testing_automation_provider.cc6
-rw-r--r--chrome/browser/browser_browsertest.cc4
-rw-r--r--chrome/browser/browser_commands_unittest.cc20
-rw-r--r--chrome/browser/browser_keyevents_browsertest.cc18
-rw-r--r--chrome/browser/chromeos/frame/browser_view.cc4
-rw-r--r--chrome/browser/chromeos/usb_mount_observer_browsertest.cc2
-rw-r--r--chrome/browser/chromeos/wm_overview_controller.cc10
-rw-r--r--chrome/browser/extensions/extension_browser_event_router.cc3
-rw-r--r--chrome/browser/extensions/extension_tabs_module.cc6
-rw-r--r--chrome/browser/printing/print_preview_tab_controller_unittest.cc6
-rw-r--r--chrome/browser/sessions/session_restore.cc8
-rw-r--r--chrome/browser/sessions/session_service.cc2
-rw-r--r--chrome/browser/sessions/tab_restore_service_delegate.h2
-rw-r--r--chrome/browser/sync/glue/session_model_associator.cc2
-rw-r--r--chrome/browser/tabs/tab_strip_model.cc56
-rw-r--r--chrome/browser/tabs/tab_strip_model.h6
-rw-r--r--chrome/browser/tabs/tab_strip_model_observer.h17
-rw-r--r--chrome/browser/tabs/tab_strip_model_order_controller.cc14
-rw-r--r--chrome/browser/tabs/tab_strip_model_unittest.cc82
-rw-r--r--chrome/browser/ui/browser.cc18
-rw-r--r--chrome/browser/ui/browser.h2
-rw-r--r--chrome/browser/ui/browser_navigator.cc5
-rw-r--r--chrome/browser/ui/browser_navigator_browsertest.cc34
-rw-r--r--chrome/browser/ui/browser_tab_restore_service_delegate.cc2
-rw-r--r--chrome/browser/ui/cocoa/applescript/window_applescript.mm2
-rw-r--r--chrome/browser/ui/cocoa/tabpose_window.mm4
-rw-r--r--chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm6
-rw-r--r--chrome/browser/ui/gtk/browser_titlebar.cc2
-rw-r--r--chrome/browser/ui/gtk/browser_window_gtk.cc2
-rw-r--r--chrome/browser/ui/gtk/tabs/tab_strip_gtk.cc4
-rw-r--r--chrome/browser/ui/views/frame/browser_view.cc4
-rw-r--r--chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc8
-rw-r--r--chrome/browser/ui/webui/bug_report_ui.cc2
-rw-r--r--chrome/browser/ui/webui/mediaplayer_browsertest.cc4
-rw-r--r--chrome/test/ui_test_utils.cc2
-rw-r--r--content/browser/renderer_host/render_view_host_manager_browsertest.cc8
38 files changed, 188 insertions, 195 deletions
diff --git a/chrome/browser/aeropeek_manager.cc b/chrome/browser/aeropeek_manager.cc
index 3439756..12e2c9c 100644
--- a/chrome/browser/aeropeek_manager.cc
+++ b/chrome/browser/aeropeek_manager.cc
@@ -1141,7 +1141,7 @@ void AeroPeekManager::TabReplacedAt(TabStripModel* tab_strip_model,
DeleteAeroPeekWindowForTab(old_contents);
CreateAeroPeekWindowIfNecessary(new_contents,
- (index == tab_strip_model->selected_index()));
+ (index == tab_strip_model->active_index()));
// We don't need to update the selection as if |new_contents| is selected the
// TabStripModel will send TabSelectedAt.
}
diff --git a/chrome/browser/autocomplete/autocomplete_edit_view_browsertest.cc b/chrome/browser/autocomplete/autocomplete_edit_view_browsertest.cc
index 1313dc2..7ac23cb 100644
--- a/chrome/browser/autocomplete/autocomplete_edit_view_browsertest.cc
+++ b/chrome/browser/autocomplete/autocomplete_edit_view_browsertest.cc
@@ -369,13 +369,13 @@ class AutocompleteEditViewTest : public InProcessBrowserTest,
// Select the first Tab.
ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_1, kCtrlOrCmdMask));
- ASSERT_EQ(0, browser()->selected_index());
+ ASSERT_EQ(0, browser()->active_index());
browser()->FocusLocationBar();
// Select the second Tab.
ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_2, kCtrlOrCmdMask));
- ASSERT_EQ(1, browser()->selected_index());
+ ASSERT_EQ(1, browser()->active_index());
browser()->FocusLocationBar();
diff --git a/chrome/browser/automation/testing_automation_provider.cc b/chrome/browser/automation/testing_automation_provider.cc
index 6c2bb06..8c8943f 100644
--- a/chrome/browser/automation/testing_automation_provider.cc
+++ b/chrome/browser/automation/testing_automation_provider.cc
@@ -486,7 +486,7 @@ void TestingAutomationProvider::GetActiveTabIndex(int handle,
*active_tab_index = -1; // -1 is the error code
if (browser_tracker_->ContainsHandle(handle)) {
Browser* browser = browser_tracker_->GetResource(handle);
- *active_tab_index = browser->selected_index();
+ *active_tab_index = browser->active_index();
}
}
@@ -1064,7 +1064,7 @@ void TestingAutomationProvider::GetShelfVisibility(int handle, bool* visible) {
it != BrowserList::end(); ++it) {
if ((*it)->type() == Browser::TYPE_POPUP) {
const GURL& url =
- (*it)->GetTabContentsAt((*it)->selected_index())->GetURL();
+ (*it)->GetTabContentsAt((*it)->active_index())->GetURL();
if (url.SchemeIs(chrome::kChromeUIScheme) &&
url.host() == chrome::kChromeUIFileBrowseHost) {
@@ -2522,7 +2522,7 @@ void TestingAutomationProvider::GetBrowserInfo(
browser_item->SetInteger("height", rect.height());
browser_item->SetBoolean("fullscreen",
browser->window()->IsFullscreen());
- browser_item->SetInteger("selected_tab", browser->selected_index());
+ browser_item->SetInteger("selected_tab", browser->active_index());
browser_item->SetBoolean("incognito",
browser->profile()->IsOffTheRecord());
// For each window, add info about all tabs in a list of dictionaries,
diff --git a/chrome/browser/browser_browsertest.cc b/chrome/browser/browser_browsertest.cc
index b4c5cbb..71746e5 100644
--- a/chrome/browser/browser_browsertest.cc
+++ b/chrome/browser/browser_browsertest.cc
@@ -209,7 +209,7 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, JavascriptAlertActivatesTab) {
ui_test_utils::NavigateToURL(browser(), url);
AddTabAtIndex(0, url, PageTransition::TYPED);
EXPECT_EQ(2, browser()->tab_count());
- EXPECT_EQ(0, browser()->selected_index());
+ EXPECT_EQ(0, browser()->active_index());
TabContents* second_tab = browser()->GetTabContentsAt(1);
ASSERT_TRUE(second_tab);
second_tab->render_view_host()->ExecuteJavascriptInWebFrame(
@@ -218,7 +218,7 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, JavascriptAlertActivatesTab) {
AppModalDialog* alert = ui_test_utils::WaitForAppModalDialog();
alert->CloseModalDialog();
EXPECT_EQ(2, browser()->tab_count());
- EXPECT_EQ(1, browser()->selected_index());
+ EXPECT_EQ(1, browser()->active_index());
}
diff --git a/chrome/browser/browser_commands_unittest.cc b/chrome/browser/browser_commands_unittest.cc
index 6df08b9..d6f7ce2 100644
--- a/chrome/browser/browser_commands_unittest.cc
+++ b/chrome/browser/browser_commands_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -30,19 +30,19 @@ TEST_F(BrowserCommandsTest, TabNavigationAccelerators) {
// Navigate to the first tab using an accelerator.
browser()->ExecuteCommand(IDC_SELECT_TAB_0);
- ASSERT_EQ(0, browser()->selected_index());
+ ASSERT_EQ(0, browser()->active_index());
// Navigate to the second tab using the next accelerators.
browser()->ExecuteCommand(IDC_SELECT_NEXT_TAB);
- ASSERT_EQ(1, browser()->selected_index());
+ ASSERT_EQ(1, browser()->active_index());
// Navigate back to the first tab using the previous accelerators.
browser()->ExecuteCommand(IDC_SELECT_PREVIOUS_TAB);
- ASSERT_EQ(0, browser()->selected_index());
+ ASSERT_EQ(0, browser()->active_index());
// Navigate to the last tab using the select last accelerator.
browser()->ExecuteCommand(IDC_SELECT_LAST_TAB);
- ASSERT_EQ(2, browser()->selected_index());
+ ASSERT_EQ(2, browser()->active_index());
}
// Tests IDC_DUPLICATE_TAB.
@@ -112,7 +112,7 @@ TEST_F(BrowserCommandsTest, BackForwardInNewTab) {
// Go back in a new background tab.
browser()->GoBack(NEW_BACKGROUND_TAB);
- EXPECT_EQ(0, browser()->selected_index());
+ EXPECT_EQ(0, browser()->active_index());
ASSERT_EQ(2, browser()->tab_count());
// The original tab should be unchanged.
@@ -134,14 +134,14 @@ TEST_F(BrowserCommandsTest, BackForwardInNewTab) {
// fixed, one of the three commits here related to this bug should be removed
// (to test both codepaths).
CommitPendingLoad(&first->controller());
- EXPECT_EQ(1, browser()->selected_index());
+ EXPECT_EQ(1, browser()->active_index());
browser()->GoForward(NEW_BACKGROUND_TAB);
// The previous tab should be unchanged and still in the foreground.
EXPECT_EQ(url1, first->GetURL());
EXPECT_FALSE(first->controller().CanGoBack());
EXPECT_TRUE(first->controller().CanGoForward());
- EXPECT_EQ(1, browser()->selected_index());
+ EXPECT_EQ(1, browser()->active_index());
// There should be a new tab navigated forward.
ASSERT_EQ(3, browser()->tab_count());
@@ -156,13 +156,13 @@ TEST_F(BrowserCommandsTest, BackForwardInNewTab) {
// TODO(brettw) bug 11055: see the comment above about why we need this.
CommitPendingLoad(&second->controller());
browser()->GoBack(NEW_FOREGROUND_TAB);
- ASSERT_EQ(3, browser()->selected_index());
+ ASSERT_EQ(3, browser()->active_index());
ASSERT_EQ(url1, browser()->GetSelectedTabContents()->GetURL());
// Same thing again for forward.
// TODO(brettw) bug 11055: see the comment above about why we need this.
CommitPendingLoad(&browser()->GetSelectedTabContents()->controller());
browser()->GoForward(NEW_FOREGROUND_TAB);
- ASSERT_EQ(4, browser()->selected_index());
+ ASSERT_EQ(4, browser()->active_index());
ASSERT_EQ(url2, browser()->GetSelectedTabContents()->GetURL());
}
diff --git a/chrome/browser/browser_keyevents_browsertest.cc b/chrome/browser/browser_keyevents_browsertest.cc
index 90f8361..cc71af6 100644
--- a/chrome/browser/browser_keyevents_browsertest.cc
+++ b/chrome/browser/browser_keyevents_browsertest.cc
@@ -247,7 +247,7 @@ class BrowserKeyEventsTest : public InProcessBrowserTest {
void TestKeyEvent(int tab_index, const KeyEventTestData& test) {
ASSERT_LT(tab_index, browser()->tab_count());
- ASSERT_EQ(tab_index, browser()->selected_index());
+ ASSERT_EQ(tab_index, browser()->active_index());
// Inform our testing web page that we are about to start testing a key
// event.
@@ -355,7 +355,7 @@ IN_PROC_BROWSER_TEST_F(BrowserKeyEventsTest, NormalKeyEvents) {
ASSERT_NO_FATAL_FAILURE(ClickOnView(VIEW_ID_TAB_CONTAINER));
ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER_FOCUS_VIEW));
- int tab_index = browser()->selected_index();
+ int tab_index = browser()->active_index();
for (size_t i = 0; i < arraysize(kTestNoInput); ++i) {
EXPECT_NO_FATAL_FAILURE(TestKeyEvent(tab_index, kTestNoInput[i]))
<< "kTestNoInput[" << i << "] failed:\n"
@@ -440,7 +440,7 @@ IN_PROC_BROWSER_TEST_F(BrowserKeyEventsTest, CtrlKeyEvents) {
ASSERT_NO_FATAL_FAILURE(ClickOnView(VIEW_ID_TAB_CONTAINER));
ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER_FOCUS_VIEW));
- int tab_index = browser()->selected_index();
+ int tab_index = browser()->active_index();
// Press Ctrl+F, which will make the Find box open and request focus.
EXPECT_NO_FATAL_FAILURE(TestKeyEvent(tab_index, kTestCtrlF));
EXPECT_TRUE(IsViewFocused(VIEW_ID_FIND_IN_PAGE_TEXT_FIELD));
@@ -485,7 +485,7 @@ IN_PROC_BROWSER_TEST_F(BrowserKeyEventsTest, CommandKeyEvents) {
ASSERT_NO_FATAL_FAILURE(ClickOnView(VIEW_ID_TAB_CONTAINER));
ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER_FOCUS_VIEW));
- int tab_index = browser()->selected_index();
+ int tab_index = browser()->active_index();
// Press Cmd+F, which will make the Find box open and request focus.
EXPECT_NO_FATAL_FAILURE(TestKeyEvent(tab_index, kTestCmdF));
EXPECT_TRUE(IsViewFocused(VIEW_ID_FIND_IN_PAGE_TEXT_FIELD));
@@ -582,7 +582,7 @@ IN_PROC_BROWSER_TEST_F(BrowserKeyEventsTest, AccessKeys) {
ASSERT_NO_FATAL_FAILURE(ClickOnView(VIEW_ID_TAB_CONTAINER));
ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER_FOCUS_VIEW));
- int tab_index = browser()->selected_index();
+ int tab_index = browser()->active_index();
// Make sure no element is focused.
EXPECT_NO_FATAL_FAILURE(CheckFocusedElement(tab_index, L""));
// Alt+A should focus the element with accesskey = "A".
@@ -677,7 +677,7 @@ IN_PROC_BROWSER_TEST_F(BrowserKeyEventsTest, DISABLED_ReservedAccelerators) {
EXPECT_EQ(1, result_length);
EXPECT_EQ(2, browser()->tab_count());
- ASSERT_EQ(1, browser()->selected_index());
+ ASSERT_EQ(1, browser()->active_index());
// Because of issue http://crbug.com/65375, switching back to the first tab
// may cause the focus to be grabbed by omnibox. So instead, we load our
@@ -747,7 +747,7 @@ IN_PROC_BROWSER_TEST_F(BrowserKeyEventsTest, EditorKeyBindings) {
ASSERT_NO_FATAL_FAILURE(ClickOnView(VIEW_ID_TAB_CONTAINER));
ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER_FOCUS_VIEW));
- int tab_index = browser()->selected_index();
+ int tab_index = browser()->active_index();
ASSERT_NO_FATAL_FAILURE(SetFocusedElement(tab_index, L"A"));
ASSERT_NO_FATAL_FAILURE(SetTextBoxValue(tab_index, L"A", L"Hello"));
// Move the caret to the beginning of the line.
@@ -784,7 +784,7 @@ IN_PROC_BROWSER_TEST_F(BrowserKeyEventsTest, PageUpDownKeys) {
ASSERT_NO_FATAL_FAILURE(ClickOnView(VIEW_ID_TAB_CONTAINER));
ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER_FOCUS_VIEW));
- int tab_index = browser()->selected_index();
+ int tab_index = browser()->active_index();
ASSERT_NO_FATAL_FAILURE(SetFocusedElement(tab_index, L"A"));
EXPECT_NO_FATAL_FAILURE(TestKeyEvent(tab_index, kTestPageUp));
EXPECT_NO_FATAL_FAILURE(TestKeyEvent(tab_index, kTestPageDown));
@@ -825,7 +825,7 @@ IN_PROC_BROWSER_TEST_F(BrowserKeyEventsTest, FocusMenuBarByAltKey) {
ASSERT_NO_FATAL_FAILURE(ClickOnView(VIEW_ID_TAB_CONTAINER));
ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER_FOCUS_VIEW));
- int tab_index = browser()->selected_index();
+ int tab_index = browser()->active_index();
// Press and release Alt key to focus wrench menu button.
EXPECT_NO_FATAL_FAILURE(TestKeyEvent(tab_index, kTestAltKey));
EXPECT_TRUE(IsViewFocused(VIEW_ID_APP_MENU));
diff --git a/chrome/browser/chromeos/frame/browser_view.cc b/chrome/browser/chromeos/frame/browser_view.cc
index 26a6feb..8d02d6b 100644
--- a/chrome/browser/chromeos/frame/browser_view.cc
+++ b/chrome/browser/chromeos/frame/browser_view.cc
@@ -243,7 +243,7 @@ void BrowserView::Init() {
// Make sure the window is set to the right type.
std::vector<int> params;
params.push_back(browser()->tab_count());
- params.push_back(browser()->selected_index());
+ params.push_back(browser()->active_index());
params.push_back(gtk_get_current_event_time());
WmIpc::instance()->SetWindowType(
GTK_WIDGET(frame()->GetWindow()->GetNativeWindow()),
@@ -269,7 +269,7 @@ void BrowserView::ShowInternal(bool is_active) {
// Have to update the tab count and selected index to reflect reality.
std::vector<int> params;
params.push_back(browser()->tab_count());
- params.push_back(browser()->selected_index());
+ params.push_back(browser()->active_index());
WmIpc::instance()->SetWindowType(
GTK_WIDGET(frame()->GetWindow()->GetNativeWindow()),
WM_IPC_WINDOW_CHROME_TOPLEVEL,
diff --git a/chrome/browser/chromeos/usb_mount_observer_browsertest.cc b/chrome/browser/chromeos/usb_mount_observer_browsertest.cc
index d7d6813..4c594bd 100644
--- a/chrome/browser/chromeos/usb_mount_observer_browsertest.cc
+++ b/chrome/browser/chromeos/usb_mount_observer_browsertest.cc
@@ -26,7 +26,7 @@ class USBMountObserverBrowserTest : public InProcessBrowserTest {
it != BrowserList::end(); ++it) {
if ((*it)->type() == Browser::TYPE_POPUP) {
const GURL& url =
- (*it)->GetTabContentsAt((*it)->selected_index())->GetURL();
+ (*it)->GetTabContentsAt((*it)->active_index())->GetURL();
if (url.SchemeIs(chrome::kChromeUIScheme) &&
url.host() == chrome::kChromeUIFileBrowseHost) {
return true;
diff --git a/chrome/browser/chromeos/wm_overview_controller.cc b/chrome/browser/chromeos/wm_overview_controller.cc
index 2914fb3..375c0dd 100644
--- a/chrome/browser/chromeos/wm_overview_controller.cc
+++ b/chrome/browser/chromeos/wm_overview_controller.cc
@@ -108,7 +108,7 @@ class BrowserListener : public TabStripModelObserver {
int ConfigureNextUnconfiguredSnapshot(int start_from);
// Saves the currently selected tab.
- void SaveCurrentTab() { original_selected_tab_ = browser_->selected_index(); }
+ void SaveCurrentTab() { original_selected_tab_ = browser_->active_index(); }
// Reverts the selected browser tab to the tab that was selected
// when This BrowserListener was created, or the last time
@@ -208,12 +208,12 @@ void BrowserListener::TabInsertedAt(TabContentsWrapper* contents,
bool foreground) {
InsertSnapshot(index);
RenumberSnapshots(index);
- UpdateSelectedIndex(browser_->selected_index());
+ UpdateSelectedIndex(browser_->active_index());
}
void BrowserListener::TabDetachedAt(TabContentsWrapper* contents, int index) {
ClearSnapshot(index);
- UpdateSelectedIndex(browser_->selected_index());
+ UpdateSelectedIndex(browser_->active_index());
RenumberSnapshots(index);
}
@@ -228,7 +228,7 @@ void BrowserListener::TabMoved(TabContentsWrapper* contents,
snapshots_.insert(snapshots_.begin() + to_index, node);
RenumberSnapshots(std::min(to_index, from_index));
- UpdateSelectedIndex(browser_->selected_index());
+ UpdateSelectedIndex(browser_->active_index());
}
void BrowserListener::TabChangedAt(
@@ -305,7 +305,7 @@ int BrowserListener::ConfigureNextUnconfiguredSnapshot(int start_from) {
void BrowserListener::RestoreOriginalSelectedTab() {
if (original_selected_tab_ >= 0) {
browser_->SelectTabContentsAt(original_selected_tab_, false);
- UpdateSelectedIndex(browser_->selected_index());
+ UpdateSelectedIndex(browser_->active_index());
}
}
diff --git a/chrome/browser/extensions/extension_browser_event_router.cc b/chrome/browser/extensions/extension_browser_event_router.cc
index 109964b..34e2fda 100644
--- a/chrome/browser/extensions/extension_browser_event_router.cc
+++ b/chrome/browser/extensions/extension_browser_event_router.cc
@@ -477,8 +477,7 @@ void ExtensionBrowserEventRouter::TabReplacedAt(
TabContentsWrapper* new_contents,
int index) {
TabClosingAt(tab_strip_model, old_contents, index);
- TabInsertedAt(new_contents, index,
- tab_strip_model->selected_index() == index);
+ TabInsertedAt(new_contents, index, tab_strip_model->active_index() == index);
}
void ExtensionBrowserEventRouter::TabPinnedStateChanged(
diff --git a/chrome/browser/extensions/extension_tabs_module.cc b/chrome/browser/extensions/extension_tabs_module.cc
index d7773096..3ea3607 100644
--- a/chrome/browser/extensions/extension_tabs_module.cc
+++ b/chrome/browser/extensions/extension_tabs_module.cc
@@ -128,7 +128,7 @@ DictionaryValue* ExtensionTabUtil::CreateTabValue(
result->SetString(keys::kUrlKey, contents->GetURL().spec());
result->SetString(keys::kStatusKey, GetTabStatusText(contents->is_loading()));
result->SetBoolean(keys::kSelectedKey,
- tab_strip && tab_index == tab_strip->selected_index());
+ tab_strip && tab_index == tab_strip->active_index());
result->SetBoolean(keys::kPinnedKey,
tab_strip && tab_strip->IsTabPinned(tab_index));
result->SetString(keys::kTitleKey, contents->GetTitle());
@@ -633,7 +633,7 @@ bool GetSelectedTabFunction::RunImpl() {
}
result_.reset(ExtensionTabUtil::CreateTabValue(contents->tab_contents(),
tab_strip,
- tab_strip->selected_index()));
+ tab_strip->active_index()));
return true;
}
@@ -879,7 +879,7 @@ bool UpdateTabFunction::RunImpl() {
keys::kSelectedKey,
&selected));
if (selected) {
- if (tab_strip->selected_index() != tab_index) {
+ if (tab_strip->active_index() != tab_index) {
tab_strip->SelectTabContentsAt(tab_index, false);
DCHECK_EQ(contents, tab_strip->GetSelectedTabContents());
}
diff --git a/chrome/browser/printing/print_preview_tab_controller_unittest.cc b/chrome/browser/printing/print_preview_tab_controller_unittest.cc
index 6d3609f4..76f6a08 100644
--- a/chrome/browser/printing/print_preview_tab_controller_unittest.cc
+++ b/chrome/browser/printing/print_preview_tab_controller_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -101,7 +101,7 @@ TEST_F(PrintPreviewTabControllerTest, MultiplePreviewTabs) {
EXPECT_NE(-1, preview_tab_1_index);
EXPECT_NE(-1, preview_tab_2_index);
// Current tab is |preview_tab_2|.
- EXPECT_EQ(preview_tab_2_index, browser()->selected_index());
+ EXPECT_EQ(preview_tab_2_index, browser()->active_index());
// Activate |tab_contents_1| tab.
tab_contents_1->Activate();
@@ -109,5 +109,5 @@ TEST_F(PrintPreviewTabControllerTest, MultiplePreviewTabs) {
// When we get the preview tab for |tab_contents_1|,
// |preview_tab_1| is activated and focused.
tab_controller->GetOrCreatePreviewTab(tab_contents_1);
- EXPECT_EQ(preview_tab_1_index, browser()->selected_index());
+ EXPECT_EQ(preview_tab_1_index, browser()->active_index());
}
diff --git a/chrome/browser/sessions/session_restore.cc b/chrome/browser/sessions/session_restore.cc
index bf60878..fc209a4 100644
--- a/chrome/browser/sessions/session_restore.cc
+++ b/chrome/browser/sessions/session_restore.cc
@@ -202,10 +202,10 @@ void TabLoader::LoadNextTab() {
if (tab->tab_contents()) {
int tab_index;
Browser* browser = Browser::GetBrowserForController(tab, &tab_index);
- if (browser && browser->selected_index() != tab_index) {
- // By default tabs are marked as visible. As only the selected tab is
- // visible we need to explicitly tell non-selected tabs they are hidden.
- // Without this call non-selected tabs are not marked as backgrounded.
+ if (browser && browser->active_index() != tab_index) {
+ // By default tabs are marked as visible. As only the active tab is
+ // visible we need to explicitly tell non-active tabs they are hidden.
+ // Without this call non-active tabs are not marked as backgrounded.
//
// NOTE: We need to do this here rather than when the tab is added to
// the Browser as at that time not everything has been created, so that
diff --git a/chrome/browser/sessions/session_service.cc b/chrome/browser/sessions/session_service.cc
index ccee7df..283371e 100644
--- a/chrome/browser/sessions/session_service.cc
+++ b/chrome/browser/sessions/session_service.cc
@@ -1143,7 +1143,7 @@ void SessionService::BuildCommandsForBrowser(
}
commands->push_back(
CreateSetSelectedTabInWindow(browser->session_id(),
- browser->selected_index()));
+ browser->active_index()));
}
void SessionService::BuildCommandsFromBrowsers(
diff --git a/chrome/browser/sessions/tab_restore_service_delegate.h b/chrome/browser/sessions/tab_restore_service_delegate.h
index d81e8fc..1ac7914 100644
--- a/chrome/browser/sessions/tab_restore_service_delegate.h
+++ b/chrome/browser/sessions/tab_restore_service_delegate.h
@@ -29,7 +29,7 @@ class TabRestoreServiceDelegate {
// see Browser::tab_count()
virtual int GetTabCount() const = 0;
- // see Browser::selected_index()
+ // see Browser::active_index()
virtual int GetSelectedIndex() const = 0;
// see Browser methods with the same names
diff --git a/chrome/browser/sync/glue/session_model_associator.cc b/chrome/browser/sync/glue/session_model_associator.cc
index 39f5ae7..d737d99 100644
--- a/chrome/browser/sync/glue/session_model_associator.cc
+++ b/chrome/browser/sync/glue/session_model_associator.cc
@@ -128,7 +128,7 @@ void SessionModelAssociator::ReassociateWindows(bool reload_tabs) {
VLOG(1) << "Reassociating window " << window_id << " with " <<
(*i)->tab_count() << " tabs.";
window_s.set_window_id(window_id);
- window_s.set_selected_tab_index((*i)->selected_index());
+ window_s.set_selected_tab_index((*i)->active_index());
if ((*i)->type() ==
Browser::TYPE_NORMAL) {
window_s.set_browser_type(
diff --git a/chrome/browser/tabs/tab_strip_model.cc b/chrome/browser/tabs/tab_strip_model.cc
index 7e31c30..c4d1aa1 100644
--- a/chrome/browser/tabs/tab_strip_model.cc
+++ b/chrome/browser/tabs/tab_strip_model.cc
@@ -177,13 +177,13 @@ TabContentsWrapper* TabStripModel::ReplaceTabContentsAt(
FOR_EACH_OBSERVER(TabStripModelObserver, observers_,
TabReplacedAt(this, old_contents, new_contents, index));
- // When the selected tab contents is replaced send out selected notification
+ // When the active tab contents is replaced send out selected notification
// too. We do this as nearly all observers need to treat a replace of the
// selected contents as selection changing.
- if (selected_index() == index) {
+ if (active_index() == index) {
FOR_EACH_OBSERVER(TabStripModelObserver, observers_,
- TabSelectedAt(old_contents, new_contents,
- selected_index(), false));
+ TabSelectedAt(old_contents, new_contents, active_index(),
+ false));
}
return old_contents;
}
@@ -221,17 +221,17 @@ TabContentsWrapper* TabStripModel::DetachTabContentsAt(int index) {
// a second pass.
FOR_EACH_OBSERVER(TabStripModelObserver, observers_, TabStripEmpty());
} else {
- int old_selected = selected_index();
+ int old_active = active_index();
selection_model_.DecrementFrom(index);
- if (index == old_selected) {
+ if (index == old_active) {
if (!selection_model_.empty()) {
// A selected tab was removed, but there is still something selected.
// Move the active and anchor to the first selected index.
selection_model_.set_active(selection_model_.selected_indices()[0]);
selection_model_.set_anchor(selection_model_.active());
- NotifyTabSelectedIfChanged(removed_contents, selected_index(), false);
+ NotifyTabSelectedIfChanged(removed_contents, active_index(), false);
} else {
- // The selected tab was removed and nothing is selected. Reset the
+ // The active tab was removed and nothing is selected. Reset the
// selection and send out notification.
selection_model_.SetSelectedIndex(next_selected_index);
NotifyTabSelectedIfChanged(removed_contents, next_selected_index,
@@ -246,7 +246,7 @@ void TabStripModel::SelectTabContentsAt(int index, bool user_gesture) {
DCHECK(ContainsIndex(index));
bool had_multi = selection_model_.selected_indices().size() > 1;
TabContentsWrapper* old_contents =
- (selected_index() == TabStripSelectionModel::kUnselectedIndex) ?
+ (active_index() == TabStripSelectionModel::kUnselectedIndex) ?
NULL : GetSelectedTabContents();
selection_model_.SetSelectedIndex(index);
TabContentsWrapper* new_contents = GetContentsAt(index);
@@ -257,7 +257,7 @@ void TabStripModel::SelectTabContentsAt(int index, bool user_gesture) {
if (old_contents != new_contents || had_multi) {
FOR_EACH_OBSERVER(TabStripModelObserver, observers_,
TabSelectedAt(old_contents, new_contents,
- selected_index(), user_gesture));
+ active_index(), user_gesture));
}
}
@@ -313,7 +313,7 @@ void TabStripModel::MoveSelectedTabsTo(int index) {
}
TabContentsWrapper* TabStripModel::GetSelectedTabContents() const {
- return GetTabContentsAt(selected_index());
+ return GetTabContentsAt(active_index());
}
TabContentsWrapper* TabStripModel::GetTabContentsAt(int index) const {
@@ -570,15 +570,15 @@ int TabStripModel::ConstrainInsertionIndex(int index, bool mini_tab) {
void TabStripModel::ExtendSelectionTo(int index) {
DCHECK(ContainsIndex(index));
- int old_selection = selected_index();
+ int old_active = active_index();
selection_model_.SetSelectionFromAnchorTo(index);
// This may not have resulted in a change, but we assume it did.
- NotifySelectionChanged(old_selection);
+ NotifySelectionChanged(old_active);
}
void TabStripModel::ToggleSelectionAt(int index) {
DCHECK(ContainsIndex(index));
- int old_selection = selected_index();
+ int old_active = active_index();
if (selection_model_.IsSelected(index)) {
if (selection_model_.size() == 1) {
// One tab must be selected and this tab is currently selected so we can't
@@ -594,13 +594,13 @@ void TabStripModel::ToggleSelectionAt(int index) {
selection_model_.set_anchor(index);
selection_model_.set_active(index);
}
- NotifySelectionChanged(old_selection);
+ NotifySelectionChanged(old_active);
}
void TabStripModel::AddSelectionFromAnchorTo(int index) {
- int old_selection = selected_index();
+ int old_active = active_index();
selection_model_.AddSelectionFromAnchorTo(index);
- NotifySelectionChanged(old_selection);
+ NotifySelectionChanged(old_active);
}
bool TabStripModel::IsTabSelected(int index) const {
@@ -611,10 +611,10 @@ bool TabStripModel::IsTabSelected(int index) const {
void TabStripModel::SetSelectionFromModel(
const TabStripSelectionModel& source) {
DCHECK_NE(TabStripSelectionModel::kUnselectedIndex, source.active());
- int old_selected_index = selected_index();
+ int old_active_index = active_index();
selection_model_.Copy(source);
// This may not have resulted in a change, but we assume it did.
- NotifySelectionChanged(old_selected_index);
+ NotifySelectionChanged(old_active_index);
}
void TabStripModel::AddTabContents(TabContentsWrapper* contents,
@@ -703,14 +703,14 @@ void TabStripModel::SelectLastTab() {
void TabStripModel::MoveTabNext() {
// TODO: this likely needs to be updated for multi-selection.
- int new_index = std::min(selected_index() + 1, count() - 1);
- MoveTabContentsAt(selected_index(), new_index, true);
+ int new_index = std::min(active_index() + 1, count() - 1);
+ MoveTabContentsAt(active_index(), new_index, true);
}
void TabStripModel::MoveTabPrevious() {
// TODO: this likely needs to be updated for multi-selection.
- int new_index = std::max(selected_index() - 1, 0);
- MoveTabContentsAt(selected_index(), new_index, true);
+ int new_index = std::max(active_index() - 1, 0);
+ MoveTabContentsAt(active_index(), new_index, true);
}
// Context menu functions.
@@ -1222,7 +1222,7 @@ void TabStripModel::NotifyTabSelectedIfChanged(TabContentsWrapper* old_contents,
FOR_EACH_OBSERVER(TabStripModelObserver, observers_,
TabSelectedAt(last_selected_contents, new_contents,
- selected_index(), user_gesture));
+ active_index(), user_gesture));
}
void TabStripModel::NotifySelectionChanged(int old_selected_index) {
@@ -1230,10 +1230,10 @@ void TabStripModel::NotifySelectionChanged(int old_selected_index) {
old_selected_index == TabStripSelectionModel::kUnselectedIndex ?
NULL : GetTabContentsAt(old_selected_index);
TabContentsWrapper* new_tab =
- selected_index() == TabStripSelectionModel::kUnselectedIndex ?
- NULL : GetTabContentsAt(selected_index());
+ active_index() == TabStripSelectionModel::kUnselectedIndex ?
+ NULL : GetTabContentsAt(active_index());
FOR_EACH_OBSERVER(TabStripModelObserver, observers_,
- TabSelectedAt(old_tab, new_tab, selected_index(), true));
+ TabSelectedAt(old_tab, new_tab, active_index(), true));
}
void TabStripModel::SelectRelativeTab(bool next) {
@@ -1242,7 +1242,7 @@ void TabStripModel::SelectRelativeTab(bool next) {
if (contents_data_.empty())
return;
- int index = selected_index();
+ int index = active_index();
int delta = next ? 1 : -1;
index = (index + count() + delta) % count();
SelectTabContentsAt(index, true);
diff --git a/chrome/browser/tabs/tab_strip_model.h b/chrome/browser/tabs/tab_strip_model.h
index 42489b4..ed15ffb 100644
--- a/chrome/browser/tabs/tab_strip_model.h
+++ b/chrome/browser/tabs/tab_strip_model.h
@@ -132,10 +132,8 @@ class TabStripModel : public NotificationObserver {
// Retrieve the Profile associated with this TabStripModel.
Profile* profile() const { return profile_; }
- // Retrieve the index of the currently selected TabContents.
- // TODO(sky): rename this to active and update similar places (observer,
- // other methods...).
- int selected_index() const { return selection_model_.active(); }
+ // Retrieve the index of the currently active TabContents.
+ int active_index() const { return selection_model_.active(); }
// Returns true if the tabstrip is currently closing all open tabs (via a
// call to CloseAllTabs). As tabs close, the selection in the tabstrip
diff --git a/chrome/browser/tabs/tab_strip_model_observer.h b/chrome/browser/tabs/tab_strip_model_observer.h
index 055718e..5757d88 100644
--- a/chrome/browser/tabs/tab_strip_model_observer.h
+++ b/chrome/browser/tabs/tab_strip_model_observer.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -64,14 +64,13 @@ class TabStripModelObserver {
// Sent when the selection changes. The previously selected tab is identified
// by |old_contents| and the newly selected tab by |new_contents|. |index| is
// the index of |new_contents|. When using multiple selection this may be sent
- // even when the selected tab (as returned by selected_index()) has not
- // changed. For example, if the selection is extended this method is invoked
- // to inform observers the selection has changed, but |old_contents| and
- // |new_contents| are the same. If you only care about when the selected tab
- // changes, check for when |old_contents| differs from
- // |new_contents|. |user_gesture| specifies whether or not this was done by a
- // user input event (e.g. clicking on a tab, keystroke) or as a side-effect of
- // some other function.
+ // even when the active tab has not changed. For example, if the selection is
+ // extended this method is invoked to inform observers the selection has
+ // changed, but |old_contents| and |new_contents| are the same. If you only
+ // care about when the active tab changes, check for when |old_contents|
+ // differs from |new_contents|. |user_gesture| specifies whether or not this
+ // was done by a user input event (e.g. clicking on a tab, keystroke) or as a
+ // side-effect of some other function.
//
// TODO(sky): consider not overloading this. Instead rename this to
// TabActivatedAt (or something) and have TabSelectionChanged as well.
diff --git a/chrome/browser/tabs/tab_strip_model_order_controller.cc b/chrome/browser/tabs/tab_strip_model_order_controller.cc
index cc3eaec..8c8f4db 100644
--- a/chrome/browser/tabs/tab_strip_model_order_controller.cc
+++ b/chrome/browser/tabs/tab_strip_model_order_controller.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -30,12 +30,12 @@ int TabStripModelOrderController::DetermineInsertionIndex(
// NOTE: TabStripModel enforces that all non-mini-tabs occur after mini-tabs,
// so we don't have to check here too.
- if (transition == PageTransition::LINK && tabstrip_->selected_index() != -1) {
+ if (transition == PageTransition::LINK && tabstrip_->active_index() != -1) {
int delta = (insertion_policy_ == TabStripModel::INSERT_AFTER) ? 1 : 0;
if (foreground) {
// If the page was opened in the foreground by a link click in another
// tab, insert it adjacent to the tab that opened that link.
- return tabstrip_->selected_index() + delta;
+ return tabstrip_->active_index() + delta;
}
NavigationController* opener =
&tabstrip_->GetSelectedTabContents()->controller();
@@ -44,15 +44,15 @@ int TabStripModelOrderController::DetermineInsertionIndex(
int index;
if (insertion_policy_ == TabStripModel::INSERT_AFTER) {
index = tabstrip_->GetIndexOfLastTabContentsOpenedBy(
- opener, tabstrip_->selected_index());
+ opener, tabstrip_->active_index());
} else {
index = tabstrip_->GetIndexOfFirstTabContentsOpenedBy(
- opener, tabstrip_->selected_index());
+ opener, tabstrip_->active_index());
}
if (index != TabStripModel::kNoTab)
return index + delta;
// Otherwise insert adjacent to opener...
- return tabstrip_->selected_index() + delta;
+ return tabstrip_->active_index() + delta;
}
// In other cases, such as Ctrl+T, open at the end of the strip.
return DetermineInsertionIndexForAppending();
@@ -99,7 +99,7 @@ int TabStripModelOrderController::DetermineNewSelectedIndex(
}
// No opener set, fall through to the default handler...
- int selected_index = tabstrip_->selected_index();
+ int selected_index = tabstrip_->active_index();
if (selected_index >= (tab_count - 1))
return selected_index - 1;
diff --git a/chrome/browser/tabs/tab_strip_model_unittest.cc b/chrome/browser/tabs/tab_strip_model_unittest.cc
index 993f409..f1d39b1 100644
--- a/chrome/browser/tabs/tab_strip_model_unittest.cc
+++ b/chrome/browser/tabs/tab_strip_model_unittest.cc
@@ -524,7 +524,7 @@ TEST_F(TabStripModelTest, TestBasicAPI) {
State s1(contents2, 0, MockTabStripModelObserver::MOVE);
s1.src_index = 1;
EXPECT_TRUE(observer.StateEquals(0, s1));
- EXPECT_EQ(0, tabstrip.selected_index());
+ EXPECT_EQ(0, tabstrip.active_index());
observer.ClearStates();
}
@@ -535,7 +535,7 @@ TEST_F(TabStripModelTest, TestBasicAPI) {
State s1(contents1, 0, MockTabStripModelObserver::MOVE);
s1.src_index = 1;
EXPECT_TRUE(observer.StateEquals(0, s1));
- EXPECT_EQ(1, tabstrip.selected_index());
+ EXPECT_EQ(1, tabstrip.active_index());
tabstrip.MoveTabContentsAt(0, 1, false);
observer.ClearStates();
@@ -566,11 +566,11 @@ TEST_F(TabStripModelTest, TestBasicAPI) {
// Make sure the second of the two tabs is selected first...
tabstrip.SelectTabContentsAt(1, true);
tabstrip.SelectPreviousTab();
- EXPECT_EQ(0, tabstrip.selected_index());
+ EXPECT_EQ(0, tabstrip.active_index());
tabstrip.SelectLastTab();
- EXPECT_EQ(1, tabstrip.selected_index());
+ EXPECT_EQ(1, tabstrip.active_index());
tabstrip.SelectNextTab();
- EXPECT_EQ(0, tabstrip.selected_index());
+ EXPECT_EQ(0, tabstrip.active_index());
}
// Test CloseSelectedTabs
@@ -580,7 +580,7 @@ TEST_F(TabStripModelTest, TestBasicAPI) {
// just verify that the count and selected index have changed
// appropriately...
EXPECT_EQ(1, tabstrip.count());
- EXPECT_EQ(0, tabstrip.selected_index());
+ EXPECT_EQ(0, tabstrip.active_index());
}
tabstrip.CloseAllTabs();
@@ -787,12 +787,12 @@ TEST_F(TabStripModelTest, TestInsertionIndexDetermination) {
tabstrip.InsertTabContentsAt(insert_index, fg_link_contents,
TabStripModel::ADD_SELECTED |
TabStripModel::ADD_INHERIT_GROUP);
- EXPECT_EQ(1, tabstrip.selected_index());
+ EXPECT_EQ(1, tabstrip.active_index());
EXPECT_EQ(fg_link_contents, tabstrip.GetSelectedTabContents());
// Now close this contents. The selection should move to the opener contents.
tabstrip.CloseSelectedTabs();
- EXPECT_EQ(0, tabstrip.selected_index());
+ EXPECT_EQ(0, tabstrip.active_index());
// Now open a new empty tab. It should open at the end of the strip.
TabContentsWrapper* fg_nonlink_contents = CreateTabContents();
@@ -805,7 +805,7 @@ TEST_F(TabStripModelTest, TestInsertionIndexDetermination) {
// Now select it, so that user_gesture == true causes the opener relationship
// to be forgotten...
tabstrip.SelectTabContentsAt(tabstrip.count() - 1, true);
- EXPECT_EQ(tabstrip.count() - 1, tabstrip.selected_index());
+ EXPECT_EQ(tabstrip.count() - 1, tabstrip.active_index());
EXPECT_EQ(fg_nonlink_contents, tabstrip.GetSelectedTabContents());
// Verify that all opener relationships are forgotten.
@@ -847,10 +847,10 @@ TEST_F(TabStripModelTest, TestSelectOnClose) {
// First test that closing tabs that are in the background doesn't adjust the
// current selection.
InsertTabContentses(&tabstrip, contents1, contents2, contents3);
- EXPECT_EQ(0, tabstrip.selected_index());
+ EXPECT_EQ(0, tabstrip.active_index());
tabstrip.DetachTabContentsAt(1);
- EXPECT_EQ(0, tabstrip.selected_index());
+ EXPECT_EQ(0, tabstrip.active_index());
for (int i = tabstrip.count() - 1; i >= 1; --i)
tabstrip.DetachTabContentsAt(i);
@@ -858,17 +858,17 @@ TEST_F(TabStripModelTest, TestSelectOnClose) {
// Now test that when a tab doesn't have an opener, selection shifts to the
// right when the tab is closed.
InsertTabContentses(&tabstrip, contents1, contents2, contents3);
- EXPECT_EQ(0, tabstrip.selected_index());
+ EXPECT_EQ(0, tabstrip.active_index());
tabstrip.ForgetAllOpeners();
tabstrip.SelectTabContentsAt(1, true);
- EXPECT_EQ(1, tabstrip.selected_index());
+ EXPECT_EQ(1, tabstrip.active_index());
tabstrip.DetachTabContentsAt(1);
- EXPECT_EQ(1, tabstrip.selected_index());
+ EXPECT_EQ(1, tabstrip.active_index());
tabstrip.DetachTabContentsAt(1);
- EXPECT_EQ(1, tabstrip.selected_index());
+ EXPECT_EQ(1, tabstrip.active_index());
tabstrip.DetachTabContentsAt(1);
- EXPECT_EQ(0, tabstrip.selected_index());
+ EXPECT_EQ(0, tabstrip.active_index());
for (int i = tabstrip.count() - 1; i >= 1; --i)
tabstrip.DetachTabContentsAt(i);
@@ -876,15 +876,15 @@ TEST_F(TabStripModelTest, TestSelectOnClose) {
// Now test that when a tab does have an opener, it selects the next tab
// opened by the same opener scanning LTR when it is closed.
InsertTabContentses(&tabstrip, contents1, contents2, contents3);
- EXPECT_EQ(0, tabstrip.selected_index());
+ EXPECT_EQ(0, tabstrip.active_index());
tabstrip.SelectTabContentsAt(2, false);
- EXPECT_EQ(2, tabstrip.selected_index());
+ EXPECT_EQ(2, tabstrip.active_index());
tabstrip.CloseTabContentsAt(2, TabStripModel::CLOSE_NONE);
- EXPECT_EQ(2, tabstrip.selected_index());
+ EXPECT_EQ(2, tabstrip.active_index());
tabstrip.CloseTabContentsAt(2, TabStripModel::CLOSE_NONE);
- EXPECT_EQ(1, tabstrip.selected_index());
+ EXPECT_EQ(1, tabstrip.active_index());
tabstrip.CloseTabContentsAt(1, TabStripModel::CLOSE_NONE);
- EXPECT_EQ(0, tabstrip.selected_index());
+ EXPECT_EQ(0, tabstrip.active_index());
// Finally test that when a tab has no "siblings" that the opener is
// selected.
TabContentsWrapper* other_contents = CreateTabContents();
@@ -894,9 +894,9 @@ TEST_F(TabStripModelTest, TestSelectOnClose) {
tabstrip.InsertTabContentsAt(2, opened_contents,
TabStripModel::ADD_SELECTED |
TabStripModel::ADD_INHERIT_GROUP);
- EXPECT_EQ(2, tabstrip.selected_index());
+ EXPECT_EQ(2, tabstrip.active_index());
tabstrip.CloseTabContentsAt(2, TabStripModel::CLOSE_NONE);
- EXPECT_EQ(0, tabstrip.selected_index());
+ EXPECT_EQ(0, tabstrip.active_index());
tabstrip.CloseAllTabs();
EXPECT_TRUE(tabstrip.empty());
@@ -1090,7 +1090,7 @@ TEST_F(TabStripModelTest, TestContextMenuCloseCommands) {
TabContentsWrapper* contents3 = CreateTabContents();
InsertTabContentses(&tabstrip, contents1, contents2, contents3);
- EXPECT_EQ(0, tabstrip.selected_index());
+ EXPECT_EQ(0, tabstrip.active_index());
tabstrip.ExecuteContextMenuCommand(2, TabStripModel::CommandCloseTab);
EXPECT_EQ(3, tabstrip.count());
@@ -1431,15 +1431,15 @@ TEST_F(TabStripModelTest, AppendContentsReselectionTest) {
TabStripModel::ADD_NONE);
// The selected tab should still be the first.
- EXPECT_EQ(0, tabstrip.selected_index());
+ EXPECT_EQ(0, tabstrip.active_index());
// Now simulate a link click that opens a new tab (by virtue of target=_blank)
// and make sure the right tab gets selected when the new tab is closed.
TabContentsWrapper* target_blank_contents = CreateTabContents();
tabstrip.AppendTabContents(target_blank_contents, true);
- EXPECT_EQ(2, tabstrip.selected_index());
+ EXPECT_EQ(2, tabstrip.active_index());
tabstrip.CloseTabContentsAt(2, TabStripModel::CLOSE_NONE);
- EXPECT_EQ(0, tabstrip.selected_index());
+ EXPECT_EQ(0, tabstrip.active_index());
// clean up after ourselves
tabstrip.CloseAllTabs();
@@ -1476,19 +1476,19 @@ TEST_F(TabStripModelTest, ReselectionConsidersChildrenTest) {
EXPECT_EQ(page_a_a_a_contents, strip.GetTabContentsAt(2));
// Close page A.A
- strip.CloseTabContentsAt(strip.selected_index(), TabStripModel::CLOSE_NONE);
+ strip.CloseTabContentsAt(strip.active_index(), TabStripModel::CLOSE_NONE);
// Page A.A.A should be selected, NOT A.B
EXPECT_EQ(page_a_a_a_contents, strip.GetSelectedTabContents());
// Close page A.A.A
- strip.CloseTabContentsAt(strip.selected_index(), TabStripModel::CLOSE_NONE);
+ strip.CloseTabContentsAt(strip.active_index(), TabStripModel::CLOSE_NONE);
// Page A.B should be selected
EXPECT_EQ(page_a_b_contents, strip.GetSelectedTabContents());
// Close page A.B
- strip.CloseTabContentsAt(strip.selected_index(), TabStripModel::CLOSE_NONE);
+ strip.CloseTabContentsAt(strip.active_index(), TabStripModel::CLOSE_NONE);
// Page A should be selected
EXPECT_EQ(page_a_contents, strip.GetSelectedTabContents());
@@ -1526,13 +1526,13 @@ TEST_F(TabStripModelTest, AddTabContents_NewTabAtEndOfStripInheritsGroup) {
TabStripModel::ADD_SELECTED);
EXPECT_EQ(4, strip.GetIndexOfTabContents(new_tab_contents));
- EXPECT_EQ(4, strip.selected_index());
+ EXPECT_EQ(4, strip.active_index());
// Close the New Tab that was just opened. We should be returned to page B's
// Tab...
strip.CloseTabContentsAt(4, TabStripModel::CLOSE_NONE);
- EXPECT_EQ(1, strip.selected_index());
+ EXPECT_EQ(1, strip.active_index());
// Open a non-New Tab tab at the end of the strip, with a TYPED transition.
// This is like typing a URL in the address bar and pressing Alt+Enter. The
@@ -1542,12 +1542,12 @@ TEST_F(TabStripModelTest, AddTabContents_NewTabAtEndOfStripInheritsGroup) {
TabStripModel::ADD_SELECTED);
EXPECT_EQ(4, strip.GetIndexOfTabContents(page_e_contents));
- EXPECT_EQ(4, strip.selected_index());
+ EXPECT_EQ(4, strip.active_index());
// Close the Tab. Selection should shift back to page B's Tab.
strip.CloseTabContentsAt(4, TabStripModel::CLOSE_NONE);
- EXPECT_EQ(1, strip.selected_index());
+ EXPECT_EQ(1, strip.active_index());
// Open a non-New Tab tab at the end of the strip, with some other
// transition. This is like right clicking on a bookmark and choosing "Open
@@ -1558,12 +1558,12 @@ TEST_F(TabStripModelTest, AddTabContents_NewTabAtEndOfStripInheritsGroup) {
TabStripModel::ADD_SELECTED);
EXPECT_EQ(4, strip.GetIndexOfTabContents(page_f_contents));
- EXPECT_EQ(4, strip.selected_index());
+ EXPECT_EQ(4, strip.active_index());
// Close the Tab. The next-adjacent should be selected.
strip.CloseTabContentsAt(4, TabStripModel::CLOSE_NONE);
- EXPECT_EQ(3, strip.selected_index());
+ EXPECT_EQ(3, strip.active_index());
// Clean up.
strip.CloseAllTabs();
@@ -1604,7 +1604,7 @@ TEST_F(TabStripModelTest, NavigationForgetsOpeners) {
// Close page D, page C should be selected. (part of same group).
strip.CloseTabContentsAt(3, TabStripModel::CLOSE_NONE);
- EXPECT_EQ(2, strip.selected_index());
+ EXPECT_EQ(2, strip.active_index());
// Tell the TabStripModel that we are navigating in page C via a bookmark.
strip.TabNavigating(page_c_contents, PageTransition::AUTO_BOOKMARK);
@@ -1612,7 +1612,7 @@ TEST_F(TabStripModelTest, NavigationForgetsOpeners) {
// Close page C, page E should be selected. (C is no longer part of the
// A-B-C-D group, selection moves to the right).
strip.CloseTabContentsAt(2, TabStripModel::CLOSE_NONE);
- EXPECT_EQ(page_e_contents, strip.GetTabContentsAt(strip.selected_index()));
+ EXPECT_EQ(page_e_contents, strip.GetTabContentsAt(strip.active_index()));
strip.CloseAllTabs();
}
@@ -1655,7 +1655,7 @@ TEST_F(TabStripModelTest, NavigationForgettingDoesntAffectNewTab) {
// At this point, if we close this tab the last selected one should be
// re-selected.
strip.CloseTabContentsAt(strip.count() - 1, TabStripModel::CLOSE_NONE);
- EXPECT_EQ(page_c_contents, strip.GetTabContentsAt(strip.selected_index()));
+ EXPECT_EQ(page_c_contents, strip.GetTabContentsAt(strip.active_index()));
// TEST 2: If the user is in a group of tabs and opens a new tab at the end
// of the strip, selecting any other tab in the strip will cause that new
@@ -1674,7 +1674,7 @@ TEST_F(TabStripModelTest, NavigationForgettingDoesntAffectNewTab) {
// Now close the last tab. The next adjacent should be selected.
strip.CloseTabContentsAt(strip.count() - 1, TabStripModel::CLOSE_NONE);
- EXPECT_EQ(page_d_contents, strip.GetTabContentsAt(strip.selected_index()));
+ EXPECT_EQ(page_d_contents, strip.GetTabContentsAt(strip.active_index()));
strip.CloseAllTabs();
}
@@ -2171,7 +2171,7 @@ TEST_F(TabStripModelTest, CloseSelectedTabs) {
strip.ToggleSelectionAt(1);
strip.CloseSelectedTabs();
EXPECT_EQ(1, strip.count());
- EXPECT_EQ(0, strip.selected_index());
+ EXPECT_EQ(0, strip.active_index());
strip.CloseAllTabs();
}
diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc
index 554750d..1e5bdfc 100644
--- a/chrome/browser/ui/browser.cc
+++ b/chrome/browser/ui/browser.cc
@@ -979,8 +979,8 @@ int Browser::tab_count() const {
return tab_handler_->GetTabStripModel()->count();
}
-int Browser::selected_index() const {
- return tab_handler_->GetTabStripModel()->selected_index();
+int Browser::active_index() const {
+ return tab_handler_->GetTabStripModel()->active_index();
}
int Browser::GetIndexOfController(
@@ -1134,7 +1134,7 @@ void Browser::ReplaceRestoredTab(
from_last_session);
tab_handler_->GetTabStripModel()->ReplaceNavigationControllerAt(
- tab_handler_->GetTabStripModel()->selected_index(),
+ tab_handler_->GetTabStripModel()->active_index(),
wrapper);
}
@@ -1503,7 +1503,7 @@ void Browser::SelectLastTab() {
void Browser::DuplicateTab() {
UserMetrics::RecordAction(UserMetricsAction("Duplicate"), profile_);
- DuplicateContentsAt(selected_index());
+ DuplicateContentsAt(active_index());
}
void Browser::RestoreTab() {
@@ -1532,7 +1532,7 @@ void Browser::WriteCurrentURLToClipboard() {
void Browser::ConvertPopupToTabbedBrowser() {
UserMetrics::RecordAction(UserMetricsAction("ShowAsTab"), profile_);
- int tab_strip_index = tab_handler_->GetTabStripModel()->selected_index();
+ int tab_strip_index = tab_handler_->GetTabStripModel()->active_index();
TabContentsWrapper* contents =
tab_handler_->GetTabStripModel()->DetachTabContentsAt(tab_strip_index);
Browser* browser = Browser::Create(profile_);
@@ -2803,7 +2803,7 @@ void Browser::TabSelectedAt(TabContentsWrapper* old_contents,
SessionService* session_service = profile_->GetSessionService();
if (session_service && !tab_handler_->GetTabStripModel()->closing_all()) {
session_service->SetSelectedTabInWindow(
- session_id(), tab_handler_->GetTabStripModel()->selected_index());
+ session_id(), tab_handler_->GetTabStripModel()->active_index());
}
}
}
@@ -2822,7 +2822,7 @@ void Browser::TabReplacedAt(TabStripModel* tab_strip_model,
int index) {
TabDetachedAtImpl(old_contents, index, DETACH_TYPE_REPLACE);
TabInsertedAt(new_contents, index,
- (index == tab_handler_->GetTabStripModel()->selected_index()));
+ (index == tab_handler_->GetTabStripModel()->active_index()));
int entry_count = new_contents->controller().entry_count();
if (entry_count > 0) {
@@ -3757,7 +3757,7 @@ void Browser::UpdateCommandsForTabState() {
// Window management commands
bool non_app_window = !(type() & TYPE_APP);
command_updater_.UpdateCommandEnabled(IDC_DUPLICATE_TAB,
- non_app_window && CanDuplicateContentsAt(selected_index()));
+ non_app_window && CanDuplicateContentsAt(active_index()));
// Page-related commands
window_->SetStarredState(current_tab_wrapper->is_starred());
@@ -4279,7 +4279,7 @@ void Browser::TabDetachedAtImpl(TabContentsWrapper* contents, int index,
RemoveScheduledUpdatesFor(contents->tab_contents());
if (find_bar_controller_.get() &&
- index == tab_handler_->GetTabStripModel()->selected_index()) {
+ index == tab_handler_->GetTabStripModel()->active_index()) {
find_bar_controller_->ChangeTabContents(NULL);
}
diff --git a/chrome/browser/ui/browser.h b/chrome/browser/ui/browser.h
index 3f00f19..d313e44 100644
--- a/chrome/browser/ui/browser.h
+++ b/chrome/browser/ui/browser.h
@@ -346,7 +346,7 @@ class Browser : public TabHandlerDelegate,
}
int tab_count() const;
- int selected_index() const;
+ int active_index() const;
int GetIndexOfController(const NavigationController* controller) const;
TabContentsWrapper* GetSelectedTabContentsWrapper() const;
TabContentsWrapper* GetTabContentsWrapperAt(int index) const;
diff --git a/chrome/browser/ui/browser_navigator.cc b/chrome/browser/ui/browser_navigator.cc
index b3b2ce4..bd70080 100644
--- a/chrome/browser/ui/browser_navigator.cc
+++ b/chrome/browser/ui/browser_navigator.cc
@@ -94,9 +94,8 @@ int GetIndexOfSingletonTab(browser::NavigateParams* params) {
params->browser->profile(),
&reverse_on_redirect);
- // If there are several matches: prefer currently selected tab. So we are
- // starting our search at selected tab.
- int start_index = std::max(0, params->browser->selected_index());
+ // If there are several matches: prefer the active tab by starting there.
+ int start_index = std::max(0, params->browser->active_index());
int tab_count = params->browser->tab_count();
for (int i = 0; i < tab_count; ++i) {
int tab_index = (start_index + i) % tab_count;
diff --git a/chrome/browser/ui/browser_navigator_browsertest.cc b/chrome/browser/ui/browser_navigator_browsertest.cc
index 29470e1..d2848d3 100644
--- a/chrome/browser/ui/browser_navigator_browsertest.cc
+++ b/chrome/browser/ui/browser_navigator_browsertest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -107,7 +107,7 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, Disposition_SingletonTabExisting) {
// We should have one browser with 3 tabs, the 3rd selected.
EXPECT_EQ(1u, BrowserList::size());
- EXPECT_EQ(2, browser()->selected_index());
+ EXPECT_EQ(2, browser()->active_index());
unsigned int previous_tab_contents_count =
created_tab_contents_count_ = 0;
@@ -120,7 +120,7 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, Disposition_SingletonTabExisting) {
// The middle tab should now be selected.
EXPECT_EQ(browser(), p.browser);
- EXPECT_EQ(1, browser()->selected_index());
+ EXPECT_EQ(1, browser()->active_index());
// No tab contents should have been created
EXPECT_EQ(previous_tab_contents_count,
@@ -134,7 +134,7 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
// We should have one browser with 1 tab.
EXPECT_EQ(1u, BrowserList::size());
- EXPECT_EQ(0, browser()->selected_index());
+ EXPECT_EQ(0, browser()->active_index());
// Navigate to singleton_url1.
browser::NavigateParams p(MakeNavigateParams());
@@ -145,7 +145,7 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
// We should now have 2 tabs, the 2nd one selected.
EXPECT_EQ(browser(), p.browser);
EXPECT_EQ(2, browser()->tab_count());
- EXPECT_EQ(1, browser()->selected_index());
+ EXPECT_EQ(1, browser()->active_index());
}
// This test verifies that when a navigation results in a foreground tab, the
@@ -564,7 +564,7 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
// We should have one browser with 2 tabs, the 2nd selected.
EXPECT_EQ(1u, BrowserList::size());
EXPECT_EQ(2, browser()->tab_count());
- EXPECT_EQ(1, browser()->selected_index());
+ EXPECT_EQ(1, browser()->active_index());
// Navigate to a new singleton tab with a sub-page.
browser::NavigateParams p(MakeNavigateParams());
@@ -578,7 +578,7 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
// URL.
EXPECT_EQ(browser(), p.browser);
EXPECT_EQ(3, browser()->tab_count());
- EXPECT_EQ(2, browser()->selected_index());
+ EXPECT_EQ(2, browser()->active_index());
EXPECT_EQ(GURL("chrome://settings/advanced"),
browser()->GetSelectedTabContents()->GetURL());
}
@@ -596,7 +596,7 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
// We should have one browser with 3 tabs, the 3rd selected.
EXPECT_EQ(1u, BrowserList::size());
EXPECT_EQ(3, browser()->tab_count());
- EXPECT_EQ(2, browser()->selected_index());
+ EXPECT_EQ(2, browser()->active_index());
// Navigate to singleton_url1.
browser::NavigateParams p(MakeNavigateParams());
@@ -610,7 +610,7 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
// URL.
EXPECT_EQ(browser(), p.browser);
EXPECT_EQ(3, browser()->tab_count());
- EXPECT_EQ(1, browser()->selected_index());
+ EXPECT_EQ(1, browser()->active_index());
EXPECT_EQ(GURL("chrome://settings/advanced"),
browser()->GetSelectedTabContents()->GetURL());
}
@@ -628,7 +628,7 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
// We should have one browser with 3 tabs, the 3rd selected.
EXPECT_EQ(1u, BrowserList::size());
EXPECT_EQ(3, browser()->tab_count());
- EXPECT_EQ(2, browser()->selected_index());
+ EXPECT_EQ(2, browser()->active_index());
// Navigate to singleton_url1.
browser::NavigateParams p(MakeNavigateParams());
@@ -642,7 +642,7 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
// URL.
EXPECT_EQ(browser(), p.browser);
EXPECT_EQ(3, browser()->tab_count());
- EXPECT_EQ(1, browser()->selected_index());
+ EXPECT_EQ(1, browser()->active_index());
EXPECT_EQ(GURL("chrome://settings/personal"),
browser()->GetSelectedTabContents()->GetURL());
}
@@ -660,7 +660,7 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
// We should have one browser with 3 tabs, the 3rd selected.
EXPECT_EQ(1u, BrowserList::size());
EXPECT_EQ(3, browser()->tab_count());
- EXPECT_EQ(2, browser()->selected_index());
+ EXPECT_EQ(2, browser()->active_index());
// Navigate to singleton_url1.
browser::NavigateParams p(MakeNavigateParams());
@@ -673,7 +673,7 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
// The middle tab should now be selected.
EXPECT_EQ(browser(), p.browser);
EXPECT_EQ(3, browser()->tab_count());
- EXPECT_EQ(1, browser()->selected_index());
+ EXPECT_EQ(1, browser()->active_index());
EXPECT_EQ(singleton_url1,
browser()->GetSelectedTabContents()->GetURL());
}
@@ -690,7 +690,7 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
// We should have one browser with 2 tabs, the 2nd selected.
EXPECT_EQ(1u, BrowserList::size());
EXPECT_EQ(2, browser()->tab_count());
- EXPECT_EQ(1, browser()->selected_index());
+ EXPECT_EQ(1, browser()->active_index());
// Navigate to a different settings path.
GURL singleton_url_target("chrome://settings/personal");
@@ -704,7 +704,7 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
// The second tab should still be selected, but navigated to the new path.
EXPECT_EQ(browser(), p.browser);
EXPECT_EQ(2, browser()->tab_count());
- EXPECT_EQ(1, browser()->selected_index());
+ EXPECT_EQ(1, browser()->active_index());
EXPECT_EQ(singleton_url_target,
browser()->GetSelectedTabContents()->GetURL());
}
@@ -719,7 +719,7 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
browser()->AddSelectedTabWithURL(singleton_url_current, PageTransition::LINK);
EXPECT_EQ(initial_tab_count + 1, browser()->tab_count());
- EXPECT_EQ(initial_tab_count, browser()->selected_index());
+ EXPECT_EQ(initial_tab_count, browser()->active_index());
// Navigate to a different settings path.
GURL singleton_url_target(
@@ -735,7 +735,7 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
// Last tab should still be selected.
EXPECT_EQ(browser(), p.browser);
EXPECT_EQ(initial_tab_count + 1, browser()->tab_count());
- EXPECT_EQ(initial_tab_count, browser()->selected_index());
+ EXPECT_EQ(initial_tab_count, browser()->active_index());
}
// This test verifies that the settings page isn't opened in the incognito
diff --git a/chrome/browser/ui/browser_tab_restore_service_delegate.cc b/chrome/browser/ui/browser_tab_restore_service_delegate.cc
index 2f80156..4d8976d 100644
--- a/chrome/browser/ui/browser_tab_restore_service_delegate.cc
+++ b/chrome/browser/ui/browser_tab_restore_service_delegate.cc
@@ -21,7 +21,7 @@ int BrowserTabRestoreServiceDelegate::GetTabCount() const {
}
int BrowserTabRestoreServiceDelegate::GetSelectedIndex() const {
- return browser_->selected_index();
+ return browser_->active_index();
}
TabContents* BrowserTabRestoreServiceDelegate::GetTabContentsAt(
diff --git a/chrome/browser/ui/cocoa/applescript/window_applescript.mm b/chrome/browser/ui/cocoa/applescript/window_applescript.mm
index e82e6cf..465e2f7 100644
--- a/chrome/browser/ui/cocoa/applescript/window_applescript.mm
+++ b/chrome/browser/ui/cocoa/applescript/window_applescript.mm
@@ -105,7 +105,7 @@
- (NSNumber*)activeTabIndex {
// Note: applescript is 1-based, that is lists begin with index 1.
- int activeTabIndex = browser_->selected_index() + 1;
+ int activeTabIndex = browser_->active_index() + 1;
if (!activeTabIndex) {
return nil;
}
diff --git a/chrome/browser/ui/cocoa/tabpose_window.mm b/chrome/browser/ui/cocoa/tabpose_window.mm
index 4349089..2626f72 100644
--- a/chrome/browser/ui/cocoa/tabpose_window.mm
+++ b/chrome/browser/ui/cocoa/tabpose_window.mm
@@ -608,7 +608,7 @@ class TileSet {
};
void TileSet::Build(TabStripModel* source_model) {
- selected_index_ = source_model->selected_index();
+ selected_index_ = source_model->active_index();
tiles_.resize(source_model->count());
for (size_t i = 0; i < tiles_.size(); ++i) {
tiles_[i] = new Tile;
@@ -1283,7 +1283,7 @@ void AnimateCALayerOpacityFromTo(
[self fadeAwayInSlomo:([event modifierFlags] & NSShiftKeyMask) != 0];
break;
case '\e': // Escape
- tileSet_->set_selected_index(tabStripModel_->selected_index());
+ tileSet_->set_selected_index(tabStripModel_->active_index());
[self fadeAwayInSlomo:([event modifierFlags] & NSShiftKeyMask) != 0];
break;
}
diff --git a/chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm b/chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm
index 7ccaf96..d9cb69b 100644
--- a/chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm
+++ b/chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm
@@ -1449,7 +1449,7 @@ class NotificationBridge : public NotificationObserver {
// Take closing tabs into account.
NSInteger index = [self indexFromModelIndex:modelIndex];
- if (modelIndex == tabStripModel_->selected_index())
+ if (modelIndex == tabStripModel_->active_index())
[delegate_ onSelectedTabChange:change];
if (change == TabStripModelObserver::TITLE_NOT_LOADING) {
@@ -1535,7 +1535,7 @@ class NotificationBridge : public NotificationObserver {
}
- (NSView*)selectedTabView {
- int selectedIndex = tabStripModel_->selected_index();
+ int selectedIndex = tabStripModel_->active_index();
// Take closing tabs into account. They can't ever be selected.
selectedIndex = [self indexFromModelIndex:selectedIndex];
return [self viewAtIndex:selectedIndex];
@@ -1975,7 +1975,7 @@ class NotificationBridge : public NotificationObserver {
}
- (TabContentsController*)activeTabContentsController {
- int modelIndex = tabStripModel_->selected_index();
+ int modelIndex = tabStripModel_->active_index();
if (modelIndex < 0)
return nil;
NSInteger index = [self indexFromModelIndex:modelIndex];
diff --git a/chrome/browser/ui/gtk/browser_titlebar.cc b/chrome/browser/ui/gtk/browser_titlebar.cc
index 7e2ad02..81cab17 100644
--- a/chrome/browser/ui/gtk/browser_titlebar.cc
+++ b/chrome/browser/ui/gtk/browser_titlebar.cc
@@ -763,7 +763,7 @@ gboolean BrowserTitlebar::OnWindowStateChanged(GtkWindow* window,
gboolean BrowserTitlebar::OnScroll(GtkWidget* widget, GdkEventScroll* event) {
TabStripModel* tabstrip_model = browser_window_->browser()->tabstrip_model();
- int index = tabstrip_model->selected_index();
+ int index = tabstrip_model->active_index();
if (event->direction == GDK_SCROLL_LEFT ||
event->direction == GDK_SCROLL_UP) {
if (index != 0)
diff --git a/chrome/browser/ui/gtk/browser_window_gtk.cc b/chrome/browser/ui/gtk/browser_window_gtk.cc
index b003bc6..630a898 100644
--- a/chrome/browser/ui/gtk/browser_window_gtk.cc
+++ b/chrome/browser/ui/gtk/browser_window_gtk.cc
@@ -1144,7 +1144,7 @@ void BrowserWindowGtk::TabDetachedAt(TabContentsWrapper* contents, int index) {
// We use index here rather than comparing |contents| because by this time
// the model has already removed |contents| from its list, so
// browser_->GetSelectedTabContents() will return NULL or something else.
- if (index == browser_->tabstrip_model()->selected_index()) {
+ if (index == browser_->tabstrip_model()->active_index()) {
infobar_container_->ChangeTabContents(NULL);
UpdateDevToolsForContents(NULL);
}
diff --git a/chrome/browser/ui/gtk/tabs/tab_strip_gtk.cc b/chrome/browser/ui/gtk/tabs/tab_strip_gtk.cc
index aa22e47..be5406b 100644
--- a/chrome/browser/ui/gtk/tabs/tab_strip_gtk.cc
+++ b/chrome/browser/ui/gtk/tabs/tab_strip_gtk.cc
@@ -275,7 +275,7 @@ class InsertTabAnimation : public TabStripGtk::TabAnimation {
// Overridden from TabStripGtk::TabAnimation:
virtual double GetWidthForTab(int index) const {
if (index == index_) {
- bool is_selected = tabstrip_->model()->selected_index() == index;
+ bool is_selected = tabstrip_->model()->active_index() == index;
double start_width, target_width;
if (index < tabstrip_->GetMiniTabCount()) {
start_width = TabGtk::GetMinimumSelectedSize().width();
@@ -1096,7 +1096,7 @@ bool TabStripGtk::IsTabSelected(const TabGtk* tab) const {
if (tab->closing())
return false;
- return GetIndexOfTab(tab) == model_->selected_index();
+ return GetIndexOfTab(tab) == model_->active_index();
}
bool TabStripGtk::IsTabDetached(const TabGtk* tab) const {
diff --git a/chrome/browser/ui/views/frame/browser_view.cc b/chrome/browser/ui/views/frame/browser_view.cc
index 7227f88..0e62385 100644
--- a/chrome/browser/ui/views/frame/browser_view.cc
+++ b/chrome/browser/ui/views/frame/browser_view.cc
@@ -1269,7 +1269,7 @@ void BrowserView::TabDetachedAt(TabContentsWrapper* contents, int index) {
// We use index here rather than comparing |contents| because by this time
// the model has already removed |contents| from its list, so
// browser_->GetSelectedTabContents() will return NULL or something else.
- if (index == browser_->tabstrip_model()->selected_index()) {
+ if (index == browser_->tabstrip_model()->active_index()) {
// We need to reset the current tab contents to NULL before it gets
// freed. This is because the focus manager performs some operations
// on the selected TabContents when it is removed.
@@ -1302,7 +1302,7 @@ void BrowserView::TabReplacedAt(TabStripModel* tab_strip_model,
TabContentsWrapper* old_contents,
TabContentsWrapper* new_contents,
int index) {
- if (index != browser_->tabstrip_model()->selected_index())
+ if (index != browser_->tabstrip_model()->active_index())
return;
// Swap the 'active' and 'preview' and delete what was the active.
diff --git a/chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc b/chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc
index a8a4170..650fc3b 100644
--- a/chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc
+++ b/chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc
@@ -151,10 +151,8 @@ void BrowserTabStripController::InitFromModel(BaseTabStrip* tabstrip) {
tabstrip_ = tabstrip;
// Walk the model, calling our insertion observer method for each item within
// it.
- for (int i = 0; i < model_->count(); ++i) {
- TabInsertedAt(model_->GetTabContentsAt(i), i,
- model_->selected_index() == i);
- }
+ for (int i = 0; i < model_->count(); ++i)
+ TabInsertedAt(model_->GetTabContentsAt(i), i, model_->active_index() == i);
}
bool BrowserTabStripController::IsCommandEnabledForTab(
@@ -194,7 +192,7 @@ bool BrowserTabStripController::IsValidIndex(int index) const {
}
bool BrowserTabStripController::IsActiveTab(int model_index) const {
- return model_->selected_index() == model_index;
+ return model_->active_index() == model_index;
}
bool BrowserTabStripController::IsTabSelected(int model_index) const {
diff --git a/chrome/browser/ui/webui/bug_report_ui.cc b/chrome/browser/ui/webui/bug_report_ui.cc
index 5f1e742..53ab28c 100644
--- a/chrome/browser/ui/webui/bug_report_ui.cc
+++ b/chrome/browser/ui/webui/bug_report_ui.cc
@@ -156,7 +156,7 @@ void ShowHtmlBugReportView(Browser* browser) {
RefreshLastScreenshot(browser);
std::string bug_report_url = std::string(chrome::kChromeUIBugReportURL) +
- "#" + base::IntToString(browser->selected_index());
+ "#" + base::IntToString(browser->active_index());
browser->ShowSingletonTab(GURL(bug_report_url));
}
diff --git a/chrome/browser/ui/webui/mediaplayer_browsertest.cc b/chrome/browser/ui/webui/mediaplayer_browsertest.cc
index 0a24716..32d0a17 100644
--- a/chrome/browser/ui/webui/mediaplayer_browsertest.cc
+++ b/chrome/browser/ui/webui/mediaplayer_browsertest.cc
@@ -34,7 +34,7 @@ class MediaPlayerBrowserTest : public InProcessBrowserTest {
it != BrowserList::end(); ++it) {
if ((*it)->type() == Browser::TYPE_APP_PANEL) {
const GURL& url =
- (*it)->GetTabContentsAt((*it)->selected_index())->GetURL();
+ (*it)->GetTabContentsAt((*it)->active_index())->GetURL();
if (url.SchemeIs(chrome::kChromeUIScheme) &&
url.host() == chrome::kChromeUIMediaplayerHost) {
@@ -50,7 +50,7 @@ class MediaPlayerBrowserTest : public InProcessBrowserTest {
it != BrowserList::end(); ++it) {
if ((*it)->type() == Browser::TYPE_APP_PANEL) {
const GURL& url =
- (*it)->GetTabContentsAt((*it)->selected_index())->GetURL();
+ (*it)->GetTabContentsAt((*it)->active_index())->GetURL();
if (url.SchemeIs(chrome::kChromeUIScheme) &&
url.host() == chrome::kChromeUIMediaplayerHost &&
diff --git a/chrome/test/ui_test_utils.cc b/chrome/test/ui_test_utils.cc
index d8509f5..b58eea9 100644
--- a/chrome/test/ui_test_utils.cc
+++ b/chrome/test/ui_test_utils.cc
@@ -515,7 +515,7 @@ static void NavigateToURLWithDispositionBlockUntilNavigationsComplete(
TabContents* tab_contents = NULL;
if (disposition == NEW_BACKGROUND_TAB) {
// We've opened up a new tab, but not selected it.
- tab_contents = browser->GetTabContentsAt(browser->selected_index() + 1);
+ tab_contents = browser->GetTabContentsAt(browser->active_index() + 1);
EXPECT_TRUE(tab_contents != NULL)
<< " Unable to wait for navigation to \"" << url.spec()
<< "\" because the new tab is not available yet";
diff --git a/content/browser/renderer_host/render_view_host_manager_browsertest.cc b/content/browser/renderer_host/render_view_host_manager_browsertest.cc
index 059e6a3..1e02ca9 100644
--- a/content/browser/renderer_host/render_view_host_manager_browsertest.cc
+++ b/content/browser/renderer_host/render_view_host_manager_browsertest.cc
@@ -77,7 +77,7 @@ IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest,
// Opens in new tab.
EXPECT_EQ(2, browser()->tab_count());
- EXPECT_EQ(1, browser()->selected_index());
+ EXPECT_EQ(1, browser()->active_index());
EXPECT_EQ("/files/title2.html",
browser()->GetSelectedTabContents()->GetURL().path());
@@ -131,7 +131,7 @@ IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest,
// Opens in new tab.
EXPECT_EQ(2, browser()->tab_count());
- EXPECT_EQ(1, browser()->selected_index());
+ EXPECT_EQ(1, browser()->active_index());
// Wait for the cross-site transition in the new tab to finish.
ui_test_utils::WaitForLoadStop(browser()->GetSelectedTabContents());
@@ -182,7 +182,7 @@ IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest,
// Opens in same tab.
EXPECT_EQ(1, browser()->tab_count());
- EXPECT_EQ(0, browser()->selected_index());
+ EXPECT_EQ(0, browser()->active_index());
EXPECT_EQ("/files/title2.html",
browser()->GetSelectedTabContents()->GetURL().path());
@@ -330,7 +330,7 @@ IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, ClickLinkAfter204Error) {
// Opens in same tab.
EXPECT_EQ(1, browser()->tab_count());
- EXPECT_EQ(0, browser()->selected_index());
+ EXPECT_EQ(0, browser()->active_index());
EXPECT_EQ("/files/title2.html",
browser()->GetSelectedTabContents()->GetURL().path());