diff options
31 files changed, 148 insertions, 152 deletions
diff --git a/chrome/browser/autocomplete/autocomplete_edit_view_browsertest.cc b/chrome/browser/autocomplete/autocomplete_edit_view_browsertest.cc index 7ac23cb..b4383054 100644 --- a/chrome/browser/autocomplete/autocomplete_edit_view_browsertest.cc +++ b/chrome/browser/autocomplete/autocomplete_edit_view_browsertest.cc @@ -1077,7 +1077,7 @@ class AutocompleteEditViewTest : public InProcessBrowserTest, browser()->NewTab(); // Switch back to the first tab. - browser()->SelectTabContentsAt(0, true); + browser()->ActivateTabAt(0, true); // Make sure we're still in keyword mode. ASSERT_EQ(kSearchKeyword, UTF16ToUTF8(edit_view->model()->keyword())); diff --git a/chrome/browser/automation/automation_provider.cc b/chrome/browser/automation/automation_provider.cc index 22c59d2..2e2eea9 100644 --- a/chrome/browser/automation/automation_provider.cc +++ b/chrome/browser/automation/automation_provider.cc @@ -448,7 +448,7 @@ Browser* AutomationProvider::FindAndActivateTab( int tab_index; Browser* browser = Browser::GetBrowserForController(controller, &tab_index); if (browser) - browser->SelectTabContentsAt(tab_index, true); + browser->ActivateTabAt(tab_index, true); return browser; } diff --git a/chrome/browser/automation/testing_automation_provider.cc b/chrome/browser/automation/testing_automation_provider.cc index 3d3538d..ae3b320 100644 --- a/chrome/browser/automation/testing_automation_provider.cc +++ b/chrome/browser/automation/testing_automation_provider.cc @@ -447,7 +447,7 @@ void TestingAutomationProvider::ActivateTab(int handle, if (browser_tracker_->ContainsHandle(handle) && at_index > -1) { Browser* browser = browser_tracker_->GetResource(handle); if (at_index >= 0 && at_index < browser->tab_count()) { - browser->SelectTabContentsAt(at_index, true); + browser->ActivateTabAt(at_index, true); *status = 0; } } @@ -4747,7 +4747,7 @@ void TestingAutomationProvider::SendOSLevelKeyEventToTab( } // The key events will be sent to the browser window, we need the current tab // containing the element we send the text in to be shown. - browser->SelectTabContentsAt( + browser->ActivateTabAt( browser->GetIndexOfController(&tab_contents->controller()), true); BrowserWindow* browser_window = browser->window(); @@ -5333,7 +5333,7 @@ void TestingAutomationProvider::ActivateTabJSON( reply.SendError(error); return; } - browser->SelectTabContentsAt( + browser->ActivateTabAt( browser->GetIndexOfController(&tab_contents->controller()), true); reply.SendSuccess(NULL); } diff --git a/chrome/browser/browser_commands_unittest.cc b/chrome/browser/browser_commands_unittest.cc index d6f7ce2..f07c192 100644 --- a/chrome/browser/browser_commands_unittest.cc +++ b/chrome/browser/browser_commands_unittest.cc @@ -26,7 +26,7 @@ TEST_F(BrowserCommandsTest, TabNavigationAccelerators) { AddTab(browser(), about_blank); // Select the second tab. - browser()->SelectTabContentsAt(1, false); + browser()->ActivateTabAt(1, false); // Navigate to the first tab using an accelerator. browser()->ExecuteCommand(IDC_SELECT_TAB_0); @@ -128,7 +128,7 @@ TEST_F(BrowserCommandsTest, BackForwardInNewTab) { EXPECT_TRUE(first->controller().CanGoForward()); // Select the second tab and make it go forward in a new background tab. - browser()->SelectTabContentsAt(1, true); + browser()->ActivateTabAt(1, true); // TODO(brettw) bug 11055: It should not be necessary to commit the load here, // but because of this bug, it will assert later if we don't. When the bug is // fixed, one of the three commits here related to this bug should be removed @@ -152,7 +152,7 @@ TEST_F(BrowserCommandsTest, BackForwardInNewTab) { // Now do back in a new foreground tab. Don't bother re-checking every sngle // thing above, just validate that it's opening properly. - browser()->SelectTabContentsAt(2, true); + browser()->ActivateTabAt(2, true); // TODO(brettw) bug 11055: see the comment above about why we need this. CommitPendingLoad(&second->controller()); browser()->GoBack(NEW_FOREGROUND_TAB); diff --git a/chrome/browser/browser_focus_uitest.cc b/chrome/browser/browser_focus_uitest.cc index 568f322..5b0e2bb 100644 --- a/chrome/browser/browser_focus_uitest.cc +++ b/chrome/browser/browser_focus_uitest.cc @@ -288,7 +288,7 @@ IN_PROC_BROWSER_TEST_F(BrowserFocusTest, DISABLED_TabsRememberFocus) { for (int i = 1; i < 3; i++) { for (int j = 0; j < 5; j++) { // Activate the tab. - browser()->SelectTabContentsAt(j, true); + browser()->ActivateTabAt(j, true); // Activate the location bar or the page. if (kFocusPage[i][j]) { @@ -301,14 +301,14 @@ IN_PROC_BROWSER_TEST_F(BrowserFocusTest, DISABLED_TabsRememberFocus) { // Now come back to the tab and check the right view is focused. for (int j = 0; j < 5; j++) { // Activate the tab. - browser()->SelectTabContentsAt(j, true); + browser()->ActivateTabAt(j, true); ViewID vid = kFocusPage[i][j] ? VIEW_ID_TAB_CONTAINER_FOCUS_VIEW : VIEW_ID_LOCATION_BAR; ASSERT_TRUE(IsViewFocused(vid)); } - browser()->SelectTabContentsAt(0, true); + browser()->ActivateTabAt(0, true); // Try the above, but with ctrl+tab. Since tab normally changes focus, // this has regressed in the past. Loop through several times to be sure. for (int j = 0; j < 15; j++) { @@ -321,7 +321,7 @@ IN_PROC_BROWSER_TEST_F(BrowserFocusTest, DISABLED_TabsRememberFocus) { } // As above, but with ctrl+shift+tab. - browser()->SelectTabContentsAt(4, true); + browser()->ActivateTabAt(4, true); for (int j = 14; j >= 0; --j) { ViewID vid = kFocusPage[i][j % 5] ? VIEW_ID_TAB_CONTAINER_FOCUS_VIEW : VIEW_ID_LOCATION_BAR; @@ -358,16 +358,16 @@ IN_PROC_BROWSER_TEST_F(BrowserFocusTest, MAYBE_TabsRememberFocusFindInPage) { // Select 1st tab, focus should still be on the location-bar. // (bug http://crbug.com/23296) - browser()->SelectTabContentsAt(0, true); + browser()->ActivateTabAt(0, true); ASSERT_TRUE(IsViewFocused(VIEW_ID_LOCATION_BAR)); // Now open the find box again, switch to another tab and come back, the focus // should return to the find box. browser()->Find(); ASSERT_TRUE(IsViewFocused(VIEW_ID_FIND_IN_PAGE_TEXT_FIELD)); - browser()->SelectTabContentsAt(1, true); + browser()->ActivateTabAt(1, true); ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER_FOCUS_VIEW)); - browser()->SelectTabContentsAt(0, true); + browser()->ActivateTabAt(0, true); ASSERT_TRUE(IsViewFocused(VIEW_ID_FIND_IN_PAGE_TEXT_FIELD)); } diff --git a/chrome/browser/chromeos/wm_overview_controller.cc b/chrome/browser/chromeos/wm_overview_controller.cc index 375c0dd..fed086a 100644 --- a/chrome/browser/chromeos/wm_overview_controller.cc +++ b/chrome/browser/chromeos/wm_overview_controller.cc @@ -304,7 +304,7 @@ int BrowserListener::ConfigureNextUnconfiguredSnapshot(int start_from) { void BrowserListener::RestoreOriginalSelectedTab() { if (original_selected_tab_ >= 0) { - browser_->SelectTabContentsAt(original_selected_tab_, false); + browser_->ActivateTabAt(original_selected_tab_, false); UpdateSelectedIndex(browser_->active_index()); } } @@ -330,7 +330,7 @@ void BrowserListener::SelectTab(int index, uint32 timestamp) { uint32 old_value = select_tab_timestamp_; select_tab_timestamp_ = timestamp; - browser_->SelectTabContentsAt(index, true); + browser_->ActivateTabAt(index, true); select_tab_timestamp_ = old_value; } diff --git a/chrome/browser/debugger/devtools_window.cc b/chrome/browser/debugger/devtools_window.cc index bef318d..4092c1a 100644 --- a/chrome/browser/debugger/devtools_window.cc +++ b/chrome/browser/debugger/devtools_window.cc @@ -148,7 +148,7 @@ void DevToolsWindow::Show(DevToolsToggleAction action) { tab_contents_->view()->SetInitialFocus(); inspected_window->Show(); TabStripModel* tabstrip_model = inspected_browser->tabstrip_model(); - tabstrip_model->SelectTabContentsAt(inspected_tab_index, true); + tabstrip_model->ActivateTabAt(inspected_tab_index, true); ScheduleAction(action); return; } else { @@ -242,8 +242,7 @@ void DevToolsWindow::CreateDevToolsBrowser() { browser_ = Browser::CreateForDevTools(profile_); browser_->tabstrip_model()->AddTabContents( - tab_contents_, -1, PageTransition::START_PAGE, - TabStripModel::ADD_SELECTED); + tab_contents_, -1, PageTransition::START_PAGE, TabStripModel::ADD_ACTIVE); } bool DevToolsWindow::FindInspectedBrowserAndTabIndex(Browser** browser, diff --git a/chrome/browser/download/download_browsertest.cc b/chrome/browser/download/download_browsertest.cc index 32e24a3..b08bdd49 100644 --- a/chrome/browser/download/download_browsertest.cc +++ b/chrome/browser/download/download_browsertest.cc @@ -614,7 +614,7 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, PerWindowShelf) { EXPECT_FALSE(IsDownloadUIVisible(browser())); // Go to the first tab. - browser()->SelectTabContentsAt(0, true); + browser()->ActivateTabAt(0, true); EXPECT_EQ(2, browser()->tab_count()); // The download shelf should not be visible. diff --git a/chrome/browser/extensions/browser_action_apitest.cc b/chrome/browser/extensions/browser_action_apitest.cc index 039a70d9..e9a970b 100644 --- a/chrome/browser/extensions/browser_action_apitest.cc +++ b/chrome/browser/extensions/browser_action_apitest.cc @@ -137,7 +137,7 @@ IN_PROC_BROWSER_TEST_F(BrowserActionApiTest, EXPECT_EQ("hi!", GetBrowserActionsBar().GetTooltip(0)); // Go back to first tab, changed title should reappear. - browser()->SelectTabContentsAt(0, true); + browser()->ActivateTabAt(0, true); EXPECT_EQ("Showing icon 2", GetBrowserActionsBar().GetTooltip(0)); // Reload that tab, default title should come back. diff --git a/chrome/browser/extensions/extension_install_ui.cc b/chrome/browser/extensions/extension_install_ui.cc index 0cbc57c..ba1f144 100644 --- a/chrome/browser/extensions/extension_install_ui.cc +++ b/chrome/browser/extensions/extension_install_ui.cc @@ -76,7 +76,7 @@ void ShowAppInstalledAnimation(Browser* browser, const std::string& app_id) { TabContents* tab_contents = browser->GetTabContentsAt(i); GURL url = tab_contents->GetURL(); if (StartsWithASCII(url.spec(), chrome::kChromeUINewTabURL, false)) { - browser->SelectTabContentsAt(i, false); + browser->ActivateTabAt(i, false); return; } } diff --git a/chrome/browser/extensions/extension_tabs_module.cc b/chrome/browser/extensions/extension_tabs_module.cc index e986d91..bed30c0 100644 --- a/chrome/browser/extensions/extension_tabs_module.cc +++ b/chrome/browser/extensions/extension_tabs_module.cc @@ -740,7 +740,7 @@ bool CreateTabFunction::RunImpl() { index = std::min(std::max(index, -1), tab_strip->count()); - int add_types = selected ? TabStripModel::ADD_SELECTED : + int add_types = selected ? TabStripModel::ADD_ACTIVE : TabStripModel::ADD_NONE; add_types |= TabStripModel::ADD_FORCE_INDEX; if (pinned) @@ -881,7 +881,7 @@ bool UpdateTabFunction::RunImpl() { &selected)); if (selected) { if (tab_strip->active_index() != tab_index) { - tab_strip->SelectTabContentsAt(tab_index, false); + tab_strip->ActivateTabAt(tab_index, false); DCHECK_EQ(contents, tab_strip->GetSelectedTabContents()); } contents->tab_contents()->Focus(); diff --git a/chrome/browser/renderer_host/web_cache_manager_browsertest.cc b/chrome/browser/renderer_host/web_cache_manager_browsertest.cc index 7216a6a..b2e8471 100644 --- a/chrome/browser/renderer_host/web_cache_manager_browsertest.cc +++ b/chrome/browser/renderer_host/web_cache_manager_browsertest.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2009 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. @@ -36,21 +36,21 @@ IN_PROC_BROWSER_TEST_F(WebCacheManagerBrowserTest, DISABLED_CrashOnceOnly) { base::KillProcess(tab->GetRenderProcessHost()->GetHandle(), ResultCodes::KILLED, true); - browser()->SelectTabContentsAt(0, true); + browser()->ActivateTabAt(0, true); browser()->NewTab(); ui_test_utils::NavigateToURL(browser(), url); - browser()->SelectTabContentsAt(0, true); + browser()->ActivateTabAt(0, true); browser()->NewTab(); ui_test_utils::NavigateToURL(browser(), url); // We would have crashed at the above line with the bug. - browser()->SelectTabContentsAt(0, true); + browser()->ActivateTabAt(0, true); browser()->CloseTab(); - browser()->SelectTabContentsAt(0, true); + browser()->ActivateTabAt(0, true); browser()->CloseTab(); - browser()->SelectTabContentsAt(0, true); + browser()->ActivateTabAt(0, true); browser()->CloseTab(); ui_test_utils::NavigateToURL(browser(), url); diff --git a/chrome/browser/sessions/session_restore.cc b/chrome/browser/sessions/session_restore.cc index fc209a4..1b3b5f7 100644 --- a/chrome/browser/sessions/session_restore.cc +++ b/chrome/browser/sessions/session_restore.cc @@ -692,13 +692,13 @@ class SessionRestoreImpl : public NotificationObserver { int initial_tab_count, int selected_session_index) { if (browser_ == browser) { - browser->SelectTabContentsAt(browser->tab_count() - 1, true); + browser->ActivateTabAt(browser->tab_count() - 1, true); return; } DCHECK(browser); DCHECK(browser->tab_count()); - browser->SelectTabContentsAt( + browser->ActivateTabAt( std::min(initial_tab_count + std::max(0, selected_session_index), browser->tab_count() - 1), true); browser->window()->Show(); @@ -713,7 +713,7 @@ class SessionRestoreImpl : public NotificationObserver { for (size_t i = 0; i < urls.size(); ++i) { int add_types = TabStripModel::ADD_FORCE_INDEX; if (i == 0) - add_types |= TabStripModel::ADD_SELECTED; + add_types |= TabStripModel::ADD_ACTIVE; int index = browser->GetIndexForInsertionDuringRestore(i); browser::NavigateParams params(browser, urls[i], PageTransition::START_PAGE); diff --git a/chrome/browser/tabs/tab_strip_model.cc b/chrome/browser/tabs/tab_strip_model.cc index c4d1aa1..fc6e57e 100644 --- a/chrome/browser/tabs/tab_strip_model.cc +++ b/chrome/browser/tabs/tab_strip_model.cc @@ -109,14 +109,14 @@ void TabStripModel::AppendTabContents(TabContentsWrapper* contents, bool foreground) { int index = order_controller_->DetermineInsertionIndexForAppending(); InsertTabContentsAt(index, contents, - foreground ? (ADD_INHERIT_GROUP | ADD_SELECTED) : + foreground ? (ADD_INHERIT_GROUP | ADD_ACTIVE) : ADD_NONE); } void TabStripModel::InsertTabContentsAt(int index, TabContentsWrapper* contents, int add_types) { - bool foreground = add_types & ADD_SELECTED; + bool active = add_types & ADD_ACTIVE; // Force app tabs to be pinned. bool pin = contents->extension_tab_helper()->is_app() || add_types & ADD_PINNED; @@ -135,7 +135,7 @@ void TabStripModel::InsertTabContentsAt(int index, TabContentsData* data = new TabContentsData(contents); data->pinned = pin; if ((add_types & ADD_INHERIT_GROUP) && selected_contents) { - if (foreground) { + if (active) { // Forget any existing relationships, we don't want to make things too // confusing by having multiple groups active at the same time. ForgetAllOpeners(); @@ -143,7 +143,7 @@ void TabStripModel::InsertTabContentsAt(int index, // Anything opened by a link we deem to have an opener. data->SetGroup(&selected_contents->controller()); } else if ((add_types & ADD_INHERIT_OPENER) && selected_contents) { - if (foreground) { + if (active) { // Forget any existing relationships, we don't want to make things too // confusing by having multiple groups active at the same time. ForgetAllOpeners(); @@ -156,9 +156,9 @@ void TabStripModel::InsertTabContentsAt(int index, selection_model_.IncrementFrom(index); FOR_EACH_OBSERVER(TabStripModelObserver, observers_, - TabInsertedAt(contents, index, foreground)); + TabInsertedAt(contents, index, active)); - if (foreground) { + if (active) { selection_model_.SetSelectedIndex(index); NotifyTabSelectedIfChanged(selected_contents, index, false); } @@ -193,9 +193,7 @@ void TabStripModel::ReplaceNavigationControllerAt( // This appears to be OK with no flicker since no redraw event // occurs between the call to add an aditional tab and one to close // the previous tab. - InsertTabContentsAt( - index + 1, contents, - ADD_SELECTED | ADD_INHERIT_GROUP); + InsertTabContentsAt(index + 1, contents, ADD_ACTIVE | ADD_INHERIT_GROUP); std::vector<int> closing_tabs; closing_tabs.push_back(index); InternalCloseTabs(closing_tabs, CLOSE_NONE); @@ -242,7 +240,7 @@ TabContentsWrapper* TabStripModel::DetachTabContentsAt(int index) { return removed_contents; } -void TabStripModel::SelectTabContentsAt(int index, bool user_gesture) { +void TabStripModel::ActivateTabAt(int index, bool user_gesture) { DCHECK(ContainsIndex(index)); bool had_multi = selection_model_.selected_indices().size() > 1; TabContentsWrapper* old_contents = @@ -634,7 +632,7 @@ void TabStripModel::AddTabContents(TabContentsWrapper* contents, // link clicks, they just want to score the navigation like a link click in // the history backend, so we don't inherit the group in this case. index = order_controller_->DetermineInsertionIndex( - contents, transition, add_types & ADD_SELECTED); + contents, transition, add_types & ADD_ACTIVE); inherit_group = true; } else { // For all other types, respect what was passed to us, normalizing -1s and @@ -672,7 +670,7 @@ void TabStripModel::AddTabContents(TabContentsWrapper* contents, // layout is performed with sane view dimensions even when we're opening a // new background tab. if (TabContentsWrapper* old_contents = GetSelectedTabContents()) { - if ((add_types & ADD_SELECTED) == 0) { + if ((add_types & ADD_ACTIVE) == 0) { contents->tab_contents()->view()-> SizeContents(old_contents->tab_contents()-> view()->GetContainerSize()); @@ -698,7 +696,7 @@ void TabStripModel::SelectPreviousTab() { } void TabStripModel::SelectLastTab() { - SelectTabContentsAt(count() - 1, true); + ActivateTabAt(count() - 1, true); } void TabStripModel::MoveTabNext() { @@ -1245,7 +1243,7 @@ void TabStripModel::SelectRelativeTab(bool next) { int index = active_index(); int delta = next ? 1 : -1; index = (index + count() + delta) % count(); - SelectTabContentsAt(index, true); + ActivateTabAt(index, true); } void TabStripModel::MoveTabContentsAtImpl(int index, diff --git a/chrome/browser/tabs/tab_strip_model.h b/chrome/browser/tabs/tab_strip_model.h index ed15ffb..5873bd6 100644 --- a/chrome/browser/tabs/tab_strip_model.h +++ b/chrome/browser/tabs/tab_strip_model.h @@ -88,8 +88,8 @@ class TabStripModel : public NotificationObserver { // tab. ADD_NONE = 0, - // The tab should be selected. - ADD_SELECTED = 1 << 0, + // The tab should be active. + ADD_ACTIVE = 1 << 0, // The tab should be pinned. ADD_PINNED = 1 << 1, @@ -104,9 +104,8 @@ class TabStripModel : public NotificationObserver { // certain situations. ADD_INHERIT_GROUP = 1 << 3, - // If set the newly inserted tab's opener is set to the currently selected - // tab. If not set the tab may still inherit the group/opener under certain - // situations. + // If set the newly inserted tab's opener is set to the active tab. If not + // set the tab may still inherit the group/opener under certain situations. // NOTE: this is ignored if ADD_INHERIT_GROUP is set. ADD_INHERIT_OPENER = 1 << 4, }; @@ -160,7 +159,7 @@ class TabStripModel : public NotificationObserver { bool ContainsIndex(int index) const; // Adds the specified TabContents in the default location. Tabs opened in the - // foreground inherit the group of the previously selected tab. + // foreground inherit the group of the previously active tab. void AppendTabContents(TabContentsWrapper* contents, bool foreground); // Adds the specified TabContents at the specified location. |add_types| is a @@ -208,11 +207,11 @@ class TabStripModel : public NotificationObserver { // strip). TabContentsWrapper* DetachTabContentsAt(int index); - // Select the TabContents at the specified index. |user_gesture| is true if - // the user actually clicked on the tab or navigated to it using a keyboard - // command, false if the tab was selected as a by-product of some other + // Makes the tab at the specified index the active tab. |user_gesture| is true + // if the user actually clicked on the tab or navigated to it using a keyboard + // command, false if the tab was activated as a by-product of some other // action. - void SelectTabContentsAt(int index, bool user_gesture); + void ActivateTabAt(int index, bool user_gesture); // Move the TabContents at the specified index to another index. This method // does NOT send Detached/Attached notifications, rather it moves the diff --git a/chrome/browser/tabs/tab_strip_model_unittest.cc b/chrome/browser/tabs/tab_strip_model_unittest.cc index f1d39b1..01a8a9f 100644 --- a/chrome/browser/tabs/tab_strip_model_unittest.cc +++ b/chrome/browser/tabs/tab_strip_model_unittest.cc @@ -431,7 +431,7 @@ TEST_F(TabStripModelTest, TestBasicAPI) { // Test InsertTabContentsAt, foreground tab. TabContentsWrapper* contents2 = CreateTabContents(); { - tabstrip.InsertTabContentsAt(1, contents2, TabStripModel::ADD_SELECTED); + tabstrip.InsertTabContentsAt(1, contents2, TabStripModel::ADD_ACTIVE); EXPECT_EQ(2, tabstrip.count()); EXPECT_EQ(2, observer.GetStateCount()); @@ -457,9 +457,9 @@ TEST_F(TabStripModelTest, TestBasicAPI) { observer.ClearStates(); } - // Test SelectTabContentsAt + // Test ActivateTabAt { - tabstrip.SelectTabContentsAt(2, true); + tabstrip.ActivateTabAt(2, true); EXPECT_EQ(1, observer.GetStateCount()); State s1(contents3, 2, MockTabStripModelObserver::SELECT); s1.src_contents = contents2; @@ -564,7 +564,7 @@ TEST_F(TabStripModelTest, TestBasicAPI) { // Test SelectNextTab, SelectPreviousTab, SelectLastTab { // Make sure the second of the two tabs is selected first... - tabstrip.SelectTabContentsAt(1, true); + tabstrip.ActivateTabAt(1, true); tabstrip.SelectPreviousTab(); EXPECT_EQ(0, tabstrip.active_index()); tabstrip.SelectLastTab(); @@ -785,7 +785,7 @@ TEST_F(TabStripModelTest, TestInsertionIndexDetermination) { fg_link_contents, PageTransition::LINK, true); EXPECT_EQ(1, insert_index); tabstrip.InsertTabContentsAt(insert_index, fg_link_contents, - TabStripModel::ADD_SELECTED | + TabStripModel::ADD_ACTIVE | TabStripModel::ADD_INHERIT_GROUP); EXPECT_EQ(1, tabstrip.active_index()); EXPECT_EQ(fg_link_contents, tabstrip.GetSelectedTabContents()); @@ -804,7 +804,7 @@ TEST_F(TabStripModelTest, TestInsertionIndexDetermination) { TabStripModel::ADD_NONE); // Now select it, so that user_gesture == true causes the opener relationship // to be forgotten... - tabstrip.SelectTabContentsAt(tabstrip.count() - 1, true); + tabstrip.ActivateTabAt(tabstrip.count() - 1, true); EXPECT_EQ(tabstrip.count() - 1, tabstrip.active_index()); EXPECT_EQ(fg_nonlink_contents, tabstrip.GetSelectedTabContents()); @@ -861,7 +861,7 @@ TEST_F(TabStripModelTest, TestSelectOnClose) { EXPECT_EQ(0, tabstrip.active_index()); tabstrip.ForgetAllOpeners(); - tabstrip.SelectTabContentsAt(1, true); + tabstrip.ActivateTabAt(1, true); EXPECT_EQ(1, tabstrip.active_index()); tabstrip.DetachTabContentsAt(1); EXPECT_EQ(1, tabstrip.active_index()); @@ -877,7 +877,7 @@ TEST_F(TabStripModelTest, TestSelectOnClose) { // opened by the same opener scanning LTR when it is closed. InsertTabContentses(&tabstrip, contents1, contents2, contents3); EXPECT_EQ(0, tabstrip.active_index()); - tabstrip.SelectTabContentsAt(2, false); + tabstrip.ActivateTabAt(2, false); EXPECT_EQ(2, tabstrip.active_index()); tabstrip.CloseTabContentsAt(2, TabStripModel::CLOSE_NONE); EXPECT_EQ(2, tabstrip.active_index()); @@ -892,7 +892,7 @@ TEST_F(TabStripModelTest, TestSelectOnClose) { EXPECT_EQ(2, tabstrip.count()); TabContentsWrapper* opened_contents = CreateTabContents(); tabstrip.InsertTabContentsAt(2, opened_contents, - TabStripModel::ADD_SELECTED | + TabStripModel::ADD_ACTIVE | TabStripModel::ADD_INHERIT_GROUP); EXPECT_EQ(2, tabstrip.active_index()); tabstrip.CloseTabContentsAt(2, TabStripModel::CLOSE_NONE); @@ -1109,7 +1109,7 @@ TEST_F(TabStripModelTest, TestContextMenuCloseCommands) { EXPECT_EQ(5, tabstrip.count()); int dummy_index = tabstrip.count() - 1; - tabstrip.SelectTabContentsAt(dummy_index, true); + tabstrip.ActivateTabAt(dummy_index, true); EXPECT_EQ(dummy_contents, tabstrip.GetSelectedTabContents()); tabstrip.ExecuteContextMenuCommand(dummy_index, @@ -1180,18 +1180,18 @@ TEST_F(TabStripModelTest, AddTabContents_MiddleClickLinksAndClose) { TabContentsWrapper* homepage_contents = CreateTabContents(); tabstrip.AddTabContents( homepage_contents, -1, PageTransition::AUTO_BOOKMARK, - TabStripModel::ADD_SELECTED); + TabStripModel::ADD_ACTIVE); // Open some other tab, by user typing. TabContentsWrapper* typed_page_contents = CreateTabContents(); tabstrip.AddTabContents( typed_page_contents, -1, PageTransition::TYPED, - TabStripModel::ADD_SELECTED); + TabStripModel::ADD_ACTIVE); EXPECT_EQ(2, tabstrip.count()); // Re-select the home page. - tabstrip.SelectTabContentsAt(0, true); + tabstrip.ActivateTabAt(0, true); // Open a bunch of tabs by simulating middle clicking on links on the home // page. @@ -1222,7 +1222,7 @@ TEST_F(TabStripModelTest, AddTabContents_MiddleClickLinksAndClose) { // TabContents in the group to make sure the cursor wraps around to the first // TabContents in the group before closing the opener or any other // TabContents. - tabstrip.SelectTabContentsAt(2, true); + tabstrip.ActivateTabAt(2, true); tabstrip.CloseSelectedTabs(); EXPECT_EQ(middle_click_contents3, tabstrip.GetSelectedTabContents()); tabstrip.CloseSelectedTabs(); @@ -1249,23 +1249,23 @@ TEST_F(TabStripModelTest, AddTabContents_LeftClickPopup) { TabContentsWrapper* homepage_contents = CreateTabContents(); tabstrip.AddTabContents( homepage_contents, -1, PageTransition::AUTO_BOOKMARK, - TabStripModel::ADD_SELECTED); + TabStripModel::ADD_ACTIVE); // Open some other tab, by user typing. TabContentsWrapper* typed_page_contents = CreateTabContents(); tabstrip.AddTabContents( typed_page_contents, -1, PageTransition::TYPED, - TabStripModel::ADD_SELECTED); + TabStripModel::ADD_ACTIVE); EXPECT_EQ(2, tabstrip.count()); // Re-select the home page. - tabstrip.SelectTabContentsAt(0, true); + tabstrip.ActivateTabAt(0, true); // Open a tab by simulating a left click on a link that opens in a new tab. TabContentsWrapper* left_click_contents = CreateTabContents(); tabstrip.AddTabContents(left_click_contents, -1, PageTransition::LINK, - TabStripModel::ADD_SELECTED); + TabStripModel::ADD_ACTIVE); // Verify the state meets our expectations. EXPECT_EQ(3, tabstrip.count()); @@ -1299,23 +1299,23 @@ TEST_F(TabStripModelTest, AddTabContents_CreateNewBlankTab) { TabContentsWrapper* homepage_contents = CreateTabContents(); tabstrip.AddTabContents( homepage_contents, -1, PageTransition::AUTO_BOOKMARK, - TabStripModel::ADD_SELECTED); + TabStripModel::ADD_ACTIVE); // Open some other tab, by user typing. TabContentsWrapper* typed_page_contents = CreateTabContents(); tabstrip.AddTabContents( typed_page_contents, -1, PageTransition::TYPED, - TabStripModel::ADD_SELECTED); + TabStripModel::ADD_ACTIVE); EXPECT_EQ(2, tabstrip.count()); // Re-select the home page. - tabstrip.SelectTabContentsAt(0, true); + tabstrip.ActivateTabAt(0, true); // Open a new blank tab in the foreground. TabContentsWrapper* new_blank_contents = CreateTabContents(); tabstrip.AddTabContents(new_blank_contents, -1, PageTransition::TYPED, - TabStripModel::ADD_SELECTED); + TabStripModel::ADD_ACTIVE); // Verify the state of the tabstrip. EXPECT_EQ(3, tabstrip.count()); @@ -1354,18 +1354,18 @@ TEST_F(TabStripModelTest, AddTabContents_ForgetOpeners) { TabContentsWrapper* homepage_contents = CreateTabContents(); tabstrip.AddTabContents( homepage_contents, -1, PageTransition::AUTO_BOOKMARK, - TabStripModel::ADD_SELECTED); + TabStripModel::ADD_ACTIVE); // Open some other tab, by user typing. TabContentsWrapper* typed_page_contents = CreateTabContents(); tabstrip.AddTabContents( typed_page_contents, -1, PageTransition::TYPED, - TabStripModel::ADD_SELECTED); + TabStripModel::ADD_ACTIVE); EXPECT_EQ(2, tabstrip.count()); // Re-select the home page. - tabstrip.SelectTabContentsAt(0, true); + tabstrip.ActivateTabAt(0, true); // Open a bunch of tabs by simulating middle clicking on links on the home // page. @@ -1388,7 +1388,7 @@ TEST_F(TabStripModelTest, AddTabContents_ForgetOpeners) { EXPECT_EQ(typed_page_contents, tabstrip.GetSelectedTabContents()); // Step back into the context by selecting a tab inside it. - tabstrip.SelectTabContentsAt(2, true); + tabstrip.ActivateTabAt(2, true); EXPECT_EQ(middle_click_contents2, tabstrip.GetSelectedTabContents()); // Now test that closing tabs selects to the right until there are no more, @@ -1422,7 +1422,7 @@ TEST_F(TabStripModelTest, AppendContentsReselectionTest) { TabContentsWrapper* homepage_contents = CreateTabContents(); tabstrip.AddTabContents( homepage_contents, -1, PageTransition::AUTO_BOOKMARK, - TabStripModel::ADD_SELECTED); + TabStripModel::ADD_ACTIVE); // Open some other tab, by user typing. TabContentsWrapper* typed_page_contents = CreateTabContents(); @@ -1454,7 +1454,7 @@ TEST_F(TabStripModelTest, ReselectionConsidersChildrenTest) { TabContentsWrapper* page_a_contents = CreateTabContents(); strip.AddTabContents( page_a_contents, -1, PageTransition::AUTO_BOOKMARK, - TabStripModel::ADD_SELECTED); + TabStripModel::ADD_ACTIVE); // Simulate middle click to open page A.A and A.B TabContentsWrapper* page_a_a_contents = CreateTabContents(); @@ -1465,7 +1465,7 @@ TEST_F(TabStripModelTest, ReselectionConsidersChildrenTest) { TabStripModel::ADD_NONE); // Select page A.A - strip.SelectTabContentsAt(1, true); + strip.ActivateTabAt(1, true); EXPECT_EQ(page_a_a_contents, strip.GetSelectedTabContents()); // Simulate a middle click to open page A.A.A @@ -1504,7 +1504,7 @@ TEST_F(TabStripModelTest, AddTabContents_NewTabAtEndOfStripInheritsGroup) { // Open page A TabContentsWrapper* page_a_contents = CreateTabContents(); strip.AddTabContents(page_a_contents, -1, PageTransition::START_PAGE, - TabStripModel::ADD_SELECTED); + TabStripModel::ADD_ACTIVE); // Open pages B, C and D in the background from links on page A... TabContentsWrapper* page_b_contents = CreateTabContents(); @@ -1518,12 +1518,12 @@ TEST_F(TabStripModelTest, AddTabContents_NewTabAtEndOfStripInheritsGroup) { TabStripModel::ADD_NONE); // Switch to page B's tab. - strip.SelectTabContentsAt(1, true); + strip.ActivateTabAt(1, true); // Open a New Tab at the end of the strip (simulate Ctrl+T) TabContentsWrapper* new_tab_contents = CreateTabContents(); strip.AddTabContents(new_tab_contents, -1, PageTransition::TYPED, - TabStripModel::ADD_SELECTED); + TabStripModel::ADD_ACTIVE); EXPECT_EQ(4, strip.GetIndexOfTabContents(new_tab_contents)); EXPECT_EQ(4, strip.active_index()); @@ -1539,7 +1539,7 @@ TEST_F(TabStripModelTest, AddTabContents_NewTabAtEndOfStripInheritsGroup) { // behavior should be the same as above. TabContentsWrapper* page_e_contents = CreateTabContents(); strip.AddTabContents(page_e_contents, -1, PageTransition::TYPED, - TabStripModel::ADD_SELECTED); + TabStripModel::ADD_ACTIVE); EXPECT_EQ(4, strip.GetIndexOfTabContents(page_e_contents)); EXPECT_EQ(4, strip.active_index()); @@ -1555,7 +1555,7 @@ TEST_F(TabStripModelTest, AddTabContents_NewTabAtEndOfStripInheritsGroup) { // and the one that was active when the gesture was performed. TabContentsWrapper* page_f_contents = CreateTabContents(); strip.AddTabContents(page_f_contents, -1, PageTransition::AUTO_BOOKMARK, - TabStripModel::ADD_SELECTED); + TabStripModel::ADD_ACTIVE); EXPECT_EQ(4, strip.GetIndexOfTabContents(page_f_contents)); EXPECT_EQ(4, strip.active_index()); @@ -1580,7 +1580,7 @@ TEST_F(TabStripModelTest, NavigationForgetsOpeners) { // Open page A TabContentsWrapper* page_a_contents = CreateTabContents(); strip.AddTabContents(page_a_contents, -1, PageTransition::START_PAGE, - TabStripModel::ADD_SELECTED); + TabStripModel::ADD_ACTIVE); // Open pages B, C and D in the background from links on page A... TabContentsWrapper* page_b_contents = CreateTabContents(); @@ -1599,7 +1599,7 @@ TEST_F(TabStripModelTest, NavigationForgetsOpeners) { TabStripModel::ADD_NONE); // Tell the TabStripModel that we are navigating page D via a link click. - strip.SelectTabContentsAt(3, true); + strip.ActivateTabAt(3, true); strip.TabNavigating(page_d_contents, PageTransition::LINK); // Close page D, page C should be selected. (part of same group). @@ -1629,7 +1629,7 @@ TEST_F(TabStripModelTest, NavigationForgettingDoesntAffectNewTab) { // opened. TabContentsWrapper* page_a_contents = CreateTabContents(); strip.AddTabContents(page_a_contents, -1, PageTransition::START_PAGE, - TabStripModel::ADD_SELECTED); + TabStripModel::ADD_ACTIVE); TabContentsWrapper* page_b_contents = CreateTabContents(); TabContentsWrapper* page_c_contents = CreateTabContents(); @@ -1641,7 +1641,7 @@ TEST_F(TabStripModelTest, NavigationForgettingDoesntAffectNewTab) { strip.AddTabContents(page_d_contents, -1, PageTransition::LINK, TabStripModel::ADD_NONE); - strip.SelectTabContentsAt(2, true); + strip.ActivateTabAt(2, true); // TEST 1: If the user is in a group of tabs and opens a new tab at the end // of the strip, closing that new tab will select the tab that they were @@ -1650,7 +1650,7 @@ TEST_F(TabStripModelTest, NavigationForgettingDoesntAffectNewTab) { // Now simulate opening a new tab at the end of the TabStrip. TabContentsWrapper* new_tab_contents1 = CreateTabContents(); strip.AddTabContents(new_tab_contents1, -1, PageTransition::TYPED, - TabStripModel::ADD_SELECTED); + TabStripModel::ADD_ACTIVE); // At this point, if we close this tab the last selected one should be // re-selected. @@ -1664,13 +1664,13 @@ TEST_F(TabStripModelTest, NavigationForgettingDoesntAffectNewTab) { // Open a new tab again. TabContentsWrapper* new_tab_contents2 = CreateTabContents(); strip.AddTabContents(new_tab_contents2, -1, PageTransition::TYPED, - TabStripModel::ADD_SELECTED); + TabStripModel::ADD_ACTIVE); // Now select the first tab. - strip.SelectTabContentsAt(0, true); + strip.ActivateTabAt(0, true); // Now select the last tab. - strip.SelectTabContentsAt(strip.count() - 1, true); + strip.ActivateTabAt(strip.count() - 1, true); // Now close the last tab. The next adjacent should be selected. strip.CloseTabContentsAt(strip.count() - 1, TabStripModel::CLOSE_NONE); @@ -2040,7 +2040,7 @@ TEST_F(TabStripModelTest, ReplaceSendsSelected) { TabContentsWrapper* first_contents = CreateTabContents(); strip.AddTabContents(first_contents, -1, PageTransition::TYPED, - TabStripModel::ADD_SELECTED); + TabStripModel::ADD_ACTIVE); MockTabStripModelObserver tabstrip_observer; strip.AddObserver(&tabstrip_observer); @@ -2192,7 +2192,7 @@ TEST_F(TabStripModelTest, MultipleToSingle) { strip.AddObserver(&observer); // This changes the selection (0 is no longer selected) but the selected_index // still remains at 1. - strip.SelectTabContentsAt(1, true); + strip.ActivateTabAt(1, true); ASSERT_EQ(1, observer.GetStateCount()); MockTabStripModelObserver::State s( contents2, 1, MockTabStripModelObserver::SELECT); diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc index ffff262..19610885 100644 --- a/chrome/browser/ui/browser.cc +++ b/chrome/browser/ui/browser.cc @@ -637,7 +637,7 @@ TabContents* Browser::OpenApplicationTab(Profile* profile, extensions_service->extension_prefs()->GetLaunchType( extension->id(), ExtensionPrefs::LAUNCH_DEFAULT); UMA_HISTOGRAM_ENUMERATION("Extensions.AppTabLaunchType", launch_type, 100); - int add_type = TabStripModel::ADD_SELECTED; + int add_type = TabStripModel::ADD_ACTIVE; if (launch_type == ExtensionPrefs::LAUNCH_PINNED) add_type |= TabStripModel::ADD_PINNED; @@ -666,8 +666,8 @@ TabContents* Browser::OpenApplicationTab(Profile* profile, model->SetTabPinned(tab_index, true); tab_index = model->GetWrapperIndex(existing_tab); } - if (params.tabstrip_add_types & TabStripModel::ADD_SELECTED) - model->SelectTabContentsAt(tab_index, true); + if (params.tabstrip_add_types & TabStripModel::ADD_ACTIVE) + model->ActivateTabAt(tab_index, true); contents = existing_tab; } else { @@ -987,8 +987,8 @@ TabContents* Browser::GetTabContentsAt(int index) const { return NULL; } -void Browser::SelectTabContentsAt(int index, bool user_gesture) { - tab_handler_->GetTabStripModel()->SelectTabContentsAt(index, user_gesture); +void Browser::ActivateTabAt(int index, bool user_gesture) { + tab_handler_->GetTabStripModel()->ActivateTabAt(index, user_gesture); } bool Browser::IsTabPinned(int index) const { @@ -1022,7 +1022,7 @@ TabContentsWrapper* Browser::AddSelectedTabWithURL(const GURL& url, TabContents* Browser::AddTab(TabContentsWrapper* tab_contents, PageTransition::Type type) { tab_handler_->GetTabStripModel()->AddTabContents( - tab_contents, -1, type, TabStripModel::ADD_SELECTED); + tab_contents, -1, type, TabStripModel::ADD_ACTIVE); return tab_contents->tab_contents(); } @@ -1068,7 +1068,7 @@ TabContents* Browser::AddRestoredTab( new_tab->controller().RestoreFromState(navigations, selected_navigation, from_last_session); - int add_types = select ? TabStripModel::ADD_SELECTED : + int add_types = select ? TabStripModel::ADD_ACTIVE : TabStripModel::ADD_NONE; if (pin) { tab_index = std::min(tab_index, tabstrip_model()->IndexOfFirstNonMiniTab()); @@ -1211,7 +1211,7 @@ TabContents* Browser::GetOrCloneTabForDisposition( current_tab = current_tab->Clone(); tab_handler_->GetTabStripModel()->AddTabContents( current_tab, -1, PageTransition::LINK, - disposition == NEW_FOREGROUND_TAB ? TabStripModel::ADD_SELECTED : + disposition == NEW_FOREGROUND_TAB ? TabStripModel::ADD_ACTIVE : TabStripModel::ADD_NONE); } return current_tab->tab_contents(); @@ -1470,7 +1470,7 @@ void Browser::SelectNumberedTab(int index) { if (index < tab_count()) { UserMetrics::RecordAction(UserMetricsAction("SelectNumberedTab"), profile_); - tab_handler_->GetTabStripModel()->SelectTabContentsAt(index, true); + tab_handler_->GetTabStripModel()->ActivateTabAt(index, true); } } @@ -2562,7 +2562,7 @@ void Browser::DuplicateContentsAt(int index) { int index = tab_handler_->GetTabStripModel()-> GetIndexOfTabContents(contents); pinned = tab_handler_->GetTabStripModel()->IsTabPinned(index); - int add_types = TabStripModel::ADD_SELECTED | + int add_types = TabStripModel::ADD_ACTIVE | TabStripModel::ADD_INHERIT_GROUP | (pinned ? TabStripModel::ADD_PINNED : 0); tab_handler_->GetTabStripModel()->InsertTabContentsAt(index + 1, @@ -2932,7 +2932,7 @@ void Browser::AddNewContents(TabContents* source, } void Browser::ActivateContents(TabContents* contents) { - tab_handler_->GetTabStripModel()->SelectTabContentsAt( + tab_handler_->GetTabStripModel()->ActivateTabAt( tab_handler_->GetTabStripModel()->GetWrapperIndex(contents), false); window_->Activate(); } @@ -4336,7 +4336,7 @@ bool Browser::OpenInstant(WindowOpenDisposition disposition) { preview_contents, -1, instant()->last_transition_type(), - TabStripModel::ADD_SELECTED); + TabStripModel::ADD_ACTIVE); instant()->CompleteRelease(preview_contents->tab_contents()); return true; } @@ -4395,7 +4395,7 @@ void Browser::ViewSource(TabContentsWrapper* contents, // window next to the tab being duplicated. int index = tab_handler_->GetTabStripModel()-> GetIndexOfTabContents(contents); - int add_types = TabStripModel::ADD_SELECTED | + int add_types = TabStripModel::ADD_ACTIVE | TabStripModel::ADD_INHERIT_GROUP; tab_handler_->GetTabStripModel()->InsertTabContentsAt(index + 1, view_source_contents, diff --git a/chrome/browser/ui/browser.h b/chrome/browser/ui/browser.h index dd45710..dbea23e 100644 --- a/chrome/browser/ui/browser.h +++ b/chrome/browser/ui/browser.h @@ -353,7 +353,7 @@ class Browser : public TabHandlerDelegate, // this differs from the TabStripModel because it has far fewer clients. TabContents* GetSelectedTabContents() const; TabContents* GetTabContentsAt(int index) const; - void SelectTabContentsAt(int index, bool user_gesture); + void ActivateTabAt(int index, bool user_gesture); bool IsTabPinned(int index) const; void CloseAllTabs(); diff --git a/chrome/browser/ui/browser_init.cc b/chrome/browser/ui/browser_init.cc index 7f0c1a4..7f94444 100644 --- a/chrome/browser/ui/browser_init.cc +++ b/chrome/browser/ui/browser_init.cc @@ -1004,7 +1004,7 @@ Browser* BrowserInit::LaunchWithProfile::OpenTabsInBrowser( if (!process_startup && !net::URLRequest::IsHandledURL(tabs[i].url)) continue; - int add_types = first_tab ? TabStripModel::ADD_SELECTED : + int add_types = first_tab ? TabStripModel::ADD_ACTIVE : TabStripModel::ADD_NONE; add_types |= TabStripModel::ADD_FORCE_INDEX; if (tabs[i].is_pinned) diff --git a/chrome/browser/ui/browser_navigator.cc b/chrome/browser/ui/browser_navigator.cc index a893e41..cee32a8 100644 --- a/chrome/browser/ui/browser_navigator.cc +++ b/chrome/browser/ui/browser_navigator.cc @@ -235,10 +235,10 @@ void NormalizeDisposition(browser::NavigateParams* params) { switch (params->disposition) { case NEW_BACKGROUND_TAB: - // Disposition trumps add types. ADD_SELECTED is a default, so we need to + // Disposition trumps add types. ADD_ACTIVE is a default, so we need to // remove it if disposition implies the tab is going to open in the // background. - params->tabstrip_add_types &= ~TabStripModel::ADD_SELECTED; + params->tabstrip_add_types &= ~TabStripModel::ADD_ACTIVE; break; case NEW_WINDOW: @@ -250,7 +250,7 @@ void NormalizeDisposition(browser::NavigateParams* params) { // Fall-through. case NEW_FOREGROUND_TAB: case SINGLETON_TAB: - params->tabstrip_add_types |= TabStripModel::ADD_SELECTED; + params->tabstrip_add_types |= TabStripModel::ADD_ACTIVE; break; default: @@ -344,7 +344,7 @@ NavigateParams::NavigateParams( disposition(CURRENT_TAB), transition(a_transition), tabstrip_index(-1), - tabstrip_add_types(TabStripModel::ADD_SELECTED), + tabstrip_add_types(TabStripModel::ADD_ACTIVE), window_action(NO_ACTION), path_behavior(RESPECT), browser(a_browser), @@ -358,7 +358,7 @@ NavigateParams::NavigateParams(Browser* a_browser, disposition(CURRENT_TAB), transition(PageTransition::LINK), tabstrip_index(-1), - tabstrip_add_types(TabStripModel::ADD_SELECTED), + tabstrip_add_types(TabStripModel::ADD_ACTIVE), window_action(NO_ACTION), path_behavior(RESPECT), browser(a_browser), @@ -435,7 +435,7 @@ void Navigate(NavigateParams* params) { // failures in startup tests. // By default, content believes it is not hidden. When adding contents // in the background, tell it that it's hidden. - if ((params->tabstrip_add_types & TabStripModel::ADD_SELECTED) == 0) { + if ((params->tabstrip_add_types & TabStripModel::ADD_ACTIVE) == 0) { // TabStripModel::AddTabContents invokes HideContents if not foreground. params->target_contents->tab_contents()->WasHidden(); } @@ -494,7 +494,7 @@ void Navigate(NavigateParams* params) { // If the singleton tab isn't already selected, select it. if (params->source_contents != params->target_contents) - params->browser->SelectTabContentsAt(singleton_index, user_initiated); + params->browser->ActivateTabAt(singleton_index, user_initiated); } } diff --git a/chrome/browser/ui/browser_navigator.h b/chrome/browser/ui/browser_navigator.h index 3ab9bca..d93930d 100644 --- a/chrome/browser/ui/browser_navigator.h +++ b/chrome/browser/ui/browser_navigator.h @@ -83,10 +83,10 @@ struct NavigateParams { // CURRENT_TAB " " " NEW_FOREGROUND_TAB // OFF_THE_RECORD target browser profile is incog. NEW_FOREGROUND_TAB // - // If disposition is NEW_BACKGROUND_TAB, TabStripModel::ADD_SELECTED is + // If disposition is NEW_BACKGROUND_TAB, TabStripModel::ADD_ACTIVE is // removed from |tabstrip_add_types| automatically. // If disposition is one of NEW_WINDOW, NEW_POPUP, NEW_FOREGROUND_TAB or - // SINGLETON_TAB, then TabStripModel::ADD_SELECTED is automatically added to + // SINGLETON_TAB, then TabStripModel::ADD_ACTIVE is automatically added to // |tabstrip_add_types|. WindowOpenDisposition disposition; @@ -102,7 +102,7 @@ struct NavigateParams { // A bitmask of values defined in TabStripModel::AddTabTypes. Helps // determine where to insert a new tab and whether or not it should be - // selected, among other properties. Default is ADD_SELECTED. + // selected, among other properties. Default is ADD_ACTIVE. int tabstrip_add_types; // If non-empty, the new tab is an app tab. diff --git a/chrome/browser/ui/cocoa/applescript/window_applescript.mm b/chrome/browser/ui/cocoa/applescript/window_applescript.mm index 465e2f7..491cc8d 100644 --- a/chrome/browser/ui/cocoa/applescript/window_applescript.mm +++ b/chrome/browser/ui/cocoa/applescript/window_applescript.mm @@ -116,7 +116,7 @@ // Note: applescript is 1-based, that is lists begin with index 1. int atIndex = [anActiveTabIndex intValue] - 1; if (atIndex >= 0 && atIndex < browser_->tab_count()) - browser_->SelectTabContentsAt(atIndex, true); + browser_->ActivateTabAt(atIndex, true); else AppleScript::SetError(AppleScript::errInvalidTabIndex); } diff --git a/chrome/browser/ui/cocoa/tabpose_window.mm b/chrome/browser/ui/cocoa/tabpose_window.mm index d821c76..4a0d7fd 100644 --- a/chrome/browser/ui/cocoa/tabpose_window.mm +++ b/chrome/browser/ui/cocoa/tabpose_window.mm @@ -1446,8 +1446,8 @@ void AnimateCALayerOpacityFromTo( // Select chosen tab. if (tileSet_->selected_index() < tabStripModel_->count()) { - tabStripModel_->SelectTabContentsAt(tileSet_->selected_index(), - /*user_gesture=*/true); + tabStripModel_->ActivateTabAt(tileSet_->selected_index(), + /*user_gesture=*/true); } else { DCHECK_EQ(tileSet_->selected_index(), 0); } diff --git a/chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm b/chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm index e8d6442..32c97df 100644 --- a/chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm +++ b/chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm @@ -698,7 +698,7 @@ class NotificationBridge : public NotificationObserver { DCHECK([sender isKindOfClass:[NSView class]]); int index = [self modelIndexForTabView:sender]; if (tabStripModel_->ContainsIndex(index)) - tabStripModel_->SelectTabContentsAt(index, true); + tabStripModel_->ActivateTabAt(index, true); } // Called when the user closes a tab. Asks the model to close the tab. |sender| @@ -1606,7 +1606,7 @@ class NotificationBridge : public NotificationObserver { // inherit the current tab's group. tabStripModel_->InsertTabContentsAt( modelIndex, contents, - TabStripModel::ADD_SELECTED | (pinned ? TabStripModel::ADD_PINNED : 0)); + TabStripModel::ADD_ACTIVE | (pinned ? TabStripModel::ADD_PINNED : 0)); } // Called when the tab strip view changes size. As we only registered for @@ -1852,7 +1852,7 @@ class NotificationBridge : public NotificationObserver { params.disposition = disposition; params.tabstrip_index = index; params.tabstrip_add_types = - TabStripModel::ADD_SELECTED | TabStripModel::ADD_FORCE_INDEX; + TabStripModel::ADD_ACTIVE | TabStripModel::ADD_FORCE_INDEX; browser::Navigate(¶ms); break; } @@ -1862,7 +1862,7 @@ class NotificationBridge : public NotificationObserver { tabStripModel_->GetTabContentsAt(index) ->tab_contents()->OpenURL(*url, GURL(), CURRENT_TAB, PageTransition::TYPED); - tabStripModel_->SelectTabContentsAt(index, true); + tabStripModel_->ActivateTabAt(index, true); break; default: NOTIMPLEMENTED(); @@ -1995,7 +1995,7 @@ class NotificationBridge : public NotificationObserver { NSInteger index = [self modelIndexForContentsView:view]; DCHECK(index >= 0); if (index >= 0) - tabStripModel_->SelectTabContentsAt(index, false /* not a user gesture */); + tabStripModel_->ActivateTabAt(index, false /* not a user gesture */); } - (void)attachConstrainedWindow:(ConstrainedWindowMac*)window { diff --git a/chrome/browser/ui/find_bar/find_bar_host_browsertest.cc b/chrome/browser/ui/find_bar/find_bar_host_browsertest.cc index 91d3a3ff..a34b0c5 100644 --- a/chrome/browser/ui/find_bar/find_bar_host_browsertest.cc +++ b/chrome/browser/ui/find_bar/find_bar_host_browsertest.cc @@ -843,7 +843,7 @@ IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, PreferPreviousSearch) { params.disposition = NEW_BACKGROUND_TAB; params.tabstrip_add_types = TabStripModel::ADD_NONE; browser::Navigate(¶ms); - browser()->SelectTabContentsAt(1, false); + browser()->ActivateTabAt(1, false); TabContentsWrapper* tab2 = browser()->GetSelectedTabContentsWrapper(); EXPECT_NE(tab1, tab2); @@ -851,7 +851,7 @@ IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, PreferPreviousSearch) { FindInPageWchar(tab2, L"given", kFwd, kIgnoreCase, &ordinal); // Switch back to first tab. - browser()->SelectTabContentsAt(0, false); + browser()->ActivateTabAt(0, false); browser()->GetFindBarController()->EndFindSession( FindBarController::kKeepSelection); // Simulate F3. @@ -967,7 +967,7 @@ IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, PrepopulatePreserveLast) { params.disposition = NEW_BACKGROUND_TAB; params.tabstrip_add_types = TabStripModel::ADD_NONE; browser::Navigate(¶ms); - browser()->SelectTabContentsAt(1, false); + browser()->ActivateTabAt(1, false); TabContentsWrapper* tab2 = browser()->GetSelectedTabContentsWrapper(); EXPECT_NE(tab1, tab2); @@ -976,7 +976,7 @@ IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, PrepopulatePreserveLast) { // Go back to the first tab and make sure we have NOT switched the prepopulate // text to "text". - browser()->SelectTabContentsAt(0, false); + browser()->ActivateTabAt(0, false); // Open the Find box. EnsureFindBoxOpen(); diff --git a/chrome/browser/ui/gtk/bookmarks/bookmark_bar_gtk_interactive_uitest.cc b/chrome/browser/ui/gtk/bookmarks/bookmark_bar_gtk_interactive_uitest.cc index 870cc11..d62d495 100644 --- a/chrome/browser/ui/gtk/bookmarks/bookmark_bar_gtk_interactive_uitest.cc +++ b/chrome/browser/ui/gtk/bookmarks/bookmark_bar_gtk_interactive_uitest.cc @@ -39,7 +39,7 @@ IN_PROC_BROWSER_TEST_F(BookmarkBarGtkInteractiveUITest, FindBarTest) { browser()->AddSelectedTabWithURL(url, PageTransition::TYPED); // Switch back to the NTP with the active findbar. - browser()->SelectTabContentsAt(1, false); + browser()->ActivateTabAt(1, false); // Wait for the findbar to show. MessageLoop::current()->RunAllPending(); diff --git a/chrome/browser/ui/gtk/tabs/dragged_tab_controller_gtk.cc b/chrome/browser/ui/gtk/tabs/dragged_tab_controller_gtk.cc index e3e40cf..051177d 100644 --- a/chrome/browser/ui/gtk/tabs/dragged_tab_controller_gtk.cc +++ b/chrome/browser/ui/gtk/tabs/dragged_tab_controller_gtk.cc @@ -393,7 +393,7 @@ void DraggedTabControllerGtk::Attach(TabStripGtk* attached_tabstrip, int index = GetInsertionIndexForDraggedBounds(bounds, false); attached_tabstrip_->model()->InsertTabContentsAt( index, dragged_contents_, - TabStripModel::ADD_SELECTED | + TabStripModel::ADD_ACTIVE | (pinned_ ? TabStripModel::ADD_PINNED : 0)); tab = GetTabMatchingDraggedContents(attached_tabstrip_); @@ -624,7 +624,7 @@ void DraggedTabControllerGtk::RevertDrag() { attached_tabstrip_ = source_tabstrip_; source_tabstrip_->model()->InsertTabContentsAt( source_model_index_, dragged_contents_, - TabStripModel::ADD_SELECTED | + TabStripModel::ADD_ACTIVE | (pinned_ ? TabStripModel::ADD_PINNED : 0)); } else { // The tab was moved within the tabstrip where the drag was initiated. @@ -641,7 +641,7 @@ void DraggedTabControllerGtk::RevertDrag() { // source tabstrip. source_tabstrip_->model()->InsertTabContentsAt( source_model_index_, dragged_contents_, - TabStripModel::ADD_SELECTED | + TabStripModel::ADD_ACTIVE | (pinned_ ? TabStripModel::ADD_PINNED : 0)); } diff --git a/chrome/browser/ui/gtk/tabs/tab_strip_gtk.cc b/chrome/browser/ui/gtk/tabs/tab_strip_gtk.cc index be5406b..d5241cd 100644 --- a/chrome/browser/ui/gtk/tabs/tab_strip_gtk.cc +++ b/chrome/browser/ui/gtk/tabs/tab_strip_gtk.cc @@ -1121,7 +1121,7 @@ bool TabStripGtk::IsTabPinned(const TabGtk* tab) const { void TabStripGtk::SelectTab(TabGtk* tab) { int index = GetIndexOfTab(tab); if (model_->ContainsIndex(index)) - model_->SelectTabContentsAt(index, true); + model_->ActivateTabAt(index, true); } void TabStripGtk::CloseTab(TabGtk* tab) { diff --git a/chrome/browser/ui/views/find_bar_host_interactive_uitest.cc b/chrome/browser/ui/views/find_bar_host_interactive_uitest.cc index e030d8c..8b6ea35 100644 --- a/chrome/browser/ui/views/find_bar_host_interactive_uitest.cc +++ b/chrome/browser/ui/views/find_bar_host_interactive_uitest.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. @@ -58,7 +58,7 @@ IN_PROC_BROWSER_TEST_F(FindInPageTest, CrashEscHandlers) { VIEW_ID_FIND_IN_PAGE_TEXT_FIELD)); // Select tab A. - browser()->SelectTabContentsAt(0, true); + browser()->ActivateTabAt(0, true); // Close tab B. browser()->CloseTabContents(browser()->GetTabContentsAt(1)); @@ -158,13 +158,13 @@ IN_PROC_BROWSER_TEST_F(FindInPageTest, FocusRestoreOnTabSwitch) { EXPECT_TRUE(ui_test_utils::IsViewFocused(browser(), VIEW_ID_LOCATION_BAR)); // Select tab A. Find bar should get focus. - browser()->SelectTabContentsAt(0, true); + browser()->ActivateTabAt(0, true); EXPECT_TRUE(ui_test_utils::IsViewFocused(browser(), VIEW_ID_FIND_IN_PAGE_TEXT_FIELD)); EXPECT_TRUE(ASCIIToUTF16("a") == find_bar->GetFindSelectedText()); // Select tab B. Location bar should get focus. - browser()->SelectTabContentsAt(1, true); + browser()->ActivateTabAt(1, true); EXPECT_TRUE(ui_test_utils::IsViewFocused(browser(), VIEW_ID_LOCATION_BAR)); } 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 650fc3b..6c4542e 100644 --- a/chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc +++ b/chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc @@ -215,7 +215,7 @@ bool BrowserTabStripController::IsNewTabPage(int model_index) const { } void BrowserTabStripController::SelectTab(int model_index) { - model_->SelectTabContentsAt(model_index, true); + model_->ActivateTabAt(model_index, true); } void BrowserTabStripController::ExtendSelectionTo(int model_index) { @@ -274,14 +274,14 @@ void BrowserTabStripController::PerformDrop(bool drop_before, TabContentsWrapper* contents = model_->delegate()->CreateTabContentsForURL( url, GURL(), model_->profile(), PageTransition::TYPED, false, NULL); model_->AddTabContents(contents, index, PageTransition::GENERATED, - TabStripModel::ADD_SELECTED); + TabStripModel::ADD_ACTIVE); } else { UserMetrics::RecordAction(UserMetricsAction("Tab_DropURLOnTab"), model_->profile()); model_->GetTabContentsAt(index)->controller().LoadURL( url, GURL(), PageTransition::GENERATED); - model_->SelectTabContentsAt(index, true); + model_->ActivateTabAt(index, true); } } diff --git a/chrome/browser/ui/webui/bug_report_ui.cc b/chrome/browser/ui/webui/bug_report_ui.cc index 53ab28c..0aae439 100644 --- a/chrome/browser/ui/webui/bug_report_ui.cc +++ b/chrome/browser/ui/webui/bug_report_ui.cc @@ -150,7 +150,7 @@ void ShowHtmlBugReportView(Browser* browser) { int feedback_tab_index = GetIndexOfFeedbackTab(browser); if (feedback_tab_index >=0) { // Do not refresh screenshot, do not create a new tab - browser->SelectTabContentsAt(feedback_tab_index, true); + browser->ActivateTabAt(feedback_tab_index, true); return; } |