summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/automation/testing_automation_provider.cc4
-rw-r--r--chrome/browser/browser_commands_unittest.cc59
-rw-r--r--chrome/browser/download/download_browsertest.cc51
-rw-r--r--chrome/browser/extensions/api/extension_action/browser_action_apitest.cc8
-rw-r--r--chrome/browser/notifications/notification_browsertest.cc38
-rw-r--r--chrome/browser/renderer_host/web_cache_manager_browsertest.cc14
-rw-r--r--chrome/browser/safe_browsing/safe_browsing_blocking_page_test.cc56
-rw-r--r--chrome/browser/sessions/session_restore.cc4
-rw-r--r--chrome/browser/ui/browser_command_controller_browsertest.cc8
-rw-r--r--chrome/browser/ui/browser_commands.cc2
-rw-r--r--chrome/browser/ui/browser_focus_uitest.cc16
-rw-r--r--chrome/browser/ui/browser_navigator.cc6
-rw-r--r--chrome/browser/ui/browser_tabstrip.cc4
-rw-r--r--chrome/browser/ui/browser_tabstrip.h2
-rw-r--r--chrome/browser/ui/cocoa/applescript/window_applescript.mm15
-rw-r--r--chrome/browser/ui/find_bar/find_bar_host_browsertest.cc124
-rw-r--r--chrome/browser/ui/fullscreen/fullscreen_controller_browsertest.cc7
-rw-r--r--chrome/browser/ui/gtk/bookmarks/bookmark_bar_gtk_interactive_uitest.cc2
-rw-r--r--chrome/browser/ui/intents/web_intent_picker_controller.cc2
-rw-r--r--chrome/browser/ui/omnibox/omnibox_view_browsertest.cc3
-rw-r--r--chrome/browser/ui/search/search_delegate_unittest.cc11
-rw-r--r--chrome/browser/ui/startup/startup_browser_creator_impl.cc2
-rw-r--r--chrome/browser/ui/views/find_bar_host_interactive_uitest.cc6
-rw-r--r--chrome/browser/ui/webui/bookmarks_ui_browsertest.cc26
-rw-r--r--chrome/browser/ui/webui/feedback_ui.cc13
-rw-r--r--chrome/browser/ui/webui/ntp/new_tab_ui_browsertest.cc22
-rw-r--r--chrome/test/ppapi/ppapi_browsertest.cc10
27 files changed, 290 insertions, 225 deletions
diff --git a/chrome/browser/automation/testing_automation_provider.cc b/chrome/browser/automation/testing_automation_provider.cc
index 2a048d2..2bf5542 100644
--- a/chrome/browser/automation/testing_automation_provider.cc
+++ b/chrome/browser/automation/testing_automation_provider.cc
@@ -455,8 +455,8 @@ void TestingAutomationProvider::ActivateTab(int handle,
*status = -1;
if (browser_tracker_->ContainsHandle(handle) && at_index > -1) {
Browser* browser = browser_tracker_->GetResource(handle);
- if (at_index >= 0 && at_index < browser->tab_count()) {
- chrome::ActivateTabAt(browser, at_index, true);
+ if (at_index >= 0 && at_index < browser->tab_strip_model()->count()) {
+ browser->tab_strip_model()->ActivateTabAt(at_index, true);
*status = 0;
}
}
diff --git a/chrome/browser/browser_commands_unittest.cc b/chrome/browser/browser_commands_unittest.cc
index 862254c..2f3f716 100644
--- a/chrome/browser/browser_commands_unittest.cc
+++ b/chrome/browser/browser_commands_unittest.cc
@@ -8,7 +8,7 @@
#include "chrome/browser/ui/browser_command_controller.h"
#include "chrome/browser/ui/browser_commands.h"
#include "chrome/browser/ui/browser_list.h"
-#include "chrome/browser/ui/browser_tabstrip.h"
+#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/common/url_constants.h"
#include "chrome/test/base/browser_with_test_window_test.h"
#include "chrome/test/base/testing_profile.h"
@@ -38,25 +38,25 @@ TEST_F(BrowserCommandsTest, TabNavigationAccelerators) {
AddTab(browser(), about_blank);
// Select the second tab.
- chrome::ActivateTabAt(browser(), 1, false);
+ browser()->tab_strip_model()->ActivateTabAt(1, false);
CommandUpdater* updater = browser()->command_controller()->command_updater();
// Navigate to the first tab using an accelerator.
updater->ExecuteCommand(IDC_SELECT_TAB_0);
- ASSERT_EQ(0, browser()->active_index());
+ ASSERT_EQ(0, browser()->tab_strip_model()->active_index());
// Navigate to the second tab using the next accelerators.
updater->ExecuteCommand(IDC_SELECT_NEXT_TAB);
- ASSERT_EQ(1, browser()->active_index());
+ ASSERT_EQ(1, browser()->tab_strip_model()->active_index());
// Navigate back to the first tab using the previous accelerators.
updater->ExecuteCommand(IDC_SELECT_PREVIOUS_TAB);
- ASSERT_EQ(0, browser()->active_index());
+ ASSERT_EQ(0, browser()->tab_strip_model()->active_index());
// Navigate to the last tab using the select last accelerator.
updater->ExecuteCommand(IDC_SELECT_LAST_TAB);
- ASSERT_EQ(2, browser()->active_index());
+ ASSERT_EQ(2, browser()->tab_strip_model()->active_index());
}
// Tests IDC_DUPLICATE_TAB.
@@ -71,7 +71,7 @@ TEST_F(BrowserCommandsTest, DuplicateTab) {
NavigateAndCommitActiveTab(url2);
NavigateAndCommitActiveTab(url3);
content::NavigationController& orig_controller =
- chrome::GetWebContentsAt(browser(), 0)->GetController();
+ browser()->tab_strip_model()->GetWebContentsAt(0)->GetController();
orig_controller.LoadURL(
url4, content::Referrer(), content::PAGE_TRANSITION_LINK, std::string());
EXPECT_EQ(3, orig_controller.GetEntryCount());
@@ -87,11 +87,11 @@ TEST_F(BrowserCommandsTest, DuplicateTab) {
ASSERT_EQ(initial_window_count, window_count);
// And we should have a newly duplicated tab.
- ASSERT_EQ(2, browser()->tab_count());
+ ASSERT_EQ(2, browser()->tab_strip_model()->count());
// Verify the stack of urls.
content::NavigationController& controller =
- chrome::GetWebContentsAt(browser(), 1)->GetController();
+ browser()->tab_strip_model()->GetWebContentsAt(1)->GetController();
EXPECT_EQ(3, controller.GetEntryCount());
EXPECT_EQ(2, controller.GetCurrentEntryIndex());
EXPECT_EQ(url1, controller.GetEntryAtIndex(0)->GetURL());
@@ -108,7 +108,7 @@ TEST_F(BrowserCommandsTest, ViewSource) {
// Navigate to a URL, plus a pending URL that hasn't committed.
AddTab(browser(), url1);
content::NavigationController& orig_controller =
- chrome::GetWebContentsAt(browser(), 0)->GetController();
+ browser()->tab_strip_model()->GetWebContentsAt(0)->GetController();
orig_controller.LoadURL(
url2, content::Referrer(), content::PAGE_TRANSITION_LINK, std::string());
EXPECT_EQ(1, orig_controller.GetEntryCount());
@@ -124,12 +124,12 @@ TEST_F(BrowserCommandsTest, ViewSource) {
ASSERT_EQ(initial_window_count, window_count);
// And we should have a newly duplicated tab.
- ASSERT_EQ(2, browser()->tab_count());
+ ASSERT_EQ(2, browser()->tab_strip_model()->count());
// Verify we are viewing the source of the last committed entry.
GURL view_source_url("view-source:http://foo/1");
content::NavigationController& controller =
- chrome::GetWebContentsAt(browser(), 1)->GetController();
+ browser()->tab_strip_model()->GetWebContentsAt(1)->GetController();
EXPECT_EQ(1, controller.GetEntryCount());
EXPECT_EQ(0, controller.GetCurrentEntryIndex());
EXPECT_EQ(url1, controller.GetEntryAtIndex(0)->GetURL());
@@ -167,58 +167,61 @@ TEST_F(BrowserCommandsTest, BackForwardInNewTab) {
// Go back in a new background tab.
chrome::GoBack(browser(), NEW_BACKGROUND_TAB);
- EXPECT_EQ(0, browser()->active_index());
- ASSERT_EQ(2, browser()->tab_count());
+ EXPECT_EQ(0, browser()->tab_strip_model()->active_index());
+ ASSERT_EQ(2, browser()->tab_strip_model()->count());
// The original tab should be unchanged.
- WebContents* zeroth = chrome::GetWebContentsAt(browser(), 0);
+ WebContents* zeroth = browser()->tab_strip_model()->GetWebContentsAt(0);
EXPECT_EQ(url2, zeroth->GetURL());
EXPECT_TRUE(zeroth->GetController().CanGoBack());
EXPECT_FALSE(zeroth->GetController().CanGoForward());
// The new tab should be like the first one but navigated back.
- WebContents* first = chrome::GetWebContentsAt(browser(), 1);
- EXPECT_EQ(url1, chrome::GetWebContentsAt(browser(), 1)->GetURL());
+ WebContents* first = browser()->tab_strip_model()->GetWebContentsAt(1);
+ EXPECT_EQ(url1, browser()->tab_strip_model()->GetWebContentsAt(1)->GetURL());
EXPECT_FALSE(first->GetController().CanGoBack());
EXPECT_TRUE(first->GetController().CanGoForward());
// Select the second tab and make it go forward in a new background tab.
- chrome::ActivateTabAt(browser(), 1, true);
+ browser()->tab_strip_model()->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
// (to test both codepaths).
CommitPendingLoad(&first->GetController());
- EXPECT_EQ(1, browser()->active_index());
+ EXPECT_EQ(1, browser()->tab_strip_model()->active_index());
chrome::GoForward(browser(), NEW_BACKGROUND_TAB);
// The previous tab should be unchanged and still in the foreground.
EXPECT_EQ(url1, first->GetURL());
EXPECT_FALSE(first->GetController().CanGoBack());
EXPECT_TRUE(first->GetController().CanGoForward());
- EXPECT_EQ(1, browser()->active_index());
+ EXPECT_EQ(1, browser()->tab_strip_model()->active_index());
// There should be a new tab navigated forward.
- ASSERT_EQ(3, browser()->tab_count());
- WebContents* second = chrome::GetWebContentsAt(browser(), 2);
+ ASSERT_EQ(3, browser()->tab_strip_model()->count());
+ WebContents* second = browser()->tab_strip_model()->GetWebContentsAt(2);
EXPECT_EQ(url2, second->GetURL());
EXPECT_TRUE(second->GetController().CanGoBack());
EXPECT_FALSE(second->GetController().CanGoForward());
// Now do back in a new foreground tab. Don't bother re-checking every sngle
// thing above, just validate that it's opening properly.
- chrome::ActivateTabAt(browser(), 2, true);
+ browser()->tab_strip_model()->ActivateTabAt(2, true);
// TODO(brettw) bug 11055: see the comment above about why we need this.
CommitPendingLoad(&second->GetController());
chrome::GoBack(browser(), NEW_FOREGROUND_TAB);
- ASSERT_EQ(3, browser()->active_index());
- ASSERT_EQ(url1, chrome::GetActiveWebContents(browser())->GetURL());
+ ASSERT_EQ(3, browser()->tab_strip_model()->active_index());
+ ASSERT_EQ(url1,
+ browser()->tab_strip_model()->GetActiveWebContents()->GetURL());
// Same thing again for forward.
// TODO(brettw) bug 11055: see the comment above about why we need this.
- CommitPendingLoad(&chrome::GetActiveWebContents(browser())->GetController());
+ CommitPendingLoad(&
+ browser()->tab_strip_model()->GetActiveWebContents()->GetController());
chrome::GoForward(browser(), NEW_FOREGROUND_TAB);
- ASSERT_EQ(4, browser()->active_index());
- ASSERT_EQ(url2, chrome::GetActiveWebContents(browser())->GetURL());
+ ASSERT_EQ(4, browser()->tab_strip_model()->active_index());
+ ASSERT_EQ(url2,
+ browser()->tab_strip_model()->GetActiveWebContents()->GetURL());
}
diff --git a/chrome/browser/download/download_browsertest.cc b/chrome/browser/download/download_browsertest.cc
index 7a5cea4..0e906c2 100644
--- a/chrome/browser/download/download_browsertest.cc
+++ b/chrome/browser/download/download_browsertest.cc
@@ -45,6 +45,7 @@
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/chrome_pages.h"
#include "chrome/browser/ui/host_desktop.h"
+#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/extensions/feature_switch.h"
@@ -284,7 +285,7 @@ class DownloadTest : public InProcessBrowserTest {
// Sanity check default values for window / tab count and shelf visibility.
int window_count = BrowserList::size();
EXPECT_EQ(1, window_count);
- EXPECT_EQ(1, browser()->tab_count());
+ EXPECT_EQ(1, browser()->tab_strip_model()->count());
EXPECT_FALSE(browser()->window()->IsDownloadShelfVisible());
// Set up the temporary download folder.
@@ -849,7 +850,7 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, DownloadMimeType) {
DownloadAndWait(browser(), url);
// Check state.
- EXPECT_EQ(1, browser()->tab_count());
+ EXPECT_EQ(1, browser()->tab_strip_model()->count());
CheckDownload(browser(), file, file);
EXPECT_TRUE(browser()->window()->IsDownloadShelfVisible());
}
@@ -866,7 +867,7 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, CheckInternetZone) {
// Check state. Special file state must be checked before CheckDownload,
// as CheckDownload will delete the output file.
- EXPECT_EQ(1, browser()->tab_count());
+ EXPECT_EQ(1, browser()->tab_strip_model()->count());
FilePath downloaded_file(DestinationFile(browser(), file));
if (file_util::VolumeSupportsADS(downloaded_file))
EXPECT_TRUE(file_util::HasInternetZoneIdentifier(downloaded_file));
@@ -902,7 +903,7 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, DownloadMimeTypeSelect) {
EXPECT_TRUE(DidShowFileChooser());
// Check state.
- EXPECT_EQ(1, browser()->tab_count());
+ EXPECT_EQ(1, browser()->tab_strip_model()->count());
CheckDownload(browser(), file, file);
EXPECT_TRUE(browser()->window()->IsDownloadShelfVisible());
}
@@ -921,7 +922,7 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, NoDownload) {
EXPECT_FALSE(file_util::PathExists(file_path));
// Check state.
- EXPECT_EQ(1, browser()->tab_count());
+ EXPECT_EQ(1, browser()->tab_strip_model()->count());
EXPECT_FALSE(browser()->window()->IsDownloadShelfVisible());
}
@@ -957,7 +958,7 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, MimeTypesToShowNotDownload) {
ui_test_utils::NavigateToURL(browser(), url);
// Check state.
- EXPECT_EQ(1, browser()->tab_count());
+ EXPECT_EQ(1, browser()->tab_strip_model()->count());
EXPECT_FALSE(browser()->window()->IsDownloadShelfVisible());
}
}
@@ -1011,7 +1012,7 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, DownloadResourceThrottleCancels) {
EXPECT_FALSE(file_util::PathExists(file_path));
// Check state.
- EXPECT_EQ(1, browser()->tab_count());
+ EXPECT_EQ(1, browser()->tab_strip_model()->count());
EXPECT_FALSE(browser()->window()->IsDownloadShelfVisible());
// Verify that there's no pending download. The resource throttle
@@ -1036,7 +1037,7 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, ContentDisposition) {
CheckDownload(browser(), download_file, file);
// Check state.
- EXPECT_EQ(1, browser()->tab_count());
+ EXPECT_EQ(1, browser()->tab_strip_model()->count());
EXPECT_TRUE(browser()->window()->IsDownloadShelfVisible());
}
@@ -1054,14 +1055,14 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, PerWindowShelf) {
CheckDownload(browser(), download_file, file);
// Check state.
- EXPECT_EQ(1, browser()->tab_count());
+ EXPECT_EQ(1, browser()->tab_strip_model()->count());
EXPECT_TRUE(browser()->window()->IsDownloadShelfVisible());
// Open a second tab and wait.
EXPECT_NE(static_cast<WebContents*>(NULL),
chrome::AddSelectedTabWithURL(browser(), GURL(),
content::PAGE_TRANSITION_TYPED));
- EXPECT_EQ(2, browser()->tab_count());
+ EXPECT_EQ(2, browser()->tab_strip_model()->count());
EXPECT_TRUE(browser()->window()->IsDownloadShelfVisible());
// Hide the download shelf.
@@ -1069,8 +1070,8 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, PerWindowShelf) {
EXPECT_FALSE(browser()->window()->IsDownloadShelfVisible());
// Go to the first tab.
- chrome::ActivateTabAt(browser(), 0, true);
- EXPECT_EQ(2, browser()->tab_count());
+ browser()->tab_strip_model()->ActivateTabAt(0, true);
+ EXPECT_EQ(2, browser()->tab_strip_model()->count());
// The download shelf should not be visible.
EXPECT_FALSE(browser()->window()->IsDownloadShelfVisible());
@@ -1086,7 +1087,7 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, CloseShelfOnDownloadsTab) {
DownloadAndWait(browser(), url);
// Check state.
- EXPECT_EQ(1, browser()->tab_count());
+ EXPECT_EQ(1, browser()->tab_strip_model()->count());
EXPECT_TRUE(browser()->window()->IsDownloadShelfVisible());
// Open the downloads tab.
@@ -1180,7 +1181,7 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, DontCloseNewTab1) {
ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION);
// We should have two tabs now.
- EXPECT_EQ(2, browser()->tab_count());
+ EXPECT_EQ(2, browser()->tab_strip_model()->count());
EXPECT_FALSE(browser()->window()->IsDownloadShelfVisible());
}
@@ -1199,7 +1200,7 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, CloseNewTab1) {
// When the download finishes, we should still have one tab.
EXPECT_TRUE(browser()->window()->IsDownloadShelfVisible());
- EXPECT_EQ(1, browser()->tab_count());
+ EXPECT_EQ(1, browser()->tab_strip_model()->count());
CheckDownload(browser(), file, file);
}
@@ -1229,7 +1230,7 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, DontCloseNewTab2) {
// When the download finishes, we should have two tabs.
EXPECT_TRUE(browser()->window()->IsDownloadShelfVisible());
- EXPECT_EQ(2, browser()->tab_count());
+ EXPECT_EQ(2, browser()->tab_strip_model()->count());
CheckDownload(browser(), file, file);
}
@@ -1257,7 +1258,7 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, DontCloseNewTab3) {
CURRENT_TAB,
ui_test_utils::BROWSER_TEST_WAIT_FOR_TAB);
- EXPECT_EQ(2, browser()->tab_count());
+ EXPECT_EQ(2, browser()->tab_strip_model()->count());
// Download a file and wait.
FilePath file(FILE_PATH_LITERAL("download-test1.lib"));
@@ -1269,7 +1270,7 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, DontCloseNewTab3) {
// When the download finishes, we should have two tabs.
EXPECT_TRUE(browser()->window()->IsDownloadShelfVisible());
- EXPECT_EQ(2, browser()->tab_count());
+ EXPECT_EQ(2, browser()->tab_strip_model()->count());
CheckDownload(browser(), file, file);
}
@@ -1300,7 +1301,7 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, CloseNewTab2) {
// When the download finishes, we should still have one tab.
EXPECT_TRUE(browser()->window()->IsDownloadShelfVisible());
- EXPECT_EQ(1, browser()->tab_count());
+ EXPECT_EQ(1, browser()->tab_strip_model()->count());
CheckDownload(browser(), file, file);
}
@@ -1333,7 +1334,7 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, CloseNewTab3) {
// When the download finishes, we should still have one tab.
EXPECT_TRUE(browser()->window()->IsDownloadShelfVisible());
- EXPECT_EQ(1, browser()->tab_count());
+ EXPECT_EQ(1, browser()->tab_strip_model()->count());
CheckDownload(browser(), file, file);
}
@@ -1362,7 +1363,7 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, NewWindow) {
// When the download finishes, the download shelf SHOULD NOT be visible in
// the first window.
ExpectWindowCountAfterDownload(2);
- EXPECT_EQ(1, browser()->tab_count());
+ EXPECT_EQ(1, browser()->tab_strip_model()->count());
// Download shelf should close. Download panel stays open on ChromeOS.
EXPECT_FALSE(browser()->window()->IsDownloadShelfVisible());
@@ -1394,7 +1395,7 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, NewWindow) {
ExpectWindowCountAfterDownload(1);
#endif
- EXPECT_EQ(1, browser()->tab_count());
+ EXPECT_EQ(1, browser()->tab_strip_model()->count());
// Download shelf should close. Download panel stays open on ChromeOS.
EXPECT_FALSE(browser()->window()->IsDownloadShelfVisible());
@@ -1506,7 +1507,7 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, AutoOpen) {
EXPECT_TRUE(downloads[0]->GetOpened()); // Confirm it anyway.
// As long as we're here, confirmed everything else is good.
- EXPECT_EQ(1, browser()->tab_count());
+ EXPECT_EQ(1, browser()->tab_strip_model()->count());
CheckDownload(browser(), file, file);
// Download shelf should close. Download panel stays open on ChromeOS.
EXPECT_FALSE(browser()->window()->IsDownloadShelfVisible());
@@ -1701,7 +1702,7 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, DownloadUrl) {
EXPECT_TRUE(DidShowFileChooser());
// Check state.
- EXPECT_EQ(1, browser()->tab_count());
+ EXPECT_EQ(1, browser()->tab_strip_model()->count());
ASSERT_TRUE(CheckDownload(browser(), file, file));
EXPECT_TRUE(browser()->window()->IsDownloadShelfVisible());
}
@@ -1726,7 +1727,7 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, DownloadUrlToPath) {
EXPECT_EQ(1u, observer->NumDownloadsSeenInState(DownloadItem::COMPLETE));
// Check state.
- EXPECT_EQ(1, browser()->tab_count());
+ EXPECT_EQ(1, browser()->tab_strip_model()->count());
ASSERT_TRUE(CheckDownloadFullPaths(browser(),
target_file_full_path,
OriginFile(file)));
diff --git a/chrome/browser/extensions/api/extension_action/browser_action_apitest.cc b/chrome/browser/extensions/api/extension_action/browser_action_apitest.cc
index 81c1d54..58d110a 100644
--- a/chrome/browser/extensions/api/extension_action/browser_action_apitest.cc
+++ b/chrome/browser/extensions/api/extension_action/browser_action_apitest.cc
@@ -19,8 +19,8 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_commands.h"
-#include "chrome/browser/ui/browser_tabstrip.h"
#include "chrome/browser/ui/browser_window.h"
+#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/url_constants.h"
#include "chrome/test/base/ui_test_utils.h"
@@ -331,7 +331,7 @@ IN_PROC_BROWSER_TEST_F(BrowserActionApiTest,
EXPECT_EQ("hi!", GetBrowserActionsBar().GetTooltip(0));
// Go back to first tab, changed title should reappear.
- chrome::ActivateTabAt(browser(), 0, true);
+ browser()->tab_strip_model()->ActivateTabAt(0, true);
EXPECT_EQ("Showing icon 2", GetBrowserActionsBar().GetTooltip(0));
// Reload that tab, default title should come back.
@@ -382,7 +382,7 @@ IN_PROC_BROWSER_TEST_F(BrowserActionApiTest, BrowserActionAddPopup) {
ASSERT_TRUE(extension) << message_;
int tab_id = ExtensionTabUtil::GetTabId(
- chrome::GetActiveWebContents(browser()));
+ browser()->tab_strip_model()->GetActiveWebContents());
ExtensionAction* browser_action = GetBrowserAction(*extension);
ASSERT_TRUE(browser_action)
@@ -438,7 +438,7 @@ IN_PROC_BROWSER_TEST_F(BrowserActionApiTest, BrowserActionRemovePopup) {
ASSERT_TRUE(extension) << message_;
int tab_id = ExtensionTabUtil::GetTabId(
- chrome::GetActiveWebContents(browser()));
+ browser()->tab_strip_model()->GetActiveWebContents());
ExtensionAction* browser_action = GetBrowserAction(*extension);
ASSERT_TRUE(browser_action)
diff --git a/chrome/browser/notifications/notification_browsertest.cc b/chrome/browser/notifications/notification_browsertest.cc
index 67792ad..5f797ad 100644
--- a/chrome/browser/notifications/notification_browsertest.cc
+++ b/chrome/browser/notifications/notification_browsertest.cc
@@ -28,6 +28,7 @@
#include "chrome/browser/ui/browser_tabstrip.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/tab_contents/tab_contents.h"
+#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/content_settings.h"
#include "chrome/common/content_settings_pattern.h"
@@ -219,7 +220,7 @@ void NotificationsTest::CloseBrowserWindow(Browser* browser) {
}
void NotificationsTest::CrashTab(Browser* browser, int index) {
- content::CrashTab(chrome::GetWebContentsAt(browser, index));
+ content::CrashTab(browser->tab_strip_model()->GetWebContentsAt(index));
}
void NotificationsTest::CrashNotification(Balloon* balloon) {
@@ -249,7 +250,7 @@ void NotificationsTest::AllowAllOrigins() {
void NotificationsTest::VerifyInfobar(const Browser* browser, int index) {
InfoBarTabHelper* infobar_helper = InfoBarTabHelper::FromWebContents(
- chrome::GetWebContentsAt(browser, index));
+ browser->tab_strip_model()->GetWebContentsAt(index));
ASSERT_EQ(1U, infobar_helper->GetInfoBarCount());
InfoBarDelegate* infobar = infobar_helper->GetInfoBarDelegateAt(0);
@@ -274,7 +275,7 @@ std::string NotificationsTest::CreateNotification(
NotificationBalloonChangeObserver observer;
std::string result;
bool success = content::ExecuteJavaScriptAndExtractString(
- chrome::GetActiveWebContents(browser)->GetRenderViewHost(),
+ browser->tab_strip_model()->GetActiveWebContents()->GetRenderViewHost(),
L"",
UTF8ToWide(script),
&result);
@@ -295,13 +296,13 @@ std::string NotificationsTest::CreateSimpleNotification(
bool NotificationsTest::RequestPermissionAndWait(Browser* browser) {
InfoBarTabHelper* infobar_helper = InfoBarTabHelper::FromWebContents(
- chrome::GetActiveWebContents(browser));
+ browser->tab_strip_model()->GetActiveWebContents());
content::WindowedNotificationObserver observer(
chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_ADDED,
content::Source<InfoBarTabHelper>(infobar_helper));
std::string result;
bool success = content::ExecuteJavaScriptAndExtractString(
- chrome::GetActiveWebContents(browser)->GetRenderViewHost(),
+ browser->tab_strip_model()->GetActiveWebContents()->GetRenderViewHost(),
L"",
L"requestPermission();",
&result);
@@ -321,7 +322,7 @@ bool NotificationsTest::CancelNotification(
NotificationBalloonChangeObserver observer;
std::string result;
bool success = content::ExecuteJavaScriptAndExtractString(
- chrome::GetActiveWebContents(browser)->GetRenderViewHost(),
+ browser->tab_strip_model()->GetActiveWebContents()->GetRenderViewHost(),
L"",
UTF8ToWide(script),
&result);
@@ -336,7 +337,7 @@ bool NotificationsTest::PerformActionOnInfobar(
int infobar_index,
int tab_index) {
InfoBarTabHelper* infobar_helper = InfoBarTabHelper::FromWebContents(
- chrome::GetWebContentsAt(browser, tab_index));
+ browser->tab_strip_model()->GetWebContentsAt(tab_index));
InfoBarDelegate* infobar = infobar_helper->GetInfoBarDelegateAt(
infobar_index);
@@ -413,14 +414,14 @@ IN_PROC_BROWSER_TEST_F(NotificationsTest, TestUserGestureInfobar) {
// That's considered a user gesture to webkit, and should produce an infobar.
bool result;
ASSERT_TRUE(content::ExecuteJavaScriptAndExtractBool(
- chrome::GetActiveWebContents(browser())->GetRenderViewHost(),
+ browser()->tab_strip_model()->GetActiveWebContents()->GetRenderViewHost(),
L"",
L"window.domAutomationController.send(request());",
&result));
EXPECT_TRUE(result);
EXPECT_EQ(1U, InfoBarTabHelper::FromWebContents(
- chrome::GetWebContentsAt(browser(), 0))->GetInfoBarCount());
+ browser()->tab_strip_model()->GetWebContentsAt(0))->GetInfoBarCount());
}
// If this flakes, use http://crbug.com/62311.
@@ -433,7 +434,7 @@ IN_PROC_BROWSER_TEST_F(NotificationsTest, TestNoUserGestureInfobar) {
"files/notifications/notifications_request_inline.html"));
EXPECT_EQ(0U, InfoBarTabHelper::FromWebContents(
- chrome::GetWebContentsAt(browser(), 0))->GetInfoBarCount());
+ browser()->tab_strip_model()->GetWebContentsAt(0))->GetInfoBarCount());
}
// Disable new testcases on Chrome OS due to failure on creating notification.
@@ -559,7 +560,7 @@ IN_PROC_BROWSER_TEST_F(NotificationsTest, TestAllowNotificationsFromAllSites) {
ASSERT_EQ(1, GetNotificationCount());
EXPECT_EQ(0U, InfoBarTabHelper::FromWebContents(
- chrome::GetWebContentsAt(browser(), 0))->GetInfoBarCount());
+ browser()->tab_strip_model()->GetWebContentsAt(0))->GetInfoBarCount());
}
IN_PROC_BROWSER_TEST_F(NotificationsTest, TestDenyNotificationsFromAllSites) {
@@ -618,7 +619,7 @@ IN_PROC_BROWSER_TEST_F(NotificationsTest, TestDenyAndThenAllowDomain) {
ASSERT_EQ(1, GetNotificationCount());
EXPECT_EQ(0U, InfoBarTabHelper::FromWebContents(
- chrome::GetWebContentsAt(browser(), 0))->GetInfoBarCount());
+ browser()->tab_strip_model()->GetWebContentsAt(0))->GetInfoBarCount());
}
IN_PROC_BROWSER_TEST_F(NotificationsTest, TestCreateDenyCloseNotifications) {
@@ -682,7 +683,7 @@ IN_PROC_BROWSER_TEST_F(NotificationsTest, TestCrashTabWithPermissionInfobar) {
empty_page_url_,
NEW_BACKGROUND_TAB,
ui_test_utils::BROWSER_TEST_WAIT_FOR_TAB);
- chrome::ActivateTabAt(browser(), 0, true);
+ browser()->tab_strip_model()->ActivateTabAt(0, true);
ui_test_utils::NavigateToURL(browser(), test_page_url_);
ASSERT_TRUE(RequestPermissionAndWait(browser()));
CrashTab(browser(), 0);
@@ -705,7 +706,7 @@ IN_PROC_BROWSER_TEST_F(NotificationsTest, TestIncognitoNotification) {
// Test notifications in incognito window.
Browser* browser = CreateIncognitoBrowser();
ui_test_utils::NavigateToURL(browser, test_page_url_);
- chrome::ActivateTabAt(browser, 0, true);
+ browser->tab_strip_model()->ActivateTabAt(0, true);
ASSERT_TRUE(RequestPermissionAndWait(browser));
PerformActionOnInfobar(browser, ALLOW, 0, 0);
CreateSimpleNotification(browser, true);
@@ -719,13 +720,14 @@ IN_PROC_BROWSER_TEST_F(NotificationsTest, TestCloseTabWithPermissionInfobar) {
GURL("about:blank"),
NEW_BACKGROUND_TAB,
ui_test_utils::BROWSER_TEST_WAIT_FOR_TAB);
- chrome::ActivateTabAt(browser(), 0, true);
+ browser()->tab_strip_model()->ActivateTabAt(0, true);
ui_test_utils::NavigateToURL(browser(), test_page_url_);
ASSERT_TRUE(RequestPermissionAndWait(browser()));
content::WindowedNotificationObserver observer(
content::NOTIFICATION_WEB_CONTENTS_DESTROYED,
content::NotificationService::AllSources());
- chrome::CloseWebContents(browser(), chrome::GetWebContentsAt(browser(), 0));
+ chrome::CloseWebContents(browser(),
+ browser()->tab_strip_model()->GetWebContentsAt(0));
observer.Wait();
}
@@ -739,7 +741,7 @@ IN_PROC_BROWSER_TEST_F(
GURL("about:blank"),
NEW_BACKGROUND_TAB,
ui_test_utils::BROWSER_TEST_WAIT_FOR_TAB);
- chrome::ActivateTabAt(browser(), 0, true);
+ browser()->tab_strip_model()->ActivateTabAt(0, true);
ui_test_utils::NavigateToURL(browser(), test_page_url_);
ASSERT_TRUE(RequestPermissionAndWait(browser()));
ui_test_utils::NavigateToURL(browser(), test_page_url_);
@@ -757,7 +759,7 @@ IN_PROC_BROWSER_TEST_F(NotificationsTest, TestCrashRendererNotificationRemain) {
GURL("about:blank"),
NEW_BACKGROUND_TAB,
ui_test_utils::BROWSER_TEST_WAIT_FOR_TAB);
- chrome::ActivateTabAt(browser(), 0, true);
+ browser()->tab_strip_model()->ActivateTabAt(0, true);
ui_test_utils::NavigateToURL(browser(), test_page_url_);
CreateSimpleNotification(browser(), true);
ASSERT_EQ(1, GetNotificationCount());
diff --git a/chrome/browser/renderer_host/web_cache_manager_browsertest.cc b/chrome/browser/renderer_host/web_cache_manager_browsertest.cc
index 16b924d..f4a5e4b 100644
--- a/chrome/browser/renderer_host/web_cache_manager_browsertest.cc
+++ b/chrome/browser/renderer_host/web_cache_manager_browsertest.cc
@@ -9,7 +9,7 @@
#include "chrome/browser/renderer_host/web_cache_manager.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_commands.h"
-#include "chrome/browser/ui/browser_tabstrip.h"
+#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "chrome/test/base/ui_test_utils.h"
#include "content/public/browser/render_process_host.h"
@@ -34,26 +34,26 @@ IN_PROC_BROWSER_TEST_F(WebCacheManagerBrowserTest, CrashOnceOnly) {
chrome::NewTab(browser());
ui_test_utils::NavigateToURL(browser(), url);
- WebContents* tab = chrome::GetWebContentsAt(browser(), 0);
+ WebContents* tab = browser()->tab_strip_model()->GetWebContentsAt(0);
ASSERT_TRUE(tab != NULL);
base::KillProcess(tab->GetRenderProcessHost()->GetHandle(),
content::RESULT_CODE_KILLED, true);
- chrome::ActivateTabAt(browser(), 0, true);
+ browser()->tab_strip_model()->ActivateTabAt(0, true);
chrome::NewTab(browser());
ui_test_utils::NavigateToURL(browser(), url);
- chrome::ActivateTabAt(browser(), 0, true);
+ browser()->tab_strip_model()->ActivateTabAt(0, true);
chrome::NewTab(browser());
ui_test_utils::NavigateToURL(browser(), url);
// We would have crashed at the above line with the bug.
- chrome::ActivateTabAt(browser(), 0, true);
+ browser()->tab_strip_model()->ActivateTabAt(0, true);
chrome::CloseTab(browser());
- chrome::ActivateTabAt(browser(), 0, true);
+ browser()->tab_strip_model()->ActivateTabAt(0, true);
chrome::CloseTab(browser());
- chrome::ActivateTabAt(browser(), 0, true);
+ browser()->tab_strip_model()->ActivateTabAt(0, true);
chrome::CloseTab(browser());
ui_test_utils::NavigateToURL(browser(), url);
diff --git a/chrome/browser/safe_browsing/safe_browsing_blocking_page_test.cc b/chrome/browser/safe_browsing/safe_browsing_blocking_page_test.cc
index d6ff778..5db2c16 100644
--- a/chrome/browser/safe_browsing/safe_browsing_blocking_page_test.cc
+++ b/chrome/browser/safe_browsing/safe_browsing_blocking_page_test.cc
@@ -21,6 +21,7 @@
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_tabstrip.h"
#include "chrome/browser/ui/tab_contents/tab_contents.h"
+#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/url_constants.h"
#include "chrome/test/base/in_process_browser_test.h"
@@ -361,7 +362,8 @@ class SafeBrowsingBlockingPageTest : public InProcessBrowserTest {
}
void SendCommand(const std::string& command) {
- WebContents* contents = chrome::GetActiveWebContents(browser());
+ WebContents* contents =
+ browser()->tab_strip_model()->GetActiveWebContents();
// We use InterstitialPage::GetInterstitialPage(tab) instead of
// tab->GetInterstitialPage() because the tab doesn't have a pointer
// to its interstital page until it gets a command from the renderer
@@ -376,7 +378,8 @@ class SafeBrowsingBlockingPageTest : public InProcessBrowserTest {
}
void DontProceedThroughInterstitial() {
- WebContents* contents = chrome::GetActiveWebContents(browser());
+ WebContents* contents =
+ browser()->tab_strip_model()->GetActiveWebContents();
InterstitialPage* interstitial_page = InterstitialPage::GetInterstitialPage(
contents);
ASSERT_TRUE(interstitial_page);
@@ -384,7 +387,8 @@ class SafeBrowsingBlockingPageTest : public InProcessBrowserTest {
}
void ProceedThroughInterstitial() {
- WebContents* contents = chrome::GetActiveWebContents(browser());
+ WebContents* contents =
+ browser()->tab_strip_model()->GetActiveWebContents();
InterstitialPage* interstitial_page = InterstitialPage::GetInterstitialPage(
contents);
ASSERT_TRUE(interstitial_page);
@@ -392,7 +396,8 @@ class SafeBrowsingBlockingPageTest : public InProcessBrowserTest {
}
void AssertNoInterstitial(bool wait_for_delete) {
- WebContents* contents = chrome::GetActiveWebContents(browser());
+ WebContents* contents =
+ browser()->tab_strip_model()->GetActiveWebContents();
if (contents->ShowingInterstitialPage() && wait_for_delete) {
// We'll get notified when the interstitial is deleted.
@@ -408,14 +413,16 @@ class SafeBrowsingBlockingPageTest : public InProcessBrowserTest {
}
bool YesInterstitial() {
- WebContents* contents = chrome::GetActiveWebContents(browser());
+ WebContents* contents =
+ browser()->tab_strip_model()->GetActiveWebContents();
InterstitialPage* interstitial_page = InterstitialPage::GetInterstitialPage(
contents);
return interstitial_page != NULL;
}
void WaitForInterstitial() {
- WebContents* contents = chrome::GetActiveWebContents(browser());
+ WebContents* contents =
+ browser()->tab_strip_model()->GetActiveWebContents();
content::WindowedNotificationObserver interstitial_observer(
content::NOTIFICATION_INTERSTITIAL_ATTACHED,
content::Source<WebContents>(contents));
@@ -454,13 +461,13 @@ class SafeBrowsingBlockingPageTest : public InProcessBrowserTest {
ui_test_utils::BROWSER_TEST_WAIT_FOR_TAB);
WaitForInterstitial();
// Cancel the redirect request while interstitial page is open.
- chrome::ActivateTabAt(browser(), 0, true);
+ browser()->tab_strip_model()->ActivateTabAt(0, true);
ui_test_utils::NavigateToURLWithDisposition(
browser(),
GURL("javascript:stopWin()"),
CURRENT_TAB,
ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION);
- chrome::ActivateTabAt(browser(), 1, true);
+ browser()->tab_strip_model()->ActivateTabAt(1, true);
// Simulate the user clicking "proceed", there should be no crash. Since
// clicking proceed may do nothing (see comment in MalwareRedirectCanceled
// below, and crbug.com/76460), we use SendCommand to trigger the callback
@@ -471,7 +478,7 @@ class SafeBrowsingBlockingPageTest : public InProcessBrowserTest {
content::RenderViewHost* GetRenderViewHost() {
InterstitialPage* interstitial = InterstitialPage::GetInterstitialPage(
- chrome::GetActiveWebContents(browser()));
+ browser()->tab_strip_model()->GetActiveWebContents());
if (!interstitial)
return NULL;
return interstitial->GetRenderViewHostForTesting();
@@ -534,7 +541,8 @@ class SafeBrowsingBlockingPageTest : public InProcessBrowserTest {
// nav entry committed event.
content::WindowedNotificationObserver observer(
content::NOTIFICATION_INTERSTITIAL_DETACHED,
- content::Source<WebContents>(chrome::GetActiveWebContents(browser())));
+ content::Source<WebContents>(
+ browser()->tab_strip_model()->GetActiveWebContents()));
if (!Click(node_id))
return false;
observer.Wait();
@@ -588,7 +596,7 @@ IN_PROC_BROWSER_TEST_F(SafeBrowsingBlockingPageTest, MalwareDontProceed) {
AssertNoInterstitial(false); // Assert the interstitial is gone
EXPECT_EQ(
GURL(chrome::kAboutBlankURL), // Back to "about:blank"
- chrome::GetActiveWebContents(browser())->GetURL());
+ browser()->tab_strip_model()->GetActiveWebContents()->GetURL());
}
IN_PROC_BROWSER_TEST_F(SafeBrowsingBlockingPageTest, MalwareProceed) {
@@ -596,7 +604,8 @@ IN_PROC_BROWSER_TEST_F(SafeBrowsingBlockingPageTest, MalwareProceed) {
EXPECT_TRUE(ClickAndWaitForDetach("proceed"));
AssertNoInterstitial(true); // Assert the interstitial is gone.
- EXPECT_EQ(url, chrome::GetActiveWebContents(browser())->GetURL());
+ EXPECT_EQ(url,
+ browser()->tab_strip_model()->GetActiveWebContents()->GetURL());
}
IN_PROC_BROWSER_TEST_F(SafeBrowsingBlockingPageTest,
@@ -609,7 +618,7 @@ IN_PROC_BROWSER_TEST_F(SafeBrowsingBlockingPageTest,
// We are in the help page.
EXPECT_EQ(
"/goodtoknow/online-safety/malware/",
- chrome::GetActiveWebContents(browser())->GetURL().path());
+ browser()->tab_strip_model()->GetActiveWebContents()->GetURL().path());
}
IN_PROC_BROWSER_TEST_F(SafeBrowsingBlockingPageTest,
@@ -633,7 +642,7 @@ IN_PROC_BROWSER_TEST_F(SafeBrowsingBlockingPageTest,
EXPECT_EQ(
GURL(chrome::kAboutBlankURL), // Back to "about:blank"
- chrome::GetActiveWebContents(browser())->GetURL());
+ browser()->tab_strip_model()->GetActiveWebContents()->GetURL());
}
// Crashy, http://crbug.com/68834.
@@ -644,7 +653,8 @@ IN_PROC_BROWSER_TEST_F(SafeBrowsingBlockingPageTest,
EXPECT_TRUE(ClickAndWaitForDetach("proceed"));
AssertNoInterstitial(true); // Assert the interstitial is gone
- EXPECT_EQ(url, chrome::GetActiveWebContents(browser())->GetURL());
+ EXPECT_EQ(url,
+ browser()->tab_strip_model()->GetActiveWebContents()->GetURL());
}
IN_PROC_BROWSER_TEST_F(SafeBrowsingBlockingPageTest,
@@ -662,7 +672,8 @@ IN_PROC_BROWSER_TEST_F(SafeBrowsingBlockingPageTest,
EXPECT_TRUE(browser()->profile()->GetPrefs()->GetBoolean(
prefs::kSafeBrowsingReportingEnabled));
- EXPECT_EQ(url, chrome::GetActiveWebContents(browser())->GetURL());
+ EXPECT_EQ(url,
+ browser()->tab_strip_model()->GetActiveWebContents()->GetURL());
AssertReportSent();
}
@@ -690,7 +701,7 @@ IN_PROC_BROWSER_TEST_F(SafeBrowsingBlockingPageTest, ProceedDisabled) {
AssertNoInterstitial(true);
EXPECT_EQ(
GURL(chrome::kAboutBlankURL), // Back to "about:blank"
- chrome::GetActiveWebContents(browser())->GetURL());
+ browser()->tab_strip_model()->GetActiveWebContents()->GetURL());
}
// Verifies that the reporting checkbox is hidden on non-HTTP pages.
@@ -720,7 +731,7 @@ IN_PROC_BROWSER_TEST_F(SafeBrowsingBlockingPageTest, ReportingDisabled) {
AssertNoInterstitial(false); // Assert the interstitial is gone
EXPECT_EQ(
GURL(chrome::kAboutBlankURL), // Back to "about:blank"
- chrome::GetActiveWebContents(browser())->GetURL());
+ browser()->tab_strip_model()->GetActiveWebContents()->GetURL());
}
IN_PROC_BROWSER_TEST_F(SafeBrowsingBlockingPageTest, PhishingDontProceed) {
@@ -742,7 +753,7 @@ IN_PROC_BROWSER_TEST_F(SafeBrowsingBlockingPageTest, PhishingDontProceed) {
AssertNoInterstitial(false); // Assert the interstitial is gone
EXPECT_EQ(
GURL(chrome::kAboutBlankURL), // We are back to "about:blank".
- chrome::GetActiveWebContents(browser())->GetURL());
+ browser()->tab_strip_model()->GetActiveWebContents()->GetURL());
}
IN_PROC_BROWSER_TEST_F(SafeBrowsingBlockingPageTest, PhishingProceed) {
@@ -750,7 +761,8 @@ IN_PROC_BROWSER_TEST_F(SafeBrowsingBlockingPageTest, PhishingProceed) {
EXPECT_TRUE(ClickAndWaitForDetach("proceed"));
AssertNoInterstitial(true); // Assert the interstitial is gone
- EXPECT_EQ(url, chrome::GetActiveWebContents(browser())->GetURL());
+ EXPECT_EQ(url,
+ browser()->tab_strip_model()->GetActiveWebContents()->GetURL());
}
IN_PROC_BROWSER_TEST_F(SafeBrowsingBlockingPageTest, PhishingReportError) {
@@ -762,7 +774,7 @@ IN_PROC_BROWSER_TEST_F(SafeBrowsingBlockingPageTest, PhishingReportError) {
// We are in the error reporting page.
EXPECT_EQ(
"/safebrowsing/report_error/",
- chrome::GetActiveWebContents(browser())->GetURL().path());
+ browser()->tab_strip_model()->GetActiveWebContents()->GetURL().path());
}
IN_PROC_BROWSER_TEST_F(SafeBrowsingBlockingPageTest, PhishingLearnMore) {
@@ -774,5 +786,5 @@ IN_PROC_BROWSER_TEST_F(SafeBrowsingBlockingPageTest, PhishingLearnMore) {
// We are in the help page.
EXPECT_EQ(
"/goodtoknow/online-safety/phishing/",
- chrome::GetActiveWebContents(browser())->GetURL().path());
+ browser()->tab_strip_model()->GetActiveWebContents()->GetURL().path());
}
diff --git a/chrome/browser/sessions/session_restore.cc b/chrome/browser/sessions/session_restore.cc
index fbc1830..217eb62 100644
--- a/chrome/browser/sessions/session_restore.cc
+++ b/chrome/browser/sessions/session_restore.cc
@@ -622,7 +622,7 @@ class SessionRestoreImpl : public content::NotificationObserver {
}
if (use_new_window) {
- chrome::ActivateTabAt(browser, 0, true);
+ browser->tab_strip_model()->ActivateTabAt(0, true);
browser->window()->Show();
}
NotifySessionServiceOfRestoredTabs(browser, browser->tab_count());
@@ -1021,7 +1021,7 @@ class SessionRestoreImpl : public content::NotificationObserver {
void ShowBrowser(Browser* browser, int selected_tab_index) {
DCHECK(browser);
DCHECK(browser->tab_count());
- chrome::ActivateTabAt(browser, selected_tab_index, true);
+ browser->tab_strip_model()->ActivateTabAt(selected_tab_index, true);
if (browser_ == browser)
return;
diff --git a/chrome/browser/ui/browser_command_controller_browsertest.cc b/chrome/browser/ui/browser_command_controller_browsertest.cc
index 9a362d5..930319b 100644
--- a/chrome/browser/ui/browser_command_controller_browsertest.cc
+++ b/chrome/browser/ui/browser_command_controller_browsertest.cc
@@ -5,9 +5,10 @@
#include "chrome/browser/ui/browser_command_controller.h"
#include "chrome/app/chrome_command_ids.h"
+#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_commands.h"
-#include "chrome/browser/ui/browser_tabstrip.h"
#include "chrome/browser/ui/tab_modal_confirm_dialog_browsertest.h"
+#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/test/base/in_process_browser_test.h"
typedef InProcessBrowserTest BrowserCommandControllerBrowserTest;
@@ -17,7 +18,8 @@ IN_PROC_BROWSER_TEST_F(BrowserCommandControllerBrowserTest, DisableFind) {
EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_FIND));
// Showing constrained window should disable find.
- content::WebContents* web_contents = chrome::GetActiveWebContents(browser());
+ content::WebContents* web_contents =
+ browser()->tab_strip_model()->GetActiveWebContents();
MockTabModalConfirmDialogDelegate* delegate =
new MockTabModalConfirmDialogDelegate(web_contents, NULL);
TabModalConfirmDialog::Create(delegate, web_contents);
@@ -28,7 +30,7 @@ IN_PROC_BROWSER_TEST_F(BrowserCommandControllerBrowserTest, DisableFind) {
EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_FIND));
// Switching back to the blocked tab should disable it again.
- chrome::ActivateTabAt(browser(), 0, false);
+ browser()->tab_strip_model()->ActivateTabAt(0, false);
EXPECT_FALSE(chrome::IsCommandEnabled(browser(), IDC_FIND));
// Closing the constrained window should reenable it.
diff --git a/chrome/browser/ui/browser_commands.cc b/chrome/browser/ui/browser_commands.cc
index 996b027..f5b64ce 100644
--- a/chrome/browser/ui/browser_commands.cc
+++ b/chrome/browser/ui/browser_commands.cc
@@ -536,7 +536,7 @@ void MoveTabPrevious(Browser* browser) {
void SelectNumberedTab(Browser* browser, int index) {
if (index < browser->tab_count()) {
content::RecordAction(UserMetricsAction("SelectNumberedTab"));
- ActivateTabAt(browser, index, true);
+ browser->tab_strip_model()->ActivateTabAt(index, true);
}
}
diff --git a/chrome/browser/ui/browser_focus_uitest.cc b/chrome/browser/ui/browser_focus_uitest.cc
index 7726fd0..52153ef 100644
--- a/chrome/browser/ui/browser_focus_uitest.cc
+++ b/chrome/browser/ui/browser_focus_uitest.cc
@@ -340,11 +340,11 @@ 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.
- chrome::ActivateTabAt(browser(), j, true);
+ browser()->tab_strip_model()->ActivateTabAt(j, true);
// Activate the location bar or the page.
if (kFocusPage[i][j]) {
- chrome::GetWebContentsAt(browser(), j)->GetView()->Focus();
+ browser()->tab_strip_model()->GetWebContentsAt(j)->GetView()->Focus();
} else {
chrome::FocusLocationBar(browser());
}
@@ -353,14 +353,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.
- chrome::ActivateTabAt(browser(), j, true);
+ browser()->tab_strip_model()->ActivateTabAt(j, true);
ViewID vid = kFocusPage[i][j] ? VIEW_ID_TAB_CONTAINER :
location_bar_focus_view_id_;
ASSERT_TRUE(IsViewFocused(vid));
}
- chrome::ActivateTabAt(browser(), 0, true);
+ browser()->tab_strip_model()->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++) {
@@ -373,7 +373,7 @@ IN_PROC_BROWSER_TEST_F(BrowserFocusTest, DISABLED_TabsRememberFocus) {
}
// As above, but with ctrl+shift+tab.
- chrome::ActivateTabAt(browser(), 4, true);
+ browser()->tab_strip_model()->ActivateTabAt(4, true);
for (int j = 14; j >= 0; --j) {
ViewID vid = kFocusPage[i][j % 5] ? VIEW_ID_TAB_CONTAINER :
location_bar_focus_view_id_;
@@ -410,16 +410,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)
- chrome::ActivateTabAt(browser(), 0, true);
+ browser()->tab_strip_model()->ActivateTabAt(0, true);
ASSERT_TRUE(IsViewFocused(location_bar_focus_view_id_));
// Now open the find box again, switch to another tab and come back, the focus
// should return to the find box.
chrome::Find(browser());
ASSERT_TRUE(IsViewFocused(VIEW_ID_FIND_IN_PAGE_TEXT_FIELD));
- chrome::ActivateTabAt(browser(), 1, true);
+ browser()->tab_strip_model()->ActivateTabAt(1, true);
ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER));
- chrome::ActivateTabAt(browser(), 0, true);
+ browser()->tab_strip_model()->ActivateTabAt(0, true);
ASSERT_TRUE(IsViewFocused(VIEW_ID_FIND_IN_PAGE_TEXT_FIELD));
}
diff --git a/chrome/browser/ui/browser_navigator.cc b/chrome/browser/ui/browser_navigator.cc
index 0813846..248b841 100644
--- a/chrome/browser/ui/browser_navigator.cc
+++ b/chrome/browser/ui/browser_navigator.cc
@@ -560,8 +560,10 @@ void Navigate(NavigateParams* params) {
}
// If the singleton tab isn't already selected, select it.
- if (params->source_contents != params->target_contents)
- chrome::ActivateTabAt(params->browser, singleton_index, user_initiated);
+ if (params->source_contents != params->target_contents) {
+ params->browser->tab_strip_model()->ActivateTabAt(singleton_index,
+ user_initiated);
+ }
}
if (params->disposition != CURRENT_TAB) {
diff --git a/chrome/browser/ui/browser_tabstrip.cc b/chrome/browser/ui/browser_tabstrip.cc
index 0bda8e8..2ca9ac1 100644
--- a/chrome/browser/ui/browser_tabstrip.cc
+++ b/chrome/browser/ui/browser_tabstrip.cc
@@ -35,10 +35,6 @@ content::WebContents* GetWebContentsAt(const Browser* browser, int index) {
return browser->tab_strip_model()->GetWebContentsAt(index);
}
-void ActivateTabAt(Browser* browser, int index, bool user_gesture) {
- browser->tab_strip_model()->ActivateTabAt(index, user_gesture);
-}
-
void AddBlankTabAt(Browser* browser, int index, bool foreground) {
// TODO(scottmg): http://crbug.com/128578
// This is necessary because WebContentsViewAura doesn't have enough context
diff --git a/chrome/browser/ui/browser_tabstrip.h b/chrome/browser/ui/browser_tabstrip.h
index c8e8e09..6ab6403 100644
--- a/chrome/browser/ui/browser_tabstrip.h
+++ b/chrome/browser/ui/browser_tabstrip.h
@@ -29,8 +29,6 @@ content::WebContents* GetActiveWebContents(const Browser* browser);
content::WebContents* GetWebContentsAt(const Browser* browser, int index);
-void ActivateTabAt(Browser* browser, int index, bool user_gesture);
-
// Adds a blank tab to the tab strip of the specified browser; an |index| of -1
// means to append it to the end of the tab strip.
void AddBlankTabAt(Browser* browser, int index, bool foreground);
diff --git a/chrome/browser/ui/cocoa/applescript/window_applescript.mm b/chrome/browser/ui/cocoa/applescript/window_applescript.mm
index 93409d5..31b9851 100644
--- a/chrome/browser/ui/cocoa/applescript/window_applescript.mm
+++ b/chrome/browser/ui/cocoa/applescript/window_applescript.mm
@@ -117,8 +117,8 @@
- (void)setActiveTabIndex:(NSNumber*)anActiveTabIndex {
// Note: applescript is 1-based, that is lists begin with index 1.
int atIndex = [anActiveTabIndex intValue] - 1;
- if (atIndex >= 0 && atIndex < browser_->tab_count())
- chrome::ActivateTabAt(browser_, atIndex, true);
+ if (atIndex >= 0 && atIndex < browser_->tab_strip_model()->count())
+ browser_->tab_strip_model()->ActivateTabAt(atIndex, true);
else
AppleScript::SetError(AppleScript::errInvalidTabIndex);
}
@@ -139,9 +139,8 @@
- (TabAppleScript*)activeTab {
TabAppleScript* currentTab =
- [[[TabAppleScript alloc]
- initWithWebContents:chrome::GetActiveWebContents(browser_)]
- autorelease];
+ [[[TabAppleScript alloc] initWithWebContents:
+ browser_->tab_strip_model()->GetActiveWebContents()] autorelease];
[currentTab setContainer:self
property:AppleScript::kTabsProperty];
return currentTab;
@@ -153,7 +152,8 @@
for (int i = 0; i < browser_->tab_count(); ++i) {
// Check to see if tab is closing.
- content::WebContents* webContents = chrome::GetWebContentsAt(browser_, i);
+ content::WebContents* webContents =
+ browser_->tab_strip_model()->GetWebContentsAt(i);
if (webContents->IsBeingDestroyed()) {
continue;
}
@@ -203,7 +203,8 @@
}
- (void)removeFromTabsAtIndex:(int)index {
- chrome::CloseWebContents(browser_, chrome::GetWebContentsAt(browser_, index));
+ chrome::CloseWebContents(
+ browser_, browser_->tab_strip_model()->GetWebContentsAt(index));
}
- (NSNumber*)orderedIndex {
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 decd6bf..aaf860c 100644
--- a/chrome/browser/ui/find_bar/find_bar_host_browsertest.cc
+++ b/chrome/browser/ui/find_bar/find_bar_host_browsertest.cc
@@ -192,7 +192,8 @@ IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, FindInPageFrames) {
// Try incremental search (mimicking user typing in).
int ordinal = 0;
- WebContents* web_contents = chrome::GetActiveWebContents(browser());
+ WebContents* web_contents =
+ browser()->tab_strip_model()->GetActiveWebContents();
EXPECT_EQ(18, FindInPageWchar(web_contents, L"g",
kFwd, kIgnoreCase, &ordinal));
EXPECT_EQ(1, ordinal);
@@ -268,7 +269,8 @@ IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, FindInPageFormsTextAreas) {
urls.push_back(GetURL("textintextarea.html"));
urls.push_back(GetURL("smalltextarea.html"));
urls.push_back(GetURL("populatedform.html"));
- WebContents* web_contents = chrome::GetActiveWebContents(browser());
+ WebContents* web_contents =
+ browser()->tab_strip_model()->GetActiveWebContents();
for (size_t i = 0; i < urls.size(); ++i) {
ui_test_utils::NavigateToURL(browser(), urls[i]);
@@ -282,7 +284,8 @@ IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, FindInPageFormsTextAreas) {
// Verify search for text within special URLs such as chrome:history,
// chrome://downloads, data directory
IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, SearchWithinSpecialURL) {
- WebContents* web_contents = chrome::GetActiveWebContents(browser());
+ WebContents* web_contents =
+ browser()->tab_strip_model()->GetActiveWebContents();
FilePath data_dir = ui_test_utils::GetTestFilePath(FilePath(), FilePath());
ui_test_utils::NavigateToURL(browser(), net::FilePathToFileURL(data_dir));
@@ -320,7 +323,8 @@ IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, SearchWithinSpecialURL) {
IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, FindInPageSpecialURLs) {
std::wstring search_string(L"\u5728\u897f\u660c\u536b\u661f\u53d1");
gfx::Rect first, second, first_reverse;
- WebContents* web_contents = chrome::GetActiveWebContents(browser());
+ WebContents* web_contents =
+ browser()->tab_strip_model()->GetActiveWebContents();
ui_test_utils::NavigateToURL(browser(), GetURL("specialchar.html"));
ui_test_utils::FindInPage(web_contents, WideToUTF16(search_string),
kFwd, kIgnoreCase, NULL, &first);
@@ -345,7 +349,8 @@ IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, FindInPageSpecialURLs) {
// Verifies that comments and meta data are not searchable.
IN_PROC_BROWSER_TEST_F(FindInPageControllerTest,
CommentsAndMetaDataNotSearchable) {
- WebContents* web_contents = chrome::GetActiveWebContents(browser());
+ WebContents* web_contents =
+ browser()->tab_strip_model()->GetActiveWebContents();
ui_test_utils::NavigateToURL(browser(), GetURL("specialchar.html"));
std::wstring search_string =
@@ -356,7 +361,8 @@ IN_PROC_BROWSER_TEST_F(FindInPageControllerTest,
// Verifies that span and lists are searchable.
IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, SpanAndListsSearchable) {
- WebContents* web_contents = chrome::GetActiveWebContents(browser());
+ WebContents* web_contents =
+ browser()->tab_strip_model()->GetActiveWebContents();
ui_test_utils::NavigateToURL(browser(), GetURL("FindRandomTests.html"));
std::wstring search_string = L"has light blue eyes and my father has dark";
@@ -370,7 +376,8 @@ IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, SpanAndListsSearchable) {
// Find in a very large page.
IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, LargePage) {
- WebContents* web_contents = chrome::GetActiveWebContents(browser());
+ WebContents* web_contents =
+ browser()->tab_strip_model()->GetActiveWebContents();
ui_test_utils::NavigateToURL(browser(), GetURL("largepage.html"));
std::wstring search_string = L"daughter of Prince";
@@ -381,7 +388,8 @@ IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, LargePage) {
// Find a very long string in a large page.
IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, FindLongString) {
- WebContents* web_contents = chrome::GetActiveWebContents(browser());
+ WebContents* web_contents =
+ browser()->tab_strip_model()->GetActiveWebContents();
ui_test_utils::NavigateToURL(browser(), GetURL("largepage.html"));
FilePath path = ui_test_utils::GetTestFilePath(
@@ -397,7 +405,8 @@ IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, FindLongString) {
// Find a big font string in a page.
IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, BigString) {
- WebContents* web_contents = chrome::GetActiveWebContents(browser());
+ WebContents* web_contents =
+ browser()->tab_strip_model()->GetActiveWebContents();
ui_test_utils::NavigateToURL(browser(), GetURL("BigText.html"));
EXPECT_EQ(1,
FindInPageWchar(web_contents, L"SomeLargeString",
@@ -406,7 +415,8 @@ IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, BigString) {
// Search Back and Forward on a single occurrence.
IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, SingleOccurrence) {
- WebContents* web_contents = chrome::GetActiveWebContents(browser());
+ WebContents* web_contents =
+ browser()->tab_strip_model()->GetActiveWebContents();
ui_test_utils::NavigateToURL(browser(), GetURL("FindRandomTests.html"));
gfx::Rect first_rect;
@@ -440,7 +450,8 @@ IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, SingleOccurrence) {
// Find the whole text file page and find count should be 1.
IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, FindWholeFileContent) {
- WebContents* web_contents = chrome::GetActiveWebContents(browser());
+ WebContents* web_contents =
+ browser()->tab_strip_model()->GetActiveWebContents();
FilePath path = ui_test_utils::GetTestFilePath(
FilePath().AppendASCII("find_in_page"),
@@ -475,7 +486,8 @@ IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, FindInPageEndState) {
GURL url = GetURL(kEndState);
ui_test_utils::NavigateToURL(browser(), url);
- WebContents* web_contents = chrome::GetActiveWebContents(browser());
+ WebContents* web_contents =
+ browser()->tab_strip_model()->GetActiveWebContents();
ASSERT_TRUE(NULL != web_contents);
FindTabHelper* find_tab_helper =
FindTabHelper::FromWebContents(web_contents);
@@ -527,7 +539,8 @@ IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, FindInPageOrdinal) {
// Search for 'o', which should make the first item active and return
// '1 in 3' (1st ordinal of a total of 3 matches).
- WebContents* web_contents = chrome::GetActiveWebContents(browser());
+ WebContents* web_contents =
+ browser()->tab_strip_model()->GetActiveWebContents();
int ordinal = 0;
EXPECT_EQ(3, FindInPageWchar(web_contents, L"o",
kFwd, kIgnoreCase, &ordinal));
@@ -563,7 +576,8 @@ IN_PROC_BROWSER_TEST_F(FindInPageControllerTest,
ui_test_utils::NavigateToURL(browser(), url);
// Search for a text that exists within a link on the page.
- WebContents* web_contents = chrome::GetActiveWebContents(browser());
+ WebContents* web_contents =
+ browser()->tab_strip_model()->GetActiveWebContents();
ASSERT_TRUE(NULL != web_contents);
FindTabHelper* find_tab_helper =
FindTabHelper::FromWebContents(web_contents);
@@ -599,7 +613,8 @@ IN_PROC_BROWSER_TEST_F(FindInPageControllerTest,
// First we navigate to our test content.
ui_test_utils::NavigateToURL(browser(), GetURL(kStartAfterSelection));
- WebContents* web_contents = chrome::GetActiveWebContents(browser());
+ WebContents* web_contents =
+ browser()->tab_strip_model()->GetActiveWebContents();
ASSERT_TRUE(web_contents != NULL);
int ordinal = 0;
@@ -642,7 +657,8 @@ IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, FindInPageMultiFramesOrdinal) {
// Search for 'a', which should make the first item active and return
// '1 in 7' (1st ordinal of a total of 7 matches).
- WebContents* web_contents = chrome::GetActiveWebContents(browser());
+ WebContents* web_contents =
+ browser()->tab_strip_model()->GetActiveWebContents();
int ordinal = 0;
EXPECT_EQ(7,
FindInPageWchar(web_contents, L"a", kFwd, kIgnoreCase, &ordinal));
@@ -691,7 +707,8 @@ IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, FindInPage_Issue5132) {
// Search for 'goa' three times (6 matches on page).
int ordinal = 0;
- WebContents* web_contents = chrome::GetActiveWebContents(browser());
+ WebContents* web_contents =
+ browser()->tab_strip_model()->GetActiveWebContents();
EXPECT_EQ(6, FindInPageWchar(web_contents, L"goa",
kFwd, kIgnoreCase, &ordinal));
EXPECT_EQ(1, ordinal);
@@ -733,7 +750,8 @@ IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, MAYBE_NavigateClearsOrdinal) {
EnsureFindBoxOpen();
// Search for a text that exists within a link on the page.
- WebContents* web_contents = chrome::GetActiveWebContents(browser());
+ WebContents* web_contents =
+ browser()->tab_strip_model()->GetActiveWebContents();
ASSERT_TRUE(NULL != web_contents);
int ordinal = 0;
EXPECT_EQ(8, FindInPageWchar(web_contents,
@@ -759,7 +777,8 @@ IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, FindUnselectableText) {
ui_test_utils::NavigateToURL(browser(), url);
int ordinal = 0;
- WebContents* web_contents = chrome::GetActiveWebContents(browser());
+ WebContents* web_contents =
+ browser()->tab_strip_model()->GetActiveWebContents();
EXPECT_EQ(1, FindInPageWchar(web_contents,
L"text",
kFwd, kIgnoreCase, &ordinal));
@@ -782,7 +801,8 @@ IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, FindCrash_Issue1341577) {
// TODO(jungshik): According to a native Malayalam speaker, it's ok not
// to find U+0D4C. Still need to investigate further this issue.
int ordinal = 0;
- WebContents* web_contents = chrome::GetActiveWebContents(browser());
+ WebContents* web_contents =
+ browser()->tab_strip_model()->GetActiveWebContents();
FindInPageWchar(web_contents, L"\u0D4C", kFwd, kIgnoreCase, &ordinal);
FindInPageWchar(web_contents, L"\u0D4C", kFwd, kIgnoreCase, &ordinal);
@@ -804,7 +824,8 @@ IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, FindCrash_Issue14491) {
// This used to crash the tab.
int ordinal = 0;
- EXPECT_EQ(0, FindInPageWchar(chrome::GetActiveWebContents(browser()),
+ EXPECT_EQ(0, FindInPageWchar(browser()->tab_strip_model()->
+ GetActiveWebContents(),
L"s", kFwd, kIgnoreCase, &ordinal));
EXPECT_EQ(0, ordinal);
}
@@ -825,7 +846,8 @@ IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, FindRestarts_Issue1155639) {
// This string appears 5 times at the bottom of a long page. If Find restarts
// properly after a timeout, it will find 5 matches, not just 1.
int ordinal = 0;
- EXPECT_EQ(5, FindInPageWchar(chrome::GetActiveWebContents(browser()),
+ EXPECT_EQ(5, FindInPageWchar(browser()->tab_strip_model()->
+ GetActiveWebContents(),
L"008.xml",
kFwd, kIgnoreCase, &ordinal));
EXPECT_EQ(1, ordinal);
@@ -841,7 +863,7 @@ IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, FindRestarts_Issue70505) {
// If this test hangs on the FindInPage call, then it might be a regression
// such as the one found in issue http://crbug.com/70505.
int ordinal = 0;
- FindInPageWchar(chrome::GetActiveWebContents(browser()),
+ FindInPageWchar(browser()->tab_strip_model()->GetActiveWebContents(),
L"a", kFwd, kIgnoreCase, &ordinal);
EXPECT_EQ(1, ordinal);
// TODO(finnur): We cannot reliably get the matchcount for this Find call
@@ -856,7 +878,8 @@ IN_PROC_BROWSER_TEST_F(FindInPageControllerTest,
GURL url = GetURL(kPrematureEnd);
ui_test_utils::NavigateToURL(browser(), url);
- WebContents* web_contents = chrome::GetActiveWebContents(browser());
+ WebContents* web_contents =
+ browser()->tab_strip_model()->GetActiveWebContents();
ASSERT_TRUE(NULL != web_contents);
// Search for a text that exists within a link on the page.
@@ -885,7 +908,8 @@ IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, FindDisappearOnNavigate) {
content::WindowedNotificationObserver observer(
content::NOTIFICATION_LOAD_STOP,
content::Source<NavigationController>(
- &chrome::GetActiveWebContents(browser())->GetController()));
+ &browser()->tab_strip_model()->GetActiveWebContents()->
+ GetController()));
chrome::Reload(browser(), CURRENT_TAB);
observer.Wait();
@@ -987,7 +1011,8 @@ IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, FindMovesWhenObscuring) {
EXPECT_TRUE(GetFindBarWindowInfo(&start_position, &fully_visible));
EXPECT_TRUE(fully_visible);
- WebContents* web_contents = chrome::GetActiveWebContents(browser());
+ WebContents* web_contents =
+ browser()->tab_strip_model()->GetActiveWebContents();
int moved_x_coord = FindInPageTillBoxMoves(web_contents, start_position.x(),
L"Chromium", kMoveIterations);
@@ -1044,7 +1069,8 @@ IN_PROC_BROWSER_TEST_F(FindInPageControllerTest,
// Search for 'no_match'. No matches should be found.
int ordinal = 0;
- WebContents* web_contents = chrome::GetActiveWebContents(browser());
+ WebContents* web_contents =
+ browser()->tab_strip_model()->GetActiveWebContents();
EXPECT_EQ(0, FindInPageWchar(web_contents, L"no_match",
kFwd, kIgnoreCase, &ordinal));
EXPECT_EQ(0, ordinal);
@@ -1083,8 +1109,8 @@ IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, StayActive) {
// simulating keypresses here for searching for something and pressing
// backspace, but that's been proven flaky in the past, so we go straight to
// tab_contents.
- FindTabHelper* find_tab_helper =
- FindTabHelper::FromWebContents(chrome::GetActiveWebContents(browser()));
+ FindTabHelper* find_tab_helper = FindTabHelper::FromWebContents(
+ browser()->tab_strip_model()->GetActiveWebContents());
// Stop the (non-existing) find operation, and clear the selection (which
// signals the UI is still active).
find_tab_helper->StopFinding(FindBarController::kClearSelectionOnPage);
@@ -1102,7 +1128,8 @@ IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, RestartSearchFromF3) {
// Search for 'page'. Should have 1 match.
int ordinal = 0;
- WebContents* web_contents = chrome::GetActiveWebContents(browser());
+ WebContents* web_contents =
+ browser()->tab_strip_model()->GetActiveWebContents();
EXPECT_EQ(1, FindInPageWchar(web_contents, L"page",
kFwd, kIgnoreCase, &ordinal));
EXPECT_EQ(1, ordinal);
@@ -1133,7 +1160,8 @@ IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, PreferPreviousSearch) {
// Find "Default".
int ordinal = 0;
- WebContents* web_contents_1 = chrome::GetActiveWebContents(browser());
+ WebContents* web_contents_1 =
+ browser()->tab_strip_model()->GetActiveWebContents();
EXPECT_EQ(1, FindInPageWchar(web_contents_1, L"text",
kFwd, kIgnoreCase, &ordinal));
@@ -1143,14 +1171,15 @@ IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, PreferPreviousSearch) {
// something relating to user gesture.
chrome::AddBlankTabAt(browser(), -1, true);
ui_test_utils::NavigateToURL(browser(), url);
- WebContents* web_contents_2 = chrome::GetActiveWebContents(browser());
+ WebContents* web_contents_2 =
+ browser()->tab_strip_model()->GetActiveWebContents();
EXPECT_NE(web_contents_1, web_contents_2);
// Find "given".
FindInPageWchar(web_contents_2, L"given", kFwd, kIgnoreCase, &ordinal);
// Switch back to first tab.
- chrome::ActivateTabAt(browser(), 0, false);
+ browser()->tab_strip_model()->ActivateTabAt(0, false);
browser()->GetFindBarController()->EndFindSession(
FindBarController::kKeepSelectionOnPage,
FindBarController::kKeepResultsInFindBox);
@@ -1175,7 +1204,8 @@ IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, PrepopulateSameTab) {
// Search for the word "page".
int ordinal = 0;
- WebContents* web_contents = chrome::GetActiveWebContents(browser());
+ WebContents* web_contents =
+ browser()->tab_strip_model()->GetActiveWebContents();
EXPECT_EQ(1, FindInPageWchar(web_contents, L"page",
kFwd, kIgnoreCase, &ordinal));
@@ -1214,14 +1244,16 @@ IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, PrepopulateInNewTab) {
// Search for the word "page".
int ordinal = 0;
- WebContents* web_contents_1 = chrome::GetActiveWebContents(browser());
+ WebContents* web_contents_1 =
+ browser()->tab_strip_model()->GetActiveWebContents();
EXPECT_EQ(1, FindInPageWchar(web_contents_1, L"page",
kFwd, kIgnoreCase, &ordinal));
EXPECT_EQ(ASCIIToUTF16("1 of 1"), GetMatchCountText());
// Now create a second tab and load the same page.
chrome::AddSelectedTabWithURL(browser(), url, content::PAGE_TRANSITION_TYPED);
- WebContents* web_contents_2 = chrome::GetActiveWebContents(browser());
+ WebContents* web_contents_2 =
+ browser()->tab_strip_model()->GetActiveWebContents();
EXPECT_NE(web_contents_1, web_contents_2);
// Open the Find box.
@@ -1249,7 +1281,8 @@ IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, PrepopulatePreserveLast) {
// Search for the word "page".
int ordinal = 0;
- WebContents* web_contents_1 = chrome::GetActiveWebContents(browser());
+ WebContents* web_contents_1 =
+ browser()->tab_strip_model()->GetActiveWebContents();
EXPECT_EQ(1, FindInPageWchar(web_contents_1, L"page",
kFwd, kIgnoreCase, &ordinal));
@@ -1266,7 +1299,8 @@ IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, PrepopulatePreserveLast) {
// Now create a second tab and load the same page.
chrome::AddBlankTabAt(browser(), -1, true);
ui_test_utils::NavigateToURL(browser(), url);
- WebContents* web_contents_2 = chrome::GetActiveWebContents(browser());
+ WebContents* web_contents_2 =
+ browser()->tab_strip_model()->GetActiveWebContents();
EXPECT_NE(web_contents_1, web_contents_2);
// Search for the word "text".
@@ -1274,7 +1308,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".
- chrome::ActivateTabAt(browser(), 0, false);
+ browser()->tab_strip_model()->ActivateTabAt(0, false);
// Open the Find box.
EnsureFindBoxOpen();
@@ -1321,7 +1355,8 @@ IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, MAYBE_NoIncognitoPrepopulate) {
// Search for the word "page" in the normal browser tab.
int ordinal = 0;
- WebContents* web_contents_1 = chrome::GetActiveWebContents(browser());
+ WebContents* web_contents_1 =
+ browser()->tab_strip_model()->GetActiveWebContents();
EXPECT_EQ(1, FindInPageWchar(web_contents_1, L"page",
kFwd, kIgnoreCase, &ordinal));
@@ -1351,7 +1386,8 @@ IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, MAYBE_NoIncognitoPrepopulate) {
EXPECT_EQ(ASCIIToUTF16("page"), GetFindBarTextForBrowser(incognito_browser));
// Search for the word "text" in the incognito tab.
- WebContents* incognito_tab = chrome::GetActiveWebContents(incognito_browser);
+ WebContents* incognito_tab =
+ incognito_browser->tab_strip_model()->GetActiveWebContents();
EXPECT_EQ(1, FindInPageWchar(incognito_tab, L"text",
kFwd, kIgnoreCase, &ordinal));
EXPECT_EQ(ASCIIToUTF16("text"), GetFindBarTextForBrowser(incognito_browser));
@@ -1363,7 +1399,8 @@ IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, MAYBE_NoIncognitoPrepopulate) {
// Now open a new tab in the original (non-incognito) browser.
chrome::AddSelectedTabWithURL(browser(), url, content::PAGE_TRANSITION_TYPED);
- WebContents* web_contents_2 = chrome::GetActiveWebContents(browser());
+ WebContents* web_contents_2 =
+ browser()->tab_strip_model()->GetActiveWebContents();
EXPECT_NE(web_contents_1, web_contents_2);
// Open the Find box and make sure it is prepopulated with the search term
@@ -1378,7 +1415,8 @@ IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, ActivateLinkNavigatesPage) {
GURL url = GetURL(kLinkPage);
ui_test_utils::NavigateToURL(browser(), url);
- WebContents* web_contents = chrome::GetActiveWebContents(browser());
+ WebContents* web_contents =
+ browser()->tab_strip_model()->GetActiveWebContents();
FindTabHelper* find_tab_helper =
FindTabHelper::FromWebContents(web_contents);
diff --git a/chrome/browser/ui/fullscreen/fullscreen_controller_browsertest.cc b/chrome/browser/ui/fullscreen/fullscreen_controller_browsertest.cc
index c9da148..6957763 100644
--- a/chrome/browser/ui/fullscreen/fullscreen_controller_browsertest.cc
+++ b/chrome/browser/ui/fullscreen/fullscreen_controller_browsertest.cc
@@ -10,6 +10,7 @@
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/fullscreen/fullscreen_controller.h"
#include "chrome/browser/ui/fullscreen/fullscreen_controller_test.h"
+#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/test/base/ui_test_utils.h"
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/web_contents.h"
@@ -30,20 +31,20 @@ IN_PROC_BROWSER_TEST_F(FullscreenControllerTest,
PendingMouseLockExitsOnTabSwitch) {
AddTabAtIndex(0, GURL(kAboutBlankURL), PAGE_TRANSITION_TYPED);
AddTabAtIndex(0, GURL(kAboutBlankURL), PAGE_TRANSITION_TYPED);
- WebContents* tab1 = chrome::GetActiveWebContents(browser());
+ WebContents* tab1 = browser()->tab_strip_model()->GetActiveWebContents();
// Request mouse lock. Bubble is displayed.
RequestToLockMouse(true, false);
ASSERT_TRUE(IsFullscreenBubbleDisplayed());
// Activate current tab. Mouse lock bubble remains.
- chrome::ActivateTabAt(browser(), 0, true);
+ browser()->tab_strip_model()->ActivateTabAt(0, true);
ASSERT_TRUE(IsFullscreenBubbleDisplayed());
// Activate second tab. Mouse lock bubble clears.
{
MouseLockNotificationObserver mouse_lock_observer;
- chrome::ActivateTabAt(browser(), 1, true);
+ browser()->tab_strip_model()->ActivateTabAt(1, true);
mouse_lock_observer.Wait();
}
ASSERT_FALSE(IsFullscreenBubbleDisplayed());
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 a7151a5..09e294d 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
@@ -42,7 +42,7 @@ IN_PROC_BROWSER_TEST_F(BookmarkBarGtkInteractiveUITest, FindBarTest) {
chrome::AddSelectedTabWithURL(browser(), url, content::PAGE_TRANSITION_TYPED);
// Switch back to the NTP with the active findbar.
- chrome::ActivateTabAt(browser(), 1, false);
+ browser()->tab_strip_model()->ActivateTabAt(1, false);
// Wait for the findbar to show.
MessageLoop::current()->RunUntilIdle();
diff --git a/chrome/browser/ui/intents/web_intent_picker_controller.cc b/chrome/browser/ui/intents/web_intent_picker_controller.cc
index 8ac7457..878ecb0 100644
--- a/chrome/browser/ui/intents/web_intent_picker_controller.cc
+++ b/chrome/browser/ui/intents/web_intent_picker_controller.cc
@@ -569,7 +569,7 @@ void WebIntentPickerController::OnSendReturnMessage(
if (source_browser) {
int source_index = source_browser->tab_strip_model()->
GetIndexOfWebContents(web_contents_);
- chrome::ActivateTabAt(source_browser, source_index, false);
+ source_browser->tab_strip_model()->ActivateTabAt(source_index, false);
}
}
service_tab_ = NULL;
diff --git a/chrome/browser/ui/omnibox/omnibox_view_browsertest.cc b/chrome/browser/ui/omnibox/omnibox_view_browsertest.cc
index 805abbd..e1d9b7e 100644
--- a/chrome/browser/ui/omnibox/omnibox_view_browsertest.cc
+++ b/chrome/browser/ui/omnibox/omnibox_view_browsertest.cc
@@ -28,6 +28,7 @@
#include "chrome/browser/ui/omnibox/location_bar.h"
#include "chrome/browser/ui/omnibox/omnibox_popup_model.h"
#include "chrome/browser/ui/omnibox/omnibox_view.h"
+#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/url_constants.h"
@@ -1254,7 +1255,7 @@ class OmniboxViewTest : public InProcessBrowserTest,
chrome::NewTab(browser());
// Switch back to the first tab.
- chrome::ActivateTabAt(browser(), 0, true);
+ browser()->tab_strip_model()->ActivateTabAt(0, true);
// Make sure we're still in keyword mode.
ASSERT_EQ(kSearchKeyword, UTF16ToUTF8(omnibox_view->model()->keyword()));
diff --git a/chrome/browser/ui/search/search_delegate_unittest.cc b/chrome/browser/ui/search/search_delegate_unittest.cc
index 07d6a1c..f5b18b0 100644
--- a/chrome/browser/ui/search/search_delegate_unittest.cc
+++ b/chrome/browser/ui/search/search_delegate_unittest.cc
@@ -4,10 +4,10 @@
#include "base/command_line.h"
#include "chrome/browser/ui/browser.h"
-#include "chrome/browser/ui/browser_tabstrip.h"
#include "chrome/browser/ui/search/search.h"
#include "chrome/browser/ui/search/search_model.h"
#include "chrome/browser/ui/search/search_tab_helper.h"
+#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/test/base/browser_with_test_window_test.h"
@@ -31,7 +31,8 @@ TEST_F(SearchDelegateTest, SearchModel) {
// Propagate change from tab's search model to browser's search model.
AddTab(browser(), GURL("http://foo/0"));
- content::WebContents* web_contents = chrome::GetWebContentsAt(browser(), 0);
+ content::WebContents* web_contents =
+ browser()->tab_strip_model()->GetWebContentsAt(0);
chrome::search::SearchTabHelper::FromWebContents(web_contents)->model()->
SetMode(Mode(Mode::MODE_NTP, Mode::ORIGIN_NTP, false));
EXPECT_TRUE(browser()->search_model()->mode().is_ntp());
@@ -39,14 +40,14 @@ TEST_F(SearchDelegateTest, SearchModel) {
// Add second tab, make it active, and make sure its mode changes
// propagate to the browser's search model.
AddTab(browser(), GURL("http://foo/1"));
- chrome::ActivateTabAt(browser(), 1, true);
- web_contents = chrome::GetWebContentsAt(browser(), 1);
+ browser()->tab_strip_model()->ActivateTabAt(1, true);
+ web_contents = browser()->tab_strip_model()->GetWebContentsAt(1);
chrome::search::SearchTabHelper::FromWebContents(web_contents)->model()->
SetMode(Mode(Mode::MODE_SEARCH_RESULTS, Mode::ORIGIN_DEFAULT, false));
EXPECT_TRUE(browser()->search_model()->mode().is_search());
// The first tab is not active so changes should not propagate.
- web_contents = chrome::GetWebContentsAt(browser(), 0);
+ web_contents = browser()->tab_strip_model()->GetWebContentsAt(0);
chrome::search::SearchTabHelper::FromWebContents(web_contents)->model()->
SetMode(Mode(Mode::MODE_NTP, Mode::ORIGIN_NTP, false));
EXPECT_TRUE(browser()->search_model()->mode().is_search());
diff --git a/chrome/browser/ui/startup/startup_browser_creator_impl.cc b/chrome/browser/ui/startup/startup_browser_creator_impl.cc
index 14e9721..9b15eba 100644
--- a/chrome/browser/ui/startup/startup_browser_creator_impl.cc
+++ b/chrome/browser/ui/startup/startup_browser_creator_impl.cc
@@ -877,7 +877,7 @@ Browser* StartupBrowserCreatorImpl::OpenTabsInBrowser(Browser* browser,
if (!browser->tab_count())
chrome::AddBlankTabAt(browser, -1, true);
else
- chrome::ActivateTabAt(browser, 0, false);
+ browser->tab_strip_model()->ActivateTabAt(0, false);
}
// The default behaviour is to show the window, as expressed by the default
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 df5a8d2..c12f8a3 100644
--- a/chrome/browser/ui/views/find_bar_host_interactive_uitest.cc
+++ b/chrome/browser/ui/views/find_bar_host_interactive_uitest.cc
@@ -95,7 +95,7 @@ IN_PROC_BROWSER_TEST_F(FindInPageTest, MAYBE_CrashEscHandlers) {
VIEW_ID_FIND_IN_PAGE_TEXT_FIELD));
// Select tab A.
- chrome::ActivateTabAt(browser(), 0, true);
+ browser()->tab_strip_model()->ActivateTabAt(0, true);
// Close tab B.
chrome::CloseWebContents(browser(), chrome::GetWebContentsAt(browser(), 1));
@@ -210,13 +210,13 @@ IN_PROC_BROWSER_TEST_F(FindInPageTest, MAYBE_FocusRestoreOnTabSwitch) {
location_bar_focus_view_id_));
// Select tab A. Find bar should get focus.
- chrome::ActivateTabAt(browser(), 0, true);
+ browser()->tab_strip_model()->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.
- chrome::ActivateTabAt(browser(), 1, true);
+ browser()->tab_strip_model()->ActivateTabAt(1, true);
EXPECT_TRUE(ui_test_utils::IsViewFocused(browser(),
location_bar_focus_view_id_));
}
diff --git a/chrome/browser/ui/webui/bookmarks_ui_browsertest.cc b/chrome/browser/ui/webui/bookmarks_ui_browsertest.cc
index aa22ba7..85cbf74 100644
--- a/chrome/browser/ui/webui/bookmarks_ui_browsertest.cc
+++ b/chrome/browser/ui/webui/bookmarks_ui_browsertest.cc
@@ -6,8 +6,8 @@
#include "base/test/test_timeouts.h"
#include "chrome/browser/ui/browser.h"
-#include "chrome/browser/ui/browser_tabstrip.h"
#include "chrome/browser/ui/chrome_pages.h"
+#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/common/url_constants.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "chrome/test/base/ui_test_utils.h"
@@ -45,16 +45,16 @@ class BookmarksTest : public InProcessBrowserTest {
IN_PROC_BROWSER_TEST_F(BookmarksTest, ShouldRedirectToExtension) {
ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUIBookmarksURL));
- AssertIsBookmarksPage(chrome::GetActiveWebContents(browser()));
+ AssertIsBookmarksPage(browser()->tab_strip_model()->GetActiveWebContents());
}
IN_PROC_BROWSER_TEST_F(BookmarksTest, CommandOpensBookmarksTab) {
- ASSERT_EQ(1, browser()->tab_count());
+ ASSERT_EQ(1, browser()->tab_strip_model()->count());
// Bring up the bookmarks manager tab.
OpenBookmarksManager();
- ASSERT_EQ(1, browser()->tab_count());
- AssertIsBookmarksPage(chrome::GetActiveWebContents(browser()));
+ ASSERT_EQ(1, browser()->tab_strip_model()->count());
+ AssertIsBookmarksPage(browser()->tab_strip_model()->GetActiveWebContents());
}
// If this flakes on Mac, use: http://crbug.com/87200
@@ -63,21 +63,21 @@ IN_PROC_BROWSER_TEST_F(BookmarksTest, CommandAgainGoesBackToBookmarksTab) {
browser(),
ui_test_utils::GetTestUrl(FilePath(),
FilePath().AppendASCII("simple.html")));
- ASSERT_EQ(1, browser()->tab_count());
+ ASSERT_EQ(1, browser()->tab_strip_model()->count());
// Bring up the bookmarks manager tab.
OpenBookmarksManager();
- ASSERT_EQ(2, browser()->tab_count());
+ ASSERT_EQ(2, browser()->tab_strip_model()->count());
- AssertIsBookmarksPage(chrome::GetActiveWebContents(browser()));
+ AssertIsBookmarksPage(browser()->tab_strip_model()->GetActiveWebContents());
// Switch to first tab and run command again.
- chrome::ActivateTabAt(browser(), 0, true);
+ browser()->tab_strip_model()->ActivateTabAt(0, true);
chrome::ShowBookmarkManager(browser());
// Ensure the bookmarks ui tab is active.
- ASSERT_EQ(1, browser()->active_index());
- ASSERT_EQ(2, browser()->tab_count());
+ ASSERT_EQ(1, browser()->tab_strip_model()->active_index());
+ ASSERT_EQ(2, browser()->tab_strip_model()->count());
}
IN_PROC_BROWSER_TEST_F(BookmarksTest, TwoCommandsOneTab) {
@@ -92,6 +92,6 @@ IN_PROC_BROWSER_TEST_F(BookmarksTest, TwoCommandsOneTab) {
IN_PROC_BROWSER_TEST_F(BookmarksTest, BookmarksLoaded) {
ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUIBookmarksURL));
- ASSERT_EQ(1, browser()->tab_count());
- AssertIsBookmarksPage(chrome::GetActiveWebContents(browser()));
+ ASSERT_EQ(1, browser()->tab_strip_model()->count());
+ AssertIsBookmarksPage(browser()->tab_strip_model()->GetActiveWebContents());
}
diff --git a/chrome/browser/ui/webui/feedback_ui.cc b/chrome/browser/ui/webui/feedback_ui.cc
index 7b1ec4b..5023b7d 100644
--- a/chrome/browser/ui/webui/feedback_ui.cc
+++ b/chrome/browser/ui/webui/feedback_ui.cc
@@ -28,11 +28,11 @@
#include "chrome/browser/signin/signin_manager_factory.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_finder.h"
-#include "chrome/browser/ui/browser_tabstrip.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/chrome_pages.h"
#include "chrome/browser/ui/singleton_tabs.h"
#include "chrome/browser/ui/tab_contents/tab_contents.h"
+#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/browser/ui/webui/chrome_url_data_manager.h"
#include "chrome/browser/ui/webui/chrome_web_ui_data_source.h"
#include "chrome/browser/ui/webui/screenshot_source.h"
@@ -169,7 +169,7 @@ std::string GetUserEmail() {
int GetIndexOfFeedbackTab(Browser* browser) {
GURL feedback_url(chrome::kChromeUIFeedbackURL);
for (int i = 0; i < browser->tab_count(); ++i) {
- WebContents* tab = chrome::GetWebContentsAt(browser, i);
+ WebContents* tab = browser->tab_strip_model()->GetWebContentsAt(i);
if (tab && tab->GetURL().GetWithEmptyPath() == feedback_url)
return i;
}
@@ -194,11 +194,11 @@ void ShowFeedbackPage(Browser* browser,
// First check if we're already open (we cannot depend on ShowSingletonTab
// for this functionality since we need to make *sure* we never get
// instantiated again while we are open - with singleton tabs, that can
- // happen)
+ // happen).
int feedback_tab_index = GetIndexOfFeedbackTab(browser);
if (feedback_tab_index >= 0) {
- // Do not refresh screenshot, do not create a new tab
- chrome::ActivateTabAt(browser, feedback_tab_index, true);
+ // Do not refresh screenshot, do not create a new tab.
+ browser->tab_strip_model()->ActivateTabAt(feedback_tab_index, true);
return;
}
@@ -451,7 +451,8 @@ bool FeedbackHandler::Init() {
return false;
if (index >= 0) {
- WebContents* target_tab = chrome::GetWebContentsAt(browser, index);
+ WebContents* target_tab =
+ browser->tab_strip_model()->GetWebContentsAt(index);
if (target_tab)
target_tab_url_ = target_tab->GetURL().spec();
}
diff --git a/chrome/browser/ui/webui/ntp/new_tab_ui_browsertest.cc b/chrome/browser/ui/webui/ntp/new_tab_ui_browsertest.cc
index a1b905f..08faa20 100644
--- a/chrome/browser/ui/webui/ntp/new_tab_ui_browsertest.cc
+++ b/chrome/browser/ui/webui/ntp/new_tab_ui_browsertest.cc
@@ -5,7 +5,7 @@
#include "base/command_line.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_commands.h"
-#include "chrome/browser/ui/browser_tabstrip.h"
+#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/url_constants.h"
#include "chrome/test/base/in_process_browser_test.h"
@@ -34,7 +34,8 @@ IN_PROC_BROWSER_TEST_F(NewTabUIBrowserTest, ChromeInternalLoadsNTP) {
ui_test_utils::NavigateToURL(browser(), GURL("chrome-internal:"));
bool empty_inner_html = false;
ASSERT_TRUE(content::ExecuteJavaScriptAndExtractBool(
- chrome::GetWebContentsAt(browser(), 0)->GetRenderViewHost(), L"",
+ browser()->tab_strip_model()->GetWebContentsAt(0)->GetRenderViewHost(),
+ L"",
L"window.domAutomationController.send(document.body.innerHTML == '')",
&empty_inner_html));
ASSERT_FALSE(empty_inner_html);
@@ -53,7 +54,8 @@ IN_PROC_BROWSER_TEST_F(NewTabUIBrowserTest, LoadNTPInExistingProcess) {
ui_test_utils::NavigateToURLWithDisposition(
browser(), GURL(chrome::kChromeUINewTabURL), NEW_FOREGROUND_TAB,
ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION);
- EXPECT_EQ(1, chrome::GetWebContentsAt(browser(), 1)->GetMaxPageID());
+ EXPECT_EQ(1,
+ browser()->tab_strip_model()->GetWebContentsAt(1)->GetMaxPageID());
// Navigate that tab to another site. This allows the NTP process to exit,
// but it keeps the NTP SiteInstance (and its max_page_id) alive in history.
@@ -74,27 +76,31 @@ IN_PROC_BROWSER_TEST_F(NewTabUIBrowserTest, LoadNTPInExistingProcess) {
ui_test_utils::NavigateToURLWithDisposition(
browser(), GURL(chrome::kChromeUINewTabURL), NEW_FOREGROUND_TAB,
ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION);
- EXPECT_EQ(1, chrome::GetWebContentsAt(browser(), 2)->GetMaxPageID());
+ EXPECT_EQ(1,
+ browser()->tab_strip_model()->GetWebContentsAt(2)->GetMaxPageID());
chrome::CloseTab(browser());
// Open another Web UI page in a new tab.
ui_test_utils::NavigateToURLWithDisposition(
browser(), GURL(chrome::kChromeUISettingsURL), NEW_FOREGROUND_TAB,
ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION);
- EXPECT_EQ(1, chrome::GetWebContentsAt(browser(), 2)->GetMaxPageID());
+ EXPECT_EQ(1,
+ browser()->tab_strip_model()->GetWebContentsAt(2)->GetMaxPageID());
// At this point, opening another NTP will use the existing WebUI process
// but its own SiteInstance, so the page IDs shouldn't affect each other.
ui_test_utils::NavigateToURLWithDisposition(
browser(), GURL(chrome::kChromeUINewTabURL), NEW_FOREGROUND_TAB,
ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION);
- EXPECT_EQ(1, chrome::GetWebContentsAt(browser(), 3)->GetMaxPageID());
+ EXPECT_EQ(1,
+ browser()->tab_strip_model()->GetWebContentsAt(3)->GetMaxPageID());
// Navigating to the NTP in the original tab causes a BrowsingInstance
// swap, so it gets a new SiteInstance starting with page ID 1 again.
- chrome::ActivateTabAt(browser(), 1, true);
+ browser()->tab_strip_model()->ActivateTabAt(1, true);
ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUINewTabURL));
- EXPECT_EQ(1, chrome::GetWebContentsAt(browser(), 1)->GetMaxPageID());
+ EXPECT_EQ(1,
+ browser()->tab_strip_model()->GetWebContentsAt(1)->GetMaxPageID());
}
// Loads chrome://hang/ into two NTP tabs, ensuring we don't crash.
diff --git a/chrome/test/ppapi/ppapi_browsertest.cc b/chrome/test/ppapi/ppapi_browsertest.cc
index 94f2a97..f1f3cc5 100644
--- a/chrome/test/ppapi/ppapi_browsertest.cc
+++ b/chrome/test/ppapi/ppapi_browsertest.cc
@@ -10,7 +10,7 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_navigator.h"
-#include "chrome/browser/ui/browser_tabstrip.h"
+#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/test/base/javascript_test_observer.h"
#include "chrome/test/base/ui_test_utils.h"
#include "content/public/browser/web_contents.h"
@@ -807,7 +807,7 @@ IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, View_PageHideShow) {
// The plugin will be loaded in the foreground tab and will send us a message.
PPAPITestMessageHandler handler;
JavascriptTestObserver observer(
- chrome::GetActiveWebContents(browser())->GetRenderViewHost(),
+ browser()->tab_strip_model()->GetActiveWebContents()->GetRenderViewHost(),
&handler);
GURL url = GetTestFileUrl("View_PageHideShow");
@@ -830,7 +830,7 @@ IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, View_PageHideShow) {
observer.Reset();
// Switch back to the test tab.
- chrome::ActivateTabAt(browser(), 0, true);
+ browser()->tab_strip_model()->ActivateTabAt(0, true);
ASSERT_TRUE(observer.Run()) << handler.error_message();
EXPECT_STREQ("PASS", handler.message().c_str());
@@ -846,8 +846,8 @@ IN_PROC_BROWSER_TEST_F(PPAPITest, InputEvent_AcceptTouchEvent) {
};
for (size_t i = 0; i < arraysize(positive_tests); ++i) {
- RenderViewHost* host = chrome::GetActiveWebContents(browser())->
- GetRenderViewHost();
+ RenderViewHost* host = browser()->tab_strip_model()->
+ GetActiveWebContents()->GetRenderViewHost();
RunTest(positive_tests[i]);
EXPECT_TRUE(content::RenderViewHostTester::HasTouchEventHandler(host));
}