summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/captive_portal/captive_portal_tab_helper.cc2
-rw-r--r--chrome/browser/chromeos/boot_times_loader.cc8
-rw-r--r--chrome/browser/metro_viewer/metro_viewer_process_host_win.cc2
-rw-r--r--chrome/browser/sessions/session_service.cc11
-rw-r--r--chrome/browser/ui/bookmarks/bookmark_utils.cc6
-rw-r--r--chrome/browser/ui/browser.cc4
-rw-r--r--chrome/browser/ui/browser.h1
-rw-r--r--chrome/browser/ui/cocoa/applescript/window_applescript.mm9
-rw-r--r--chrome/browser/ui/cocoa/bookmarks/bookmark_all_tabs_controller.mm4
-rw-r--r--chrome/browser/ui/cocoa/constrained_window/constrained_window_mac_browsertest.mm9
-rw-r--r--chrome/browser/ui/gtk/browser_titlebar.cc2
-rw-r--r--chrome/browser/ui/intents/web_intent_picker_controller_browsertest.cc59
-rw-r--r--chrome/browser/ui/omnibox/omnibox_view_browsertest.cc12
-rw-r--r--chrome/browser/ui/startup/session_crashed_prompt.cc5
-rw-r--r--chrome/browser/ui/startup/startup_browser_creator_browsertest.cc28
15 files changed, 85 insertions, 77 deletions
diff --git a/chrome/browser/captive_portal/captive_portal_tab_helper.cc b/chrome/browser/captive_portal/captive_portal_tab_helper.cc
index a735f8e..c5c8b8c 100644
--- a/chrome/browser/captive_portal/captive_portal_tab_helper.cc
+++ b/chrome/browser/captive_portal/captive_portal_tab_helper.cc
@@ -251,7 +251,7 @@ void CaptivePortalTabHelper::OpenLoginTab() {
// If so, do nothing.
// TODO(mmenke): Consider focusing that tab, at least if this is the tab
// helper for the currently active tab for the profile.
- for (int i = 0; i < browser->tab_count(); ++i) {
+ for (int i = 0; i < browser->tab_strip_model()->count(); ++i) {
content::WebContents* web_contents =
browser->tab_strip_model()->GetWebContentsAt(i);
captive_portal::CaptivePortalTabHelper* captive_portal_tab_helper =
diff --git a/chrome/browser/chromeos/boot_times_loader.cc b/chrome/browser/chromeos/boot_times_loader.cc
index 4aac9e2..f1038beb 100644
--- a/chrome/browser/chromeos/boot_times_loader.cc
+++ b/chrome/browser/chromeos/boot_times_loader.cc
@@ -26,7 +26,7 @@
#include "chrome/browser/chromeos/login/authentication_notification_details.h"
#include "chrome/browser/ui/browser.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/chrome_notification_types.h"
#include "chrome/common/chrome_switches.h"
#include "content/public/browser/browser_thread.h"
@@ -60,8 +60,10 @@ const std::string GetTabUrl(RenderWidgetHost* rwh) {
it != BrowserList::end();
++it) {
Browser* browser = *it;
- for (int i = 0, tab_count = browser->tab_count(); i < tab_count; ++i) {
- WebContents* tab = chrome::GetWebContentsAt(browser, i);
+ for (int i = 0, tab_count = browser->tab_strip_model()->count();
+ i < tab_count;
+ ++i) {
+ WebContents* tab = browser->tab_strip_model()->GetWebContentsAt(i);
if (tab->GetRenderWidgetHostView() == rwhv) {
return tab->GetURL().spec();
}
diff --git a/chrome/browser/metro_viewer/metro_viewer_process_host_win.cc b/chrome/browser/metro_viewer/metro_viewer_process_host_win.cc
index 1659ad3..c0e8a6b 100644
--- a/chrome/browser/metro_viewer/metro_viewer_process_host_win.cc
+++ b/chrome/browser/metro_viewer/metro_viewer_process_host_win.cc
@@ -31,7 +31,7 @@ void CloseOpenAshBrowsers() {
browser->window()->Close();
// If the attempt to Close the browser fails due to unload handlers on
// the page or in progress downloads, etc, destroy all tabs on the page.
- while (browser->tab_count())
+ while (browser->tab_strip_model()->count())
delete browser->tab_strip_model()->GetWebContentsAt(0);
}
}
diff --git a/chrome/browser/sessions/session_service.cc b/chrome/browser/sessions/session_service.cc
index 982bc83..368249d 100644
--- a/chrome/browser/sessions/session_service.cc
+++ b/chrome/browser/sessions/session_service.cc
@@ -1361,11 +1361,12 @@ void SessionService::BuildCommandsForBrowser(
}
windows_to_track->insert(browser->session_id().id());
- for (int i = 0; i < browser->tab_count(); ++i) {
- WebContents* tab = chrome::GetWebContentsAt(browser, i);
+ TabStripModel* tab_strip = browser->tab_strip_model();
+ for (int i = 0; i < tab_strip->count(); ++i) {
+ WebContents* tab = tab_strip->GetWebContentsAt(i);
DCHECK(tab);
BuildCommandsForTab(browser->session_id(), tab, i,
- browser->tab_strip_model()->IsTabPinned(i),
+ tab_strip->IsTabPinned(i),
commands, tab_to_available_range);
}
@@ -1388,7 +1389,7 @@ void SessionService::BuildCommandsFromBrowsers(
// for us to get a handle to a browser that is about to be removed. If
// the tab count is 0 or the window is NULL, the browser is about to be
// deleted, so we ignore it.
- if (ShouldTrackBrowser(browser) && browser->tab_count() &&
+ if (ShouldTrackBrowser(browser) && browser->tab_strip_model()->count() &&
browser->window()) {
BuildCommandsForBrowser(browser, commands, tab_to_available_range,
windows_to_track);
@@ -1513,7 +1514,7 @@ bool SessionService::IsOnlyOneTabLeft() const {
return false;
// By the time this is invoked the tab has been removed. As such, we use
// > 0 here rather than > 1.
- if ((*i)->tab_count() > 0)
+ if ((*i)->tab_strip_model()->count() > 0)
return false;
}
}
diff --git a/chrome/browser/ui/bookmarks/bookmark_utils.cc b/chrome/browser/ui/bookmarks/bookmark_utils.cc
index e9d5cad..c7883cc 100644
--- a/chrome/browser/ui/bookmarks/bookmark_utils.cc
+++ b/chrome/browser/ui/bookmarks/bookmark_utils.cc
@@ -14,9 +14,9 @@
#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/browser_window.h"
#include "chrome/browser/ui/simple_message_box.h"
+#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/common/pref_names.h"
#include "content/public/browser/web_contents.h"
#include "grit/chromium_strings.h"
@@ -127,9 +127,9 @@ int ChildURLCountTotal(const BookmarkNode* node) {
// Returns in |urls|, the url and title pairs for each open tab in browser.
void GetURLsForOpenTabs(Browser* browser,
std::vector<std::pair<GURL, string16> >* urls) {
- for (int i = 0; i < browser->tab_count(); ++i) {
+ for (int i = 0; i < browser->tab_strip_model()->count(); ++i) {
std::pair<GURL, string16> entry;
- GetURLAndTitleToBookmark(GetWebContentsAt(browser, i),
+ GetURLAndTitleToBookmark(browser->tab_strip_model()->GetWebContentsAt(i),
&(entry.first), &(entry.second));
urls->push_back(entry);
}
diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc
index fedf4f1..073af7b 100644
--- a/chrome/browser/ui/browser.cc
+++ b/chrome/browser/ui/browser.cc
@@ -754,10 +754,6 @@ Browser::DownloadClosePreventionType Browser::OkToCloseWithInProgressDownloads(
////////////////////////////////////////////////////////////////////////////////
// Browser, TabStripModel pass-thrus:
-int Browser::tab_count() const {
- return tab_strip_model_->count();
-}
-
int Browser::active_index() const {
return tab_strip_model_->active_index();
}
diff --git a/chrome/browser/ui/browser.h b/chrome/browser/ui/browser.h
index dc96831..e946691 100644
--- a/chrome/browser/ui/browser.h
+++ b/chrome/browser/ui/browser.h
@@ -330,7 +330,6 @@ class Browser : public TabStripModelObserver,
TabStripModel* tab_strip_model() const { return tab_strip_model_.get(); }
- int tab_count() const;
int active_index() const;
// Invoked when the fullscreen state of the window changes.
diff --git a/chrome/browser/ui/cocoa/applescript/window_applescript.mm b/chrome/browser/ui/cocoa/applescript/window_applescript.mm
index 3a43efc..1d42f15 100644
--- a/chrome/browser/ui/cocoa/applescript/window_applescript.mm
+++ b/chrome/browser/ui/cocoa/applescript/window_applescript.mm
@@ -146,13 +146,12 @@
}
- (NSArray*)tabs {
- NSMutableArray* tabs = [NSMutableArray
- arrayWithCapacity:browser_->tab_count()];
+ TabStripModel* tabStrip = browser_->tab_strip_model();
+ NSMutableArray* tabs = [NSMutableArray arrayWithCapacity:tabStrip->count()];
- for (int i = 0; i < browser_->tab_count(); ++i) {
+ for (int i = 0; i < tabStrip->count(); ++i) {
// Check to see if tab is closing.
- content::WebContents* webContents =
- browser_->tab_strip_model()->GetWebContentsAt(i);
+ content::WebContents* webContents = tabStrip->GetWebContentsAt(i);
if (webContents->IsBeingDestroyed()) {
continue;
}
diff --git a/chrome/browser/ui/cocoa/bookmarks/bookmark_all_tabs_controller.mm b/chrome/browser/ui/cocoa/bookmarks/bookmark_all_tabs_controller.mm
index c625595..3982b60 100644
--- a/chrome/browser/ui/cocoa/bookmarks/bookmark_all_tabs_controller.mm
+++ b/chrome/browser/ui/cocoa/bookmarks/bookmark_all_tabs_controller.mm
@@ -48,9 +48,9 @@ using content::WebContents;
- (void)UpdateActiveTabPairs {
activeTabPairsVector_.clear();
Browser* browser = chrome::GetLastActiveBrowser();
- const int tabCount = browser->tab_count();
+ const int tabCount = browser->tab_strip_model()->count();
for (int i = 0; i < tabCount; ++i) {
- WebContents* contents = chrome::GetWebContentsAt(browser, i);
+ WebContents* contents = browser->tab_strip_model()->GetWebContentsAt(i);
ActiveTabNameURLPair tabPair(contents->GetTitle(), contents->GetURL());
activeTabPairsVector_.push_back(tabPair);
}
diff --git a/chrome/browser/ui/cocoa/constrained_window/constrained_window_mac_browsertest.mm b/chrome/browser/ui/cocoa/constrained_window/constrained_window_mac_browsertest.mm
index 77b413e..dea4878 100644
--- a/chrome/browser/ui/cocoa/constrained_window/constrained_window_mac_browsertest.mm
+++ b/chrome/browser/ui/cocoa/constrained_window/constrained_window_mac_browsertest.mm
@@ -149,10 +149,11 @@ IN_PROC_BROWSER_TEST_F(ConstrainedWindowMacTest, TabClose) {
EXPECT_EQ(1.0, [sheet_window_ alphaValue]);
// Close the tab.
- EXPECT_EQ(2, browser()->tab_count());
- EXPECT_TRUE(browser()->tab_strip_model()->CloseWebContentsAt(
- 1, TabStripModel::CLOSE_USER_GESTURE));
- EXPECT_EQ(1, browser()->tab_count());
+ TabStripModel* tab_strip = browser()->tab_strip_model();
+ EXPECT_EQ(2, tab_strip->count());
+ EXPECT_TRUE(tab_strip->CloseWebContentsAt(1,
+ TabStripModel::CLOSE_USER_GESTURE));
+ EXPECT_EQ(1, tab_strip->count());
}
// Test that adding a sheet disables fullscreen.
diff --git a/chrome/browser/ui/gtk/browser_titlebar.cc b/chrome/browser/ui/gtk/browser_titlebar.cc
index 186977e..4dbcfe1 100644
--- a/chrome/browser/ui/gtk/browser_titlebar.cc
+++ b/chrome/browser/ui/gtk/browser_titlebar.cc
@@ -879,7 +879,7 @@ gboolean BrowserTitlebar::OnScroll(GtkWidget* widget, GdkEventScroll* event) {
event->direction == GDK_SCROLL_UP) {
if (index != 0)
chrome::SelectPreviousTab(browser);
- } else if (index + 1 < browser->tab_count()) {
+ } else if (index + 1 < browser->tab_strip_model()->count()) {
chrome::SelectNextTab(browser);
}
return TRUE;
diff --git a/chrome/browser/ui/intents/web_intent_picker_controller_browsertest.cc b/chrome/browser/ui/intents/web_intent_picker_controller_browsertest.cc
index 8d5b45e..4ef912e 100644
--- a/chrome/browser/ui/intents/web_intent_picker_controller_browsertest.cc
+++ b/chrome/browser/ui/intents/web_intent_picker_controller_browsertest.cc
@@ -19,11 +19,11 @@
#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/intents/web_intent_picker.h"
#include "chrome/browser/ui/intents/web_intent_picker_controller.h"
#include "chrome/browser/ui/intents/web_intent_picker_model.h"
#include "chrome/browser/ui/intents/web_intent_picker_model_observer.h"
+#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/browser/webdata/web_data_service.h"
#include "chrome/browser/webdata/web_data_service_factory.h"
#include "chrome/common/chrome_notification_types.h"
@@ -250,7 +250,7 @@ class WebIntentPickerControllerBrowserTest : public InProcessBrowserTest {
favicon_service_ = FaviconServiceFactory::GetForProfile(
GetBrowser()->profile(), Profile::EXPLICIT_ACCESS);
controller_ = WebIntentPickerController::FromWebContents(
- chrome::GetActiveWebContents(GetBrowser()));
+ GetBrowser()->tab_strip_model()->GetActiveWebContents());
SetupMockPicker();
controller_->set_model_observer(&picker_);
@@ -383,20 +383,21 @@ IN_PROC_BROWSER_TEST_F(WebIntentPickerControllerBrowserTest, ChooseService) {
EXPECT_EQ(2, picker_.num_installed_services_);
EXPECT_EQ(0, picker_.num_icons_changed_);
+ TabStripModel* tab_strip = browser()->tab_strip_model();
OnServiceChosen(kServiceURL2,
webkit_glue::WebIntentServiceData::DISPOSITION_WINDOW);
- ASSERT_EQ(2, browser()->tab_count());
+ ASSERT_EQ(2, tab_strip->count());
EXPECT_EQ(GURL(kServiceURL2),
- chrome::GetActiveWebContents(browser())->GetURL());
+ tab_strip->GetActiveWebContents()->GetURL());
EXPECT_TRUE(GetWindowDispositionTarget(
WebIntentPickerController::FromWebContents(
- chrome::GetActiveWebContents(browser()))));
+ tab_strip->GetActiveWebContents())));
EXPECT_TRUE(dispatcher.dispatched_);
OnSendReturnMessage(webkit_glue::WEB_INTENT_REPLY_SUCCESS);
- ASSERT_EQ(1, browser()->tab_count());
+ ASSERT_EQ(1, tab_strip->count());
}
IN_PROC_BROWSER_TEST_F(WebIntentPickerControllerBrowserTest,
@@ -446,14 +447,15 @@ IN_PROC_BROWSER_TEST_F(WebIntentPickerControllerBrowserTest,
AddWebIntentService(kAction1, kServiceURL1);
AddCWSExtensionServiceEmpty(kAction1);
- GURL original = chrome::GetActiveWebContents(browser())->GetURL();
+ TabStripModel* tab_strip = browser()->tab_strip_model();
+ GURL original = tab_strip->GetActiveWebContents()->GetURL();
// Open a new page, but keep focus on original.
ui_test_utils::NavigateToURLWithDisposition(
browser(), GURL(chrome::kChromeUINewTabURL), NEW_BACKGROUND_TAB,
ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION);
- ASSERT_EQ(2, browser()->tab_count());
- EXPECT_EQ(original, chrome::GetActiveWebContents(browser())->GetURL());
+ ASSERT_EQ(2, tab_strip->count());
+ EXPECT_EQ(original, tab_strip->GetActiveWebContents()->GetURL());
webkit_glue::WebIntentData intent;
intent.action = kAction1;
@@ -467,15 +469,15 @@ IN_PROC_BROWSER_TEST_F(WebIntentPickerControllerBrowserTest,
OnServiceChosen(kServiceURL1,
webkit_glue::WebIntentServiceData::DISPOSITION_WINDOW);
- ASSERT_EQ(3, browser()->tab_count());
+ ASSERT_EQ(3, tab_strip->count());
EXPECT_EQ(GURL(kServiceURL1),
- chrome::GetActiveWebContents(browser())->GetURL());
+ tab_strip->GetActiveWebContents()->GetURL());
EXPECT_TRUE(dispatcher.dispatched_);
OnSendReturnMessage(webkit_glue::WEB_INTENT_REPLY_SUCCESS);
- ASSERT_EQ(2, browser()->tab_count());
- EXPECT_EQ(original, chrome::GetActiveWebContents(browser())->GetURL());
+ ASSERT_EQ(2, tab_strip->count());
+ EXPECT_EQ(original, tab_strip->GetActiveWebContents()->GetURL());
CloseCurrentTab();
}
@@ -525,7 +527,8 @@ IN_PROC_BROWSER_TEST_F(WebIntentPickerControllerBrowserTest,
controller_->ShowDialog(kAction1, kType2);
picker_.Wait();
- ASSERT_EQ(1, browser()->tab_count());
+ TabStripModel* tab_strip = browser()->tab_strip_model();
+ ASSERT_EQ(1, tab_strip->count());
OnExtensionInstallRequested(extension_id);
picker_.Wait();
EXPECT_EQ(1, picker_.num_extensions_installed_);
@@ -535,7 +538,7 @@ IN_PROC_BROWSER_TEST_F(WebIntentPickerControllerBrowserTest,
// Installing an extension should also choose it. Since this extension uses
// window disposition, it will create a new tab.
- EXPECT_EQ(2, browser()->tab_count());
+ EXPECT_EQ(2, tab_strip->count());
EXPECT_EQ(0, picker_.num_inline_disposition_);
CloseCurrentTab();
@@ -566,7 +569,8 @@ IN_PROC_BROWSER_TEST_F(WebIntentPickerControllerBrowserTest,
// Installing an extension should also choose it. Since this extension uses
// inline disposition, it will create no tabs and invoke OnInlineDisposition.
- EXPECT_EQ(1, browser()->tab_count());
+ TabStripModel* tab_strip = browser()->tab_strip_model();
+ EXPECT_EQ(1, tab_strip->count());
EXPECT_EQ(1, picker_.num_inline_disposition_);
}
@@ -615,11 +619,12 @@ IN_PROC_BROWSER_TEST_F(WebIntentPickerControllerBrowserTest,
controller_->ShowDialog(kAction1, kType2);
picker_.Wait();
+ TabStripModel* tab_strip = browser()->tab_strip_model();
OnExtensionInstallRequested(extension_id);
picker_.Wait();
ASSERT_EQ(1, picker_.num_extensions_installed_);
// The intent launches a new tab.
- ASSERT_EQ(2, browser()->tab_count());
+ ASSERT_EQ(2, tab_strip->count());
// Make the controller think nothing is being shown.
picker_.MockClose();
@@ -649,7 +654,7 @@ IN_PROC_BROWSER_TEST_F(WebIntentPickerControllerBrowserTest,
DCHECK(service_controller);
EXPECT_FALSE(service_controller->ShowLocationBarPickerButton());
- EXPECT_EQ(3, browser()->tab_count());
+ EXPECT_EQ(3, tab_strip->count());
EXPECT_EQ(0, picker_.num_inline_disposition_);
EXPECT_FALSE(dispatcher2.replied_);
@@ -682,7 +687,8 @@ IN_PROC_BROWSER_TEST_F(WebIntentPickerControllerBrowserTest,
controller_->ShowDialog(kAction1, kType1);
picker_.Wait();
- EXPECT_EQ(1, browser()->tab_count());
+ TabStripModel* tab_strip = browser()->tab_strip_model();
+ EXPECT_EQ(1, tab_strip->count());
EXPECT_EQ(0, picker_.num_inline_disposition_);
EXPECT_TRUE(dispatcher.replied_);
@@ -706,7 +712,8 @@ IN_PROC_BROWSER_TEST_F(WebIntentPickerControllerBrowserTest,
controller_->ShowDialog(kAction1, kType1);
picker_.Wait();
- EXPECT_EQ(1, browser()->tab_count());
+ TabStripModel* tab_strip = browser()->tab_strip_model();
+ EXPECT_EQ(1, tab_strip->count());
EXPECT_EQ(0, picker_.num_inline_disposition_);
// num_installed_services_ would be 2 if the intent wasn't explicit.
@@ -739,9 +746,10 @@ IN_PROC_BROWSER_TEST_F(WebIntentPickerControllerBrowserTest,
EXPECT_EQ(2, picker_.num_installed_services_);
// The tab is shown immediately without needing to call OnServiceChosen.
- ASSERT_EQ(2, browser()->tab_count());
+ TabStripModel* tab_strip = browser()->tab_strip_model();
+ ASSERT_EQ(2, tab_strip->count());
EXPECT_EQ(GURL(kServiceURL1),
- chrome::GetActiveWebContents(browser())->GetURL());
+ tab_strip->GetActiveWebContents()->GetURL());
EXPECT_TRUE(dispatcher.dispatched_);
@@ -773,9 +781,10 @@ IN_PROC_BROWSER_TEST_F(WebIntentPickerControllerBrowserTest,
EXPECT_EQ(2, picker_.num_installed_services_);
// The tab is shown immediately without needing to call OnServiceChosen.
- ASSERT_EQ(2, browser()->tab_count());
+ TabStripModel* tab_strip = browser()->tab_strip_model();
+ ASSERT_EQ(2, tab_strip->count());
EXPECT_EQ(GURL(kServiceURL1),
- chrome::GetActiveWebContents(browser())->GetURL());
+ tab_strip->GetActiveWebContents()->GetURL());
// Simulate click on the location bar use-another-service button.
content::WindowedNotificationObserver observer(
@@ -791,7 +800,7 @@ IN_PROC_BROWSER_TEST_F(WebIntentPickerControllerBrowserTest,
// The service tab is closed and the picker is shown again
// on the original tab.
- EXPECT_EQ(1, browser()->tab_count());
+ EXPECT_EQ(1, tab_strip->count());
EXPECT_EQ(2, picker_.num_installed_services_);
EXPECT_EQ(0, picker_.num_inline_disposition_);
}
diff --git a/chrome/browser/ui/omnibox/omnibox_view_browsertest.cc b/chrome/browser/ui/omnibox/omnibox_view_browsertest.cc
index ad93102..f7c5e46 100644
--- a/chrome/browser/ui/omnibox/omnibox_view_browsertest.cc
+++ b/chrome/browser/ui/omnibox/omnibox_view_browsertest.cc
@@ -229,7 +229,7 @@ class OmniboxViewTest : public InProcessBrowserTest,
void WaitForTabOpenOrCloseForBrowser(const Browser* browser,
int expected_tab_count) {
- int tab_count = browser->tab_count();
+ int tab_count = browser->tab_strip_model()->count();
if (tab_count == expected_tab_count)
return;
@@ -240,10 +240,12 @@ class OmniboxViewTest : public InProcessBrowserTest,
static_cast<int>(content::NOTIFICATION_WEB_CONTENTS_DESTROYED),
content::NotificationService::AllSources());
- while (!HasFailure() && browser->tab_count() != expected_tab_count)
+ while (!HasFailure() &&
+ browser->tab_strip_model()->count() != expected_tab_count) {
content::RunMessageLoop();
+ }
- ASSERT_EQ(expected_tab_count, browser->tab_count());
+ ASSERT_EQ(expected_tab_count, browser->tab_strip_model()->count());
}
void WaitForTabOpenOrClose(int expected_tab_count) {
@@ -393,7 +395,7 @@ class OmniboxViewTest : public InProcessBrowserTest,
OmniboxView* omnibox_view = NULL;
ASSERT_NO_FATAL_FAILURE(GetOmniboxView(&omnibox_view));
- int tab_count = browser()->tab_count();
+ int tab_count = browser()->tab_strip_model()->count();
// Create a new Tab.
chrome::NewTab(browser());
@@ -599,7 +601,7 @@ class OmniboxViewTest : public InProcessBrowserTest,
ASSERT_NO_FATAL_FAILURE(GetOmniboxView(&omnibox_view));
omnibox_view->SetUserText(ASCIIToUTF16(chrome::kChromeUIHistoryURL));
- int tab_count = browser()->tab_count();
+ int tab_count = browser()->tab_strip_model()->count();
// alt-Enter opens a new tab.
ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_RETURN, ui::EF_ALT_DOWN));
ASSERT_NO_FATAL_FAILURE(WaitForTabOpenOrClose(tab_count + 1));
diff --git a/chrome/browser/ui/startup/session_crashed_prompt.cc b/chrome/browser/ui/startup/session_crashed_prompt.cc
index a918d0c..ebb64de 100644
--- a/chrome/browser/ui/startup/session_crashed_prompt.cc
+++ b/chrome/browser/ui/startup/session_crashed_prompt.cc
@@ -9,7 +9,6 @@
#include "chrome/browser/sessions/session_restore.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/tabs/tab_strip_model.h"
#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/url_constants.h"
@@ -87,8 +86,8 @@ string16 SessionCrashedInfoBarDelegate::GetButtonLabel(
bool SessionCrashedInfoBarDelegate::Accept() {
uint32 behavior = 0;
- if (browser_->tab_count() == 1 &&
- chrome::GetWebContentsAt(browser_, 0)->GetURL() ==
+ if (browser_->tab_strip_model()->count() == 1 &&
+ browser_->tab_strip_model()->GetWebContentsAt(0)->GetURL() ==
GURL(chrome::kChromeUINewTabURL)) {
// There is only one tab and its the new tab page, make session restore
// clobber it.
diff --git a/chrome/browser/ui/startup/startup_browser_creator_browsertest.cc b/chrome/browser/ui/startup/startup_browser_creator_browsertest.cc
index 0e8df4bf..16d183b 100644
--- a/chrome/browser/ui/startup/startup_browser_creator_browsertest.cc
+++ b/chrome/browser/ui/startup/startup_browser_creator_browsertest.cc
@@ -192,7 +192,7 @@ IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest,
// The new browser should have one tab for each URL.
TabStripModel* tab_strip = new_browser->tab_strip_model();
- ASSERT_EQ(static_cast<int>(urls.size()), new_browser->tab_count());
+ ASSERT_EQ(static_cast<int>(urls.size()), tab_strip->count());
for (size_t i=0; i < urls.size(); i++) {
EXPECT_EQ(urls[i], tab_strip->GetWebContentsAt(i)->GetURL());
}
@@ -234,7 +234,7 @@ IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest,
ASSERT_NO_FATAL_FAILURE(FindOneOtherBrowser(&new_browser));
// The new browser should have exactly one tab (not the startup URLs).
- ASSERT_EQ(1, new_browser->tab_count());
+ ASSERT_EQ(1, new_browser->tab_strip_model()->count());
}
// App shortcuts are not implemented on mac os.
@@ -373,9 +373,9 @@ IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, AddFirstRunTab) {
Browser* new_browser = NULL;
ASSERT_NO_FATAL_FAILURE(FindOneOtherBrowser(&new_browser));
- EXPECT_EQ(2, new_browser->tab_count());
-
TabStripModel* tab_strip = new_browser->tab_strip_model();
+ EXPECT_EQ(2, tab_strip->count());
+
EXPECT_EQ("title1.html",
tab_strip->GetWebContentsAt(0)->GetURL().ExtractFileName());
EXPECT_EQ("title2.html",
@@ -401,9 +401,9 @@ IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, AddCustomFirstRunTab) {
Browser* new_browser = NULL;
ASSERT_NO_FATAL_FAILURE(FindOneOtherBrowser(&new_browser));
- EXPECT_EQ(4, new_browser->tab_count());
-
TabStripModel* tab_strip = new_browser->tab_strip_model();
+ EXPECT_EQ(4, tab_strip->count());
+
EXPECT_EQ("title1.html",
tab_strip->GetWebContentsAt(0)->GetURL().ExtractFileName());
EXPECT_EQ(GURL(chrome::kChromeUINewTabURL),
@@ -430,9 +430,9 @@ IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, SyncPromoNoWelcomePage) {
Browser* new_browser = NULL;
ASSERT_NO_FATAL_FAILURE(FindOneOtherBrowser(&new_browser));
- EXPECT_EQ(1, new_browser->tab_count());
-
TabStripModel* tab_strip = new_browser->tab_strip_model();
+ EXPECT_EQ(1, tab_strip->count());
+
if (SyncPromoUI::ShouldShowSyncPromoAtStartup(browser()->profile(), true)) {
EXPECT_EQ("signin", tab_strip->GetWebContentsAt(0)->GetURL().host());
} else {
@@ -458,9 +458,9 @@ IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, SyncPromoWithWelcomePage) {
Browser* new_browser = NULL;
ASSERT_NO_FATAL_FAILURE(FindOneOtherBrowser(&new_browser));
- EXPECT_EQ(2, new_browser->tab_count());
-
TabStripModel* tab_strip = new_browser->tab_strip_model();
+ EXPECT_EQ(2, tab_strip->count());
+
if (SyncPromoUI::ShouldShowSyncPromoAtStartup(browser()->profile(), true)) {
EXPECT_EQ("signin", tab_strip->GetWebContentsAt(0)->GetURL().host());
} else {
@@ -498,12 +498,12 @@ IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, SyncPromoWithFirstRunTabs) {
TabStripModel* tab_strip = new_browser->tab_strip_model();
if (SyncPromoUI::ShouldShowSyncPromoAtStartup(browser()->profile(), true)) {
- EXPECT_EQ(2, new_browser->tab_count());
+ EXPECT_EQ(2, tab_strip->count());
EXPECT_EQ("signin", tab_strip->GetWebContentsAt(0)->GetURL().host());
EXPECT_EQ("title1.html",
tab_strip->GetWebContentsAt(1)->GetURL().ExtractFileName());
} else {
- EXPECT_EQ(1, new_browser->tab_count());
+ EXPECT_EQ(1, tab_strip->count());
EXPECT_EQ("title1.html",
tab_strip->GetWebContentsAt(0)->GetURL().ExtractFileName());
}
@@ -534,14 +534,14 @@ IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest,
TabStripModel* tab_strip = new_browser->tab_strip_model();
if (SyncPromoUI::ShouldShowSyncPromoAtStartup(browser()->profile(), true)) {
- EXPECT_EQ(3, new_browser->tab_count());
+ EXPECT_EQ(3, tab_strip->count());
EXPECT_EQ("signin", tab_strip->GetWebContentsAt(0)->GetURL().host());
EXPECT_EQ("title1.html",
tab_strip->GetWebContentsAt(1)->GetURL().ExtractFileName());
EXPECT_EQ(internals::GetWelcomePageURL(),
tab_strip->GetWebContentsAt(2)->GetURL());
} else {
- EXPECT_EQ(2, new_browser->tab_count());
+ EXPECT_EQ(2, tab_strip->count());
EXPECT_EQ("title1.html",
tab_strip->GetWebContentsAt(0)->GetURL().ExtractFileName());
EXPECT_EQ(internals::GetWelcomePageURL(),