summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/automation/automation_provider_observers.cc9
-rw-r--r--chrome/browser/automation/automation_util.cc11
-rw-r--r--chrome/browser/browser_keyevents_browsertest.cc66
-rw-r--r--chrome/browser/custom_home_pages_table_model.cc7
-rw-r--r--chrome/browser/extensions/extension_install_ui_default.cc2
-rw-r--r--chrome/browser/extensions/process_management_browsertest.cc22
-rw-r--r--chrome/browser/lifetime/application_lifetime.cc2
-rw-r--r--chrome/browser/popup_blocker_browsertest.cc9
-rw-r--r--chrome/browser/sessions/tab_restore_browsertest.cc120
-rw-r--r--chrome/browser/ui/browser_browsertest.cc134
-rw-r--r--chrome/browser/ui/browser_commands.cc78
-rw-r--r--chrome/browser/ui/browser_navigator_browsertest.cc264
-rw-r--r--chrome/browser/ui/browser_navigator_browsertest_chromeos.cc11
-rw-r--r--chrome/browser/ui/browser_tab_restore_service_delegate.cc9
-rw-r--r--chrome/browser/ui/browser_tab_strip_model_delegate.cc3
-rw-r--r--chrome/browser/ui/chrome_pages.cc3
-rw-r--r--chrome/browser/ui/cocoa/browser_window_controller.mm2
-rw-r--r--chrome/browser/ui/singleton_tabs.cc5
-rw-r--r--chrome/browser/ui/startup/startup_browser_creator_browsertest.cc67
-rw-r--r--chrome/browser/ui/startup/startup_browser_creator_impl.cc4
-rw-r--r--chrome/browser/ui/sync/browser_synced_window_delegate.cc9
-rw-r--r--chrome/browser/ui/uma_browsing_activity_observer.cc9
-rw-r--r--chrome/browser/ui/unload_controller.cc2
-rw-r--r--chrome/browser/ui/webui/feedback_ui.cc4
-rw-r--r--chrome/browser/ui/webui/ntp/app_launcher_handler.cc5
-rw-r--r--chrome/browser/ui/webui/ntp/suggestions_combiner.cc7
-rw-r--r--chrome/browser/ui/webui/print_preview/print_preview_ui_browsertest.cc3
-rw-r--r--chrome/browser/ui/webui/print_preview/print_preview_ui_unittest.cc14
-rw-r--r--chrome/browser/ui/webui/web_dialog_web_contents_delegate_unittest.cc9
-rw-r--r--chrome/test/security_tests/sandbox_browsertest.cc3
30 files changed, 487 insertions, 406 deletions
diff --git a/chrome/browser/automation/automation_provider_observers.cc b/chrome/browser/automation/automation_provider_observers.cc
index 3577482..051bf68 100644
--- a/chrome/browser/automation/automation_provider_observers.cc
+++ b/chrome/browser/automation/automation_provider_observers.cc
@@ -55,10 +55,10 @@
#include "chrome/browser/sessions/tab_restore_service_factory.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/browser_window.h"
#include "chrome/browser/ui/find_bar/find_notification_details.h"
#include "chrome/browser/ui/login/login_prompt.h"
+#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/browser/ui/webui/ntp/app_launcher_handler.h"
#include "chrome/browser/ui/webui/ntp/most_visited_handler.h"
#include "chrome/browser/ui/webui/ntp/new_tab_ui.h"
@@ -954,7 +954,7 @@ bool ExecuteBrowserCommandObserver::CreateAndRegisterObserver(
case IDC_FORWARD:
case IDC_RELOAD: {
new NavigationNotificationObserver(
- &chrome::GetActiveWebContents(browser)->GetController(),
+ &browser->tab_strip_model()->GetActiveWebContents()->GetController(),
automation, reply_message, 1, false, use_json_interface);
break;
}
@@ -2324,8 +2324,9 @@ AllViewsStoppedLoadingObserver::AllViewsStoppedLoadingObserver(
iter != BrowserList::end();
++iter) {
Browser* browser = *iter;
- for (int i = 0; i < browser->tab_count(); ++i) {
- WebContents* web_contents = chrome::GetWebContentsAt(browser, i);
+ for (int i = 0; i < browser->tab_strip_model()->count(); ++i) {
+ WebContents* web_contents =
+ browser->tab_strip_model()->GetWebContentsAt(i);
AutomationTabHelper* automation_tab_helper =
AutomationTabHelper::FromWebContents(web_contents);
StartObserving(automation_tab_helper);
diff --git a/chrome/browser/automation/automation_util.cc b/chrome/browser/automation/automation_util.cc
index d0bc0df..2554b27 100644
--- a/chrome/browser/automation/automation_util.cc
+++ b/chrome/browser/automation/automation_util.cc
@@ -27,7 +27,6 @@
#include "chrome/browser/ui/app_modal_dialogs/app_modal_dialog_queue.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/browser/view_type_utils.h"
#include "chrome/common/automation_id.h"
@@ -163,9 +162,9 @@ WebContents* GetWebContentsAt(int browser_index, int tab_index) {
if (tab_index < 0)
return NULL;
Browser* browser = GetBrowserAt(browser_index);
- if (!browser || tab_index >= browser->tab_count())
+ if (!browser || tab_index >= browser->tab_strip_model()->count())
return NULL;
- return chrome::GetWebContentsAt(browser, tab_index);
+ return browser->tab_strip_model()->GetWebContentsAt(tab_index);
}
#if defined(OS_CHROMEOS)
@@ -208,8 +207,10 @@ Browser* GetBrowserForTab(WebContents* tab) {
BrowserList::const_iterator browser_iter = BrowserList::begin();
for (; browser_iter != BrowserList::end(); ++browser_iter) {
Browser* browser = *browser_iter;
- for (int tab_index = 0; tab_index < browser->tab_count(); ++tab_index) {
- if (chrome::GetWebContentsAt(browser, tab_index) == tab)
+ for (int tab_index = 0;
+ tab_index < browser->tab_strip_model()->count();
+ ++tab_index) {
+ if (browser->tab_strip_model()->GetWebContentsAt(tab_index) == tab)
return browser;
}
}
diff --git a/chrome/browser/browser_keyevents_browsertest.cc b/chrome/browser/browser_keyevents_browsertest.cc
index eb52f36..e982fed 100644
--- a/chrome/browser/browser_keyevents_browsertest.cc
+++ b/chrome/browser/browser_keyevents_browsertest.cc
@@ -11,7 +11,7 @@
#include "base/utf_string_conversions.h"
#include "base/values.h"
#include "chrome/browser/ui/browser.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_paths.h"
#include "chrome/test/base/interactive_test_utils.h"
@@ -144,10 +144,10 @@ class BrowserKeyEventsTest : public InProcessBrowserTest {
// true then the web page will suppress all events with |type|. Following
// event types are supported: keydown, keypress, keyup and textInput.
void SuppressEventByType(int tab_index, const wchar_t* type, bool suppress) {
- ASSERT_LT(tab_index, browser()->tab_count());
+ ASSERT_LT(tab_index, browser()->tab_strip_model()->count());
bool actual;
ASSERT_TRUE(content::ExecuteScriptAndExtractBool(
- chrome::GetWebContentsAt(browser(), tab_index),
+ browser()->tab_strip_model()->GetWebContentsAt(tab_index),
base::StringPrintf(kSuppressEventJS, type, GetBoolString(!suppress)),
&actual));
ASSERT_EQ(!suppress, actual);
@@ -170,22 +170,22 @@ class BrowserKeyEventsTest : public InProcessBrowserTest {
}
void GetResultLength(int tab_index, int* length) {
- ASSERT_LT(tab_index, browser()->tab_count());
+ ASSERT_LT(tab_index, browser()->tab_strip_model()->count());
ASSERT_TRUE(content::ExecuteScriptAndExtractInt(
- chrome::GetWebContentsAt(browser(), tab_index),
+ browser()->tab_strip_model()->GetWebContentsAt(tab_index),
kGetResultLengthJS,
length));
}
void CheckResult(int tab_index, int length, const char* const result[]) {
- ASSERT_LT(tab_index, browser()->tab_count());
+ ASSERT_LT(tab_index, browser()->tab_strip_model()->count());
int actual_length;
ASSERT_NO_FATAL_FAILURE(GetResultLength(tab_index, &actual_length));
ASSERT_GE(actual_length, length);
for (int i = 0; i < actual_length; ++i) {
std::string actual;
ASSERT_TRUE(content::ExecuteScriptAndExtractString(
- chrome::GetWebContentsAt(browser(), tab_index),
+ browser()->tab_strip_model()->GetWebContentsAt(tab_index),
base::StringPrintf(kGetResultJS, i),
&actual));
@@ -199,20 +199,20 @@ class BrowserKeyEventsTest : public InProcessBrowserTest {
}
void CheckFocusedElement(int tab_index, const wchar_t* focused) {
- ASSERT_LT(tab_index, browser()->tab_count());
+ ASSERT_LT(tab_index, browser()->tab_strip_model()->count());
std::string actual;
ASSERT_TRUE(content::ExecuteScriptAndExtractString(
- chrome::GetWebContentsAt(browser(), tab_index),
+ browser()->tab_strip_model()->GetWebContentsAt(tab_index),
kGetFocusedElementJS,
&actual));
ASSERT_EQ(WideToUTF8(focused), actual);
}
void SetFocusedElement(int tab_index, const wchar_t* focused) {
- ASSERT_LT(tab_index, browser()->tab_count());
+ ASSERT_LT(tab_index, browser()->tab_strip_model()->count());
bool actual;
ASSERT_TRUE(content::ExecuteScriptAndExtractBool(
- chrome::GetWebContentsAt(browser(), tab_index),
+ browser()->tab_strip_model()->GetWebContentsAt(tab_index),
base::StringPrintf(kSetFocusedElementJS, focused),
&actual));
ASSERT_TRUE(actual);
@@ -220,10 +220,10 @@ class BrowserKeyEventsTest : public InProcessBrowserTest {
void CheckTextBoxValue(int tab_index, const wchar_t* id,
const wchar_t* value) {
- ASSERT_LT(tab_index, browser()->tab_count());
+ ASSERT_LT(tab_index, browser()->tab_strip_model()->count());
std::string actual;
ASSERT_TRUE(content::ExecuteScriptAndExtractString(
- chrome::GetWebContentsAt(browser(), tab_index),
+ browser()->tab_strip_model()->GetWebContentsAt(tab_index),
base::StringPrintf(kGetTextBoxValueJS, id),
&actual));
ASSERT_EQ(WideToUTF8(value), actual);
@@ -231,28 +231,28 @@ class BrowserKeyEventsTest : public InProcessBrowserTest {
void SetTextBoxValue(int tab_index, const wchar_t* id,
const wchar_t* value) {
- ASSERT_LT(tab_index, browser()->tab_count());
+ ASSERT_LT(tab_index, browser()->tab_strip_model()->count());
std::string actual;
ASSERT_TRUE(content::ExecuteScriptAndExtractString(
- chrome::GetWebContentsAt(browser(), tab_index),
+ browser()->tab_strip_model()->GetWebContentsAt(tab_index),
base::StringPrintf(kSetTextBoxValueJS, id, value),
&actual));
ASSERT_EQ(WideToUTF8(value), actual);
}
void StartTest(int tab_index, int result_length) {
- ASSERT_LT(tab_index, browser()->tab_count());
+ ASSERT_LT(tab_index, browser()->tab_strip_model()->count());
bool actual;
ASSERT_TRUE(content::ExecuteScriptAndExtractBool(
- chrome::GetWebContentsAt(browser(), tab_index),
+ browser()->tab_strip_model()->GetWebContentsAt(tab_index),
base::StringPrintf(kStartTestJS, result_length),
&actual));
ASSERT_TRUE(actual);
}
void TestKeyEvent(int tab_index, const KeyEventTestData& test) {
- ASSERT_LT(tab_index, browser()->tab_count());
- ASSERT_EQ(tab_index, browser()->active_index());
+ ASSERT_LT(tab_index, browser()->tab_strip_model()->count());
+ ASSERT_EQ(tab_index, browser()->tab_strip_model()->active_index());
// Inform our testing web page that we are about to start testing a key
// event.
@@ -265,7 +265,8 @@ class BrowserKeyEventsTest : public InProcessBrowserTest {
// because the test finished message might be arrived before returning
// from the SendKeyPressSync() method.
TestFinishObserver finish_observer(
- chrome::GetWebContentsAt(browser(), tab_index)->GetRenderViewHost());
+ browser()->tab_strip_model()->GetWebContentsAt(tab_index)->
+ GetRenderViewHost());
ASSERT_TRUE(ui_test_utils::SendKeyPressSync(
browser(), test.key, test.ctrl, test.shift, test.alt, test.command));
@@ -370,7 +371,7 @@ IN_PROC_BROWSER_TEST_F(BrowserKeyEventsTest, MAYBE_NormalKeyEvents) {
ASSERT_NO_FATAL_FAILURE(ClickOnView(VIEW_ID_TAB_CONTAINER));
ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER));
- int tab_index = browser()->active_index();
+ int tab_index = browser()->tab_strip_model()->active_index();
for (size_t i = 0; i < arraysize(kTestNoInput); ++i) {
EXPECT_NO_FATAL_FAILURE(TestKeyEvent(tab_index, kTestNoInput[i]))
<< "kTestNoInput[" << i << "] failed:\n"
@@ -463,7 +464,7 @@ IN_PROC_BROWSER_TEST_F(BrowserKeyEventsTest, MAYBE_CtrlKeyEvents) {
ASSERT_NO_FATAL_FAILURE(ClickOnView(VIEW_ID_TAB_CONTAINER));
ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER));
- int tab_index = browser()->active_index();
+ int tab_index = browser()->tab_strip_model()->active_index();
// Press Ctrl+F, which will make the Find box open and request focus.
EXPECT_NO_FATAL_FAILURE(TestKeyEvent(tab_index, kTestCtrlF));
EXPECT_TRUE(IsViewFocused(VIEW_ID_FIND_IN_PAGE_TEXT_FIELD));
@@ -509,7 +510,7 @@ IN_PROC_BROWSER_TEST_F(BrowserKeyEventsTest, DISABLED_CommandKeyEvents) {
ASSERT_NO_FATAL_FAILURE(ClickOnView(VIEW_ID_TAB_CONTAINER));
ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER));
- int tab_index = browser()->active_index();
+ int tab_index = browser()->tab_strip_model()->active_index();
// Press Cmd+F, which will make the Find box open and request focus.
EXPECT_NO_FATAL_FAILURE(TestKeyEvent(tab_index, kTestCmdF));
EXPECT_TRUE(IsViewFocused(VIEW_ID_FIND_IN_PAGE_TEXT_FIELD));
@@ -618,7 +619,7 @@ IN_PROC_BROWSER_TEST_F(BrowserKeyEventsTest, MAYBE_AccessKeys) {
ASSERT_NO_FATAL_FAILURE(ClickOnView(VIEW_ID_TAB_CONTAINER));
ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER));
- int tab_index = browser()->active_index();
+ int tab_index = browser()->tab_strip_model()->active_index();
// Make sure no element is focused.
EXPECT_NO_FATAL_FAILURE(CheckFocusedElement(tab_index, L""));
// Alt+A should focus the element with accesskey = "A".
@@ -695,7 +696,7 @@ IN_PROC_BROWSER_TEST_F(BrowserKeyEventsTest, MAYBE_ReservedAccelerators) {
ASSERT_NO_FATAL_FAILURE(ClickOnView(VIEW_ID_TAB_CONTAINER));
ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER));
- ASSERT_EQ(1, browser()->tab_count());
+ ASSERT_EQ(1, browser()->tab_strip_model()->count());
static const KeyEventTestData kTestCtrlOrCmdT = {
#if defined(OS_MACOSX)
@@ -721,8 +722,8 @@ IN_PROC_BROWSER_TEST_F(BrowserKeyEventsTest, MAYBE_ReservedAccelerators) {
ASSERT_NO_FATAL_FAILURE(GetResultLength(0, &result_length));
EXPECT_EQ(1, result_length);
- EXPECT_EQ(2, browser()->tab_count());
- ASSERT_EQ(1, browser()->active_index());
+ EXPECT_EQ(2, browser()->tab_strip_model()->count());
+ ASSERT_EQ(1, browser()->tab_strip_model()->active_index());
// Because of issue <http://crbug.com/65375>, switching back to the first tab
// may cause the focus to be grabbed by omnibox. So instead, we load our
@@ -738,7 +739,8 @@ IN_PROC_BROWSER_TEST_F(BrowserKeyEventsTest, MAYBE_ReservedAccelerators) {
content::WindowedNotificationObserver wait_for_tab_closed(
content::NOTIFICATION_WEB_CONTENTS_DESTROYED,
- content::Source<content::WebContents>(chrome::GetWebContentsAt(browser(), 1)));
+ content::Source<content::WebContents>(
+ browser()->tab_strip_model()->GetWebContentsAt(1)));
// Press Ctrl/Cmd+W, which will close the tab.
#if defined(OS_MACOSX)
@@ -751,7 +753,7 @@ IN_PROC_BROWSER_TEST_F(BrowserKeyEventsTest, MAYBE_ReservedAccelerators) {
ASSERT_NO_FATAL_FAILURE(wait_for_tab_closed.Wait());
- EXPECT_EQ(1, browser()->tab_count());
+ EXPECT_EQ(1, browser()->tab_strip_model()->count());
}
#if defined(OS_MACOSX)
@@ -792,7 +794,7 @@ IN_PROC_BROWSER_TEST_F(BrowserKeyEventsTest, EditorKeyBindings) {
ASSERT_NO_FATAL_FAILURE(ClickOnView(VIEW_ID_TAB_CONTAINER));
ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER));
- int tab_index = browser()->active_index();
+ int tab_index = browser()->tab_strip_model()->active_index();
ASSERT_NO_FATAL_FAILURE(SetFocusedElement(tab_index, L"A"));
ASSERT_NO_FATAL_FAILURE(SetTextBoxValue(tab_index, L"A", L"Hello"));
// Move the caret to the beginning of the line.
@@ -830,7 +832,7 @@ IN_PROC_BROWSER_TEST_F(BrowserKeyEventsTest, DISABLED_PageUpDownKeys) {
ASSERT_NO_FATAL_FAILURE(ClickOnView(VIEW_ID_TAB_CONTAINER));
ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER));
- int tab_index = browser()->active_index();
+ int tab_index = browser()->tab_strip_model()->active_index();
ASSERT_NO_FATAL_FAILURE(SetFocusedElement(tab_index, L"A"));
EXPECT_NO_FATAL_FAILURE(TestKeyEvent(tab_index, kTestPageUp));
EXPECT_NO_FATAL_FAILURE(TestKeyEvent(tab_index, kTestPageDown));
@@ -872,7 +874,7 @@ IN_PROC_BROWSER_TEST_F(BrowserKeyEventsTest, FocusMenuBarByAltKey) {
ASSERT_NO_FATAL_FAILURE(ClickOnView(VIEW_ID_TAB_CONTAINER));
ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER));
- int tab_index = browser()->active_index();
+ int tab_index = browser()->tab_strip_model()->active_index();
// Press and release Alt key to focus wrench menu button.
EXPECT_NO_FATAL_FAILURE(TestKeyEvent(tab_index, kTestAltKey));
EXPECT_TRUE(IsViewFocused(VIEW_ID_APP_MENU));
diff --git a/chrome/browser/custom_home_pages_table_model.cc b/chrome/browser/custom_home_pages_table_model.cc
index 7999140..cd24045 100644
--- a/chrome/browser/custom_home_pages_table_model.cc
+++ b/chrome/browser/custom_home_pages_table_model.cc
@@ -14,6 +14,7 @@
#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/pref_names.h"
#include "chrome/common/url_constants.h"
#include "content/public/browser/web_contents.h"
@@ -120,7 +121,7 @@ void CustomHomePagesTableModel::MoveURLs(int insert_before,
if (skip_count < index_list.size() && index_list[skip_count] == i)
skip_count++;
else
- entries_[i - skip_count]=entries_[i];
+ entries_[i - skip_count] = entries_[i];
}
// Moving items down created a gap. We start compacting up after it.
@@ -185,7 +186,9 @@ void CustomHomePagesTableModel::SetToCurrentlyOpenPages() {
if (browser->profile() != profile_)
continue; // Skip incognito browsers.
- for (int tab_index = 0; tab_index < browser->tab_count(); ++tab_index) {
+ for (int tab_index = 0;
+ tab_index < browser->tab_strip_model()->count();
+ ++tab_index) {
const GURL url = chrome::GetWebContentsAt(browser, tab_index)->GetURL();
if (ShouldAddPage(url))
Add(add_index++, url);
diff --git a/chrome/browser/extensions/extension_install_ui_default.cc b/chrome/browser/extensions/extension_install_ui_default.cc
index 44d3ef8..ab18f76 100644
--- a/chrome/browser/extensions/extension_install_ui_default.cc
+++ b/chrome/browser/extensions/extension_install_ui_default.cc
@@ -148,7 +148,7 @@ void ExtensionInstallUIDefault::OnInstallSuccess(const Extension* extension,
Browser* browser =
chrome::FindOrCreateTabbedBrowser(current_profile,
chrome::GetActiveDesktop());
- if (browser->tab_count() == 0)
+ if (browser->tab_strip_model()->count() == 0)
chrome::AddBlankTabAt(browser, -1, true);
browser->window()->Show();
diff --git a/chrome/browser/extensions/process_management_browsertest.cc b/chrome/browser/extensions/process_management_browsertest.cc
index 18ca6ce..5450c10 100644
--- a/chrome/browser/extensions/process_management_browsertest.cc
+++ b/chrome/browser/extensions/process_management_browsertest.cc
@@ -12,7 +12,7 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/ui/browser.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/ui_test_utils.h"
@@ -108,27 +108,27 @@ IN_PROC_BROWSER_TEST_F(ProcessManagementTest, ProcessOverflow) {
GURL extension2_url = extension2->url();
// Get tab processes.
- ASSERT_EQ(9, browser()->tab_count());
+ ASSERT_EQ(9, browser()->tab_strip_model()->count());
content::RenderProcessHost* isolated1_host =
- chrome::GetWebContentsAt(browser(), 0)->GetRenderProcessHost();
+ browser()->tab_strip_model()->GetWebContentsAt(0)->GetRenderProcessHost();
content::RenderProcessHost* ntp1_host =
- chrome::GetWebContentsAt(browser(), 1)->GetRenderProcessHost();
+ browser()->tab_strip_model()->GetWebContentsAt(1)->GetRenderProcessHost();
content::RenderProcessHost* hosted1_host =
- chrome::GetWebContentsAt(browser(), 2)->GetRenderProcessHost();
+ browser()->tab_strip_model()->GetWebContentsAt(2)->GetRenderProcessHost();
content::RenderProcessHost* web1_host =
- chrome::GetWebContentsAt(browser(), 3)->GetRenderProcessHost();
+ browser()->tab_strip_model()->GetWebContentsAt(3)->GetRenderProcessHost();
content::RenderProcessHost* isolated2_host =
- chrome::GetWebContentsAt(browser(), 4)->GetRenderProcessHost();
+ browser()->tab_strip_model()->GetWebContentsAt(4)->GetRenderProcessHost();
content::RenderProcessHost* ntp2_host =
- chrome::GetWebContentsAt(browser(), 5)->GetRenderProcessHost();
+ browser()->tab_strip_model()->GetWebContentsAt(5)->GetRenderProcessHost();
content::RenderProcessHost* hosted2_host =
- chrome::GetWebContentsAt(browser(), 6)->GetRenderProcessHost();
+ browser()->tab_strip_model()->GetWebContentsAt(6)->GetRenderProcessHost();
content::RenderProcessHost* web2_host =
- chrome::GetWebContentsAt(browser(), 7)->GetRenderProcessHost();
+ browser()->tab_strip_model()->GetWebContentsAt(7)->GetRenderProcessHost();
content::RenderProcessHost* second_isolated1_host =
- chrome::GetWebContentsAt(browser(), 8)->GetRenderProcessHost();
+ browser()->tab_strip_model()->GetWebContentsAt(8)->GetRenderProcessHost();
// Get extension processes.
ExtensionProcessManager* process_manager =
diff --git a/chrome/browser/lifetime/application_lifetime.cc b/chrome/browser/lifetime/application_lifetime.cc
index b05d711..25c3a2f 100644
--- a/chrome/browser/lifetime/application_lifetime.cc
+++ b/chrome/browser/lifetime/application_lifetime.cc
@@ -191,7 +191,7 @@ void CloseAllBrowsers() {
// session we need to make sure the browser is destroyed now. So, invoke
// DestroyBrowser to make sure the browser is deleted and cleanup can
// happen.
- while (browser->tab_count())
+ while (browser->tab_strip_model()->count())
delete browser->tab_strip_model()->GetWebContentsAt(0);
browser->window()->DestroyBrowser();
i = BrowserList::begin();
diff --git a/chrome/browser/popup_blocker_browsertest.cc b/chrome/browser/popup_blocker_browsertest.cc
index 7138a7f..4d612b5 100644
--- a/chrome/browser/popup_blocker_browsertest.cc
+++ b/chrome/browser/popup_blocker_browsertest.cc
@@ -17,11 +17,11 @@
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_commands.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/omnibox/location_bar.h"
#include "chrome/browser/ui/omnibox/omnibox_edit_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/chrome_switches.h"
@@ -53,7 +53,7 @@ class PopupBlockerBrowserTest : public InProcessBrowserTest {
std::vector<WebContents*> GetBlockedContents(Browser* browser) {
// Do a round trip to the renderer first to flush any in-flight IPCs to
// create a to-be-blocked window.
- WebContents* tab = chrome::GetActiveWebContents(browser);
+ WebContents* tab = browser->tab_strip_model()->GetActiveWebContents();
CHECK(content::ExecuteScript(tab, ""));
BlockedContentTabHelper* blocked_content_tab_helper =
BlockedContentTabHelper::FromWebContents(tab);
@@ -83,8 +83,9 @@ class PopupBlockerBrowserTest : public InProcessBrowserTest {
// tab in only one browser window and the URL of current tab must be equal
// to the original URL.
EXPECT_EQ(1u, chrome::GetBrowserCount(browser->profile()));
- EXPECT_EQ(1, browser->tab_count());
- WebContents* web_contents = chrome::GetActiveWebContents(browser);
+ EXPECT_EQ(1, browser->tab_strip_model()->count());
+ WebContents* web_contents =
+ browser->tab_strip_model()->GetActiveWebContents();
EXPECT_EQ(url, web_contents->GetURL());
std::vector<WebContents*> blocked_contents = GetBlockedContents(browser);
diff --git a/chrome/browser/sessions/tab_restore_browsertest.cc b/chrome/browser/sessions/tab_restore_browsertest.cc
index c1a3150..252f89d 100644
--- a/chrome/browser/sessions/tab_restore_browsertest.cc
+++ b/chrome/browser/sessions/tab_restore_browsertest.cc
@@ -51,14 +51,14 @@ class TabRestoreTest : public InProcessBrowserTest {
// Adds tabs to the given browser, all navigated to url1_. Returns
// the final number of tabs.
int AddSomeTabs(Browser* browser, int how_many) {
- int starting_tab_count = browser->tab_count();
+ int starting_tab_count = browser->tab_strip_model()->count();
for (int i = 0; i < how_many; ++i) {
ui_test_utils::NavigateToURLWithDisposition(
browser, url1_, NEW_FOREGROUND_TAB,
ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION);
}
- int tab_count = browser->tab_count();
+ int tab_count = browser->tab_strip_model()->count();
EXPECT_EQ(starting_tab_count + how_many, tab_count);
return tab_count;
}
@@ -91,7 +91,7 @@ class TabRestoreTest : public InProcessBrowserTest {
} else {
browser = GetBrowser(expected_window_index);
}
- int tab_count = browser->tab_count();
+ int tab_count = browser->tab_strip_model()->count();
ASSERT_GT(tab_count, 0);
// Restore the tab.
@@ -110,14 +110,15 @@ class TabRestoreTest : public InProcessBrowserTest {
EXPECT_EQ(++window_count, new_window_count);
browser = GetBrowser(expected_window_index);
} else {
- EXPECT_EQ(++tab_count, browser->tab_count());
+ EXPECT_EQ(++tab_count, browser->tab_strip_model()->count());
}
// Get a handle to the restored tab.
- ASSERT_GT(browser->tab_count(), expected_tabstrip_index);
+ ASSERT_GT(browser->tab_strip_model()->count(), expected_tabstrip_index);
// Ensure that the tab and window are active.
- EXPECT_EQ(expected_tabstrip_index, browser->active_index());
+ EXPECT_EQ(expected_tabstrip_index,
+ browser->tab_strip_model()->active_index());
}
void GoBack(Browser* browser) {
@@ -150,50 +151,52 @@ class TabRestoreTest : public InProcessBrowserTest {
// Close the end tab in the current window, then restore it. The tab should be
// in its original position, and active.
IN_PROC_BROWSER_TEST_F(TabRestoreTest, Basic) {
- int starting_tab_count = browser()->tab_count();
+ int starting_tab_count = browser()->tab_strip_model()->count();
int tab_count = AddSomeTabs(browser(), 1);
int closed_tab_index = tab_count - 1;
CloseTab(closed_tab_index);
- EXPECT_EQ(starting_tab_count, browser()->tab_count());
+ EXPECT_EQ(starting_tab_count, browser()->tab_strip_model()->count());
ASSERT_NO_FATAL_FAILURE(RestoreTab(0, closed_tab_index));
// And make sure everything looks right.
- EXPECT_EQ(starting_tab_count + 1, browser()->tab_count());
- EXPECT_EQ(closed_tab_index, browser()->active_index());
- EXPECT_EQ(url1_, chrome::GetActiveWebContents(browser())->GetURL());
+ EXPECT_EQ(starting_tab_count + 1, browser()->tab_strip_model()->count());
+ EXPECT_EQ(closed_tab_index, browser()->tab_strip_model()->active_index());
+ EXPECT_EQ(url1_,
+ browser()->tab_strip_model()->GetActiveWebContents()->GetURL());
}
// Close a tab not at the end of the current window, then restore it. The tab
// should be in its original position, and active.
IN_PROC_BROWSER_TEST_F(TabRestoreTest, MiddleTab) {
- int starting_tab_count = browser()->tab_count();
+ int starting_tab_count = browser()->tab_strip_model()->count();
AddSomeTabs(browser(), 3);
// Close one in the middle
int closed_tab_index = starting_tab_count + 1;
CloseTab(closed_tab_index);
- EXPECT_EQ(starting_tab_count + 2, browser()->tab_count());
+ EXPECT_EQ(starting_tab_count + 2, browser()->tab_strip_model()->count());
ASSERT_NO_FATAL_FAILURE(RestoreTab(0, closed_tab_index));
// And make sure everything looks right.
- EXPECT_EQ(starting_tab_count + 3, browser()->tab_count());
- EXPECT_EQ(closed_tab_index, browser()->active_index());
- EXPECT_EQ(url1_, chrome::GetActiveWebContents(browser())->GetURL());
+ EXPECT_EQ(starting_tab_count + 3, browser()->tab_strip_model()->count());
+ EXPECT_EQ(closed_tab_index, browser()->tab_strip_model()->active_index());
+ EXPECT_EQ(url1_,
+ browser()->tab_strip_model()->GetActiveWebContents()->GetURL());
}
// Close a tab, switch windows, then restore the tab. The tab should be in its
// original window and position, and active.
IN_PROC_BROWSER_TEST_F(TabRestoreTest, RestoreToDifferentWindow) {
- int starting_tab_count = browser()->tab_count();
+ int starting_tab_count = browser()->tab_strip_model()->count();
AddSomeTabs(browser(), 3);
// Close one in the middle
int closed_tab_index = starting_tab_count + 1;
CloseTab(closed_tab_index);
- EXPECT_EQ(starting_tab_count + 2, browser()->tab_count());
+ EXPECT_EQ(starting_tab_count + 2, browser()->tab_strip_model()->count());
// Create a new browser.
ui_test_utils::NavigateToURLWithDisposition(
@@ -205,9 +208,10 @@ IN_PROC_BROWSER_TEST_F(TabRestoreTest, RestoreToDifferentWindow) {
ASSERT_NO_FATAL_FAILURE(RestoreTab(0, closed_tab_index));
// And make sure everything looks right.
- EXPECT_EQ(starting_tab_count + 3, browser()->tab_count());
- EXPECT_EQ(closed_tab_index, browser()->active_index());
- EXPECT_EQ(url1_, chrome::GetActiveWebContents(browser())->GetURL());
+ EXPECT_EQ(starting_tab_count + 3, browser()->tab_strip_model()->count());
+ EXPECT_EQ(closed_tab_index, browser()->tab_strip_model()->active_index());
+ EXPECT_EQ(url1_,
+ browser()->tab_strip_model()->GetActiveWebContents()->GetURL());
}
// Close a tab, open a new window, close the first window, then restore the
@@ -235,8 +239,9 @@ IN_PROC_BROWSER_TEST_F(TabRestoreTest, DISABLED_BasicRestoreFromClosedWindow) {
// Tab should be in a new window.
Browser* browser = GetBrowser(1);
- content::WebContents* web_contents = chrome::GetActiveWebContents(browser);
- // And make sure the URLs matches.
+ content::WebContents* web_contents =
+ browser->tab_strip_model()->GetActiveWebContents();
+ // And make sure the URLs match.
EXPECT_EQ(url2_, web_contents->GetURL());
GoBack(browser);
EXPECT_EQ(url1_, web_contents->GetURL());
@@ -245,17 +250,17 @@ IN_PROC_BROWSER_TEST_F(TabRestoreTest, DISABLED_BasicRestoreFromClosedWindow) {
// Restore a tab then make sure it doesn't restore again.
IN_PROC_BROWSER_TEST_F(TabRestoreTest, DontLoadRestoredTab) {
// Add two tabs
- int starting_tab_count = browser()->tab_count();
+ int starting_tab_count = browser()->tab_strip_model()->count();
AddSomeTabs(browser(), 2);
- ASSERT_EQ(browser()->tab_count(), starting_tab_count + 2);
+ ASSERT_EQ(browser()->tab_strip_model()->count(), starting_tab_count + 2);
// Close one of them.
CloseTab(0);
- ASSERT_EQ(browser()->tab_count(), starting_tab_count + 1);
+ ASSERT_EQ(browser()->tab_strip_model()->count(), starting_tab_count + 1);
// Restore it.
ASSERT_NO_FATAL_FAILURE(RestoreTab(0, 0));
- ASSERT_EQ(browser()->tab_count(), starting_tab_count + 2);
+ ASSERT_EQ(browser()->tab_strip_model()->count(), starting_tab_count + 2);
// Make sure that there's nothing else to restore.
ASSERT_FALSE(chrome::CanRestoreTab(browser()));
@@ -264,13 +269,13 @@ IN_PROC_BROWSER_TEST_F(TabRestoreTest, DontLoadRestoredTab) {
// Open a window with multiple tabs, close a tab, then close the window.
// Restore both and make sure the tab goes back into the window.
IN_PROC_BROWSER_TEST_F(TabRestoreTest, RestoreWindowAndTab) {
- int starting_tab_count = browser()->tab_count();
+ int starting_tab_count = browser()->tab_strip_model()->count();
AddSomeTabs(browser(), 3);
// Close one in the middle
int closed_tab_index = starting_tab_count + 1;
CloseTab(closed_tab_index);
- EXPECT_EQ(starting_tab_count + 2, browser()->tab_count());
+ EXPECT_EQ(starting_tab_count + 2, browser()->tab_strip_model()->count());
// Create a new browser.
ui_test_utils::NavigateToURLWithDisposition(
@@ -290,12 +295,13 @@ IN_PROC_BROWSER_TEST_F(TabRestoreTest, RestoreWindowAndTab) {
// indicates the expected active tab.
ASSERT_NO_FATAL_FAILURE(RestoreTab(1, starting_tab_count + 1));
Browser* browser = GetBrowser(1);
- EXPECT_EQ(starting_tab_count + 2, browser->tab_count());
+ EXPECT_EQ(starting_tab_count + 2, browser->tab_strip_model()->count());
// Restore the closed tab.
ASSERT_NO_FATAL_FAILURE(RestoreTab(1, closed_tab_index));
- EXPECT_EQ(starting_tab_count + 3, browser->tab_count());
- EXPECT_EQ(url1_, chrome::GetActiveWebContents(browser)->GetURL());
+ EXPECT_EQ(starting_tab_count + 3, browser->tab_strip_model()->count());
+ EXPECT_EQ(url1_,
+ browser->tab_strip_model()->GetActiveWebContents()->GetURL());
}
// Open a window with two tabs, close both (closing the window), then restore
@@ -316,7 +322,7 @@ IN_PROC_BROWSER_TEST_F(TabRestoreTest, RestoreIntoSameWindow) {
EXPECT_EQ(2u, BrowserList::size());
// Close all but one tab in the first browser, left to right.
- while (browser()->tab_count() > 1)
+ while (browser()->tab_strip_model()->count() > 1)
CloseTab(0);
// Close the last tab, closing the browser.
@@ -330,13 +336,15 @@ IN_PROC_BROWSER_TEST_F(TabRestoreTest, RestoreIntoSameWindow) {
// Restore the last-closed tab into a new window.
ASSERT_NO_FATAL_FAILURE(RestoreTab(1, 0));
Browser* browser = GetBrowser(1);
- EXPECT_EQ(1, browser->tab_count());
- EXPECT_EQ(url2_, chrome::GetActiveWebContents(browser)->GetURL());
+ EXPECT_EQ(1, browser->tab_strip_model()->count());
+ EXPECT_EQ(url2_,
+ browser->tab_strip_model()->GetActiveWebContents()->GetURL());
// Restore the next-to-last-closed tab into the same window.
ASSERT_NO_FATAL_FAILURE(RestoreTab(1, 0));
- EXPECT_EQ(2, browser->tab_count());
- EXPECT_EQ(url1_, chrome::GetActiveWebContents(browser)->GetURL());
+ EXPECT_EQ(2, browser->tab_strip_model()->count());
+ EXPECT_EQ(url1_,
+ browser->tab_strip_model()->GetActiveWebContents()->GetURL());
}
// Tests that a duplicate history entry is not created when we restore a page
@@ -346,17 +354,17 @@ IN_PROC_BROWSER_TEST_F(TabRestoreTest, RestoreWithExistingSiteInstance) {
GURL http_url1(test_server()->GetURL("files/title1.html"));
GURL http_url2(test_server()->GetURL("files/title2.html"));
- int tab_count = browser()->tab_count();
+ int tab_count = browser()->tab_strip_model()->count();
// Add a tab
ui_test_utils::NavigateToURLWithDisposition(
browser(), http_url1, NEW_FOREGROUND_TAB,
ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION);
- EXPECT_EQ(++tab_count, browser()->tab_count());
+ EXPECT_EQ(++tab_count, browser()->tab_strip_model()->count());
// Navigate to another same-site URL.
content::WebContents* tab =
- chrome::GetWebContentsAt(browser(), tab_count - 1);
+ browser()->tab_strip_model()->GetWebContentsAt(tab_count - 1);
content::WindowedNotificationObserver observer(
content::NOTIFICATION_LOAD_STOP,
content::NotificationService::AllSources());
@@ -380,9 +388,11 @@ IN_PROC_BROWSER_TEST_F(TabRestoreTest, RestoreWithExistingSiteInstance) {
ASSERT_NO_FATAL_FAILURE(RestoreTab(0, tab_count - 1));
// And make sure the URLs match.
- EXPECT_EQ(http_url2, chrome::GetActiveWebContents(browser())->GetURL());
+ EXPECT_EQ(http_url2,
+ browser()->tab_strip_model()->GetActiveWebContents()->GetURL());
GoBack(browser());
- EXPECT_EQ(http_url1, chrome::GetActiveWebContents(browser())->GetURL());
+ EXPECT_EQ(http_url1,
+ browser()->tab_strip_model()->GetActiveWebContents()->GetURL());
}
// Tests that the SiteInstances used for entries in a restored tab's history
@@ -395,13 +405,13 @@ IN_PROC_BROWSER_TEST_F(TabRestoreTest,
GURL http_url1(test_server()->GetURL("files/title1.html"));
GURL http_url2(test_server()->GetURL("files/title2.html"));
- int tab_count = browser()->tab_count();
+ int tab_count = browser()->tab_strip_model()->count();
// Add a tab
ui_test_utils::NavigateToURLWithDisposition(
browser(), http_url1, NEW_FOREGROUND_TAB,
ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION);
- EXPECT_EQ(++tab_count, browser()->tab_count());
+ EXPECT_EQ(++tab_count, browser()->tab_strip_model()->count());
// Navigate to more URLs, then a cross-site URL.
ui_test_utils::NavigateToURLWithDisposition(
@@ -428,9 +438,11 @@ IN_PROC_BROWSER_TEST_F(TabRestoreTest,
ASSERT_NO_FATAL_FAILURE(RestoreTab(0, tab_count - 1));
// And make sure the URLs match.
- EXPECT_EQ(url1_, chrome::GetActiveWebContents(browser())->GetURL());
+ EXPECT_EQ(url1_,
+ browser()->tab_strip_model()->GetActiveWebContents()->GetURL());
GoBack(browser());
- EXPECT_EQ(http_url1, chrome::GetActiveWebContents(browser())->GetURL());
+ EXPECT_EQ(http_url1,
+ browser()->tab_strip_model()->GetActiveWebContents()->GetURL());
// Navigating to a new URL should clear the forward list, because the max
// page ID of the renderer should have been updated when we restored the tab.
@@ -438,7 +450,8 @@ IN_PROC_BROWSER_TEST_F(TabRestoreTest,
browser(), http_url2, CURRENT_TAB,
ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION);
EXPECT_FALSE(chrome::CanGoForward(browser()));
- EXPECT_EQ(http_url2, chrome::GetActiveWebContents(browser())->GetURL());
+ EXPECT_EQ(http_url2,
+ browser()->tab_strip_model()->GetActiveWebContents()->GetURL());
}
IN_PROC_BROWSER_TEST_F(TabRestoreTest, RestoreWindow) {
@@ -450,7 +463,7 @@ IN_PROC_BROWSER_TEST_F(TabRestoreTest, RestoreWindow) {
EXPECT_EQ(++window_count, BrowserList::size());
// Create two more tabs, one with url1, the other url2.
- int initial_tab_count = browser()->tab_count();
+ int initial_tab_count = browser()->tab_strip_model()->count();
ui_test_utils::NavigateToURLWithDisposition(
browser(), url1_, NEW_FOREGROUND_TAB,
ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION);
@@ -478,15 +491,16 @@ IN_PROC_BROWSER_TEST_F(TabRestoreTest, RestoreWindow) {
EXPECT_EQ(window_count, BrowserList::size());
Browser* browser = GetBrowser(1);
- EXPECT_EQ(initial_tab_count + 2, browser->tab_count());
+ EXPECT_EQ(initial_tab_count + 2, browser->tab_strip_model()->count());
load_stop_observer.Wait();
content::WebContents* restored_tab =
- chrome::GetWebContentsAt(browser, initial_tab_count);
+ browser->tab_strip_model()->GetWebContentsAt(initial_tab_count);
EnsureTabFinishedRestoring(restored_tab);
EXPECT_EQ(url1_, restored_tab->GetURL());
- restored_tab = chrome::GetWebContentsAt(browser, initial_tab_count + 1);
+ restored_tab =
+ browser->tab_strip_model()->GetWebContentsAt(initial_tab_count + 1);
EnsureTabFinishedRestoring(restored_tab);
EXPECT_EQ(url2_, restored_tab->GetURL());
}
@@ -504,7 +518,7 @@ IN_PROC_BROWSER_TEST_F(TabRestoreTest, RestoreTabWithSpecialURL) {
// Restore the closed tab.
ASSERT_NO_FATAL_FAILURE(RestoreTab(0, 1));
- content::WebContents* tab = chrome::GetWebContentsAt(browser(), 1);
+ content::WebContents* tab = browser()->tab_strip_model()->GetWebContentsAt(1);
EnsureTabFinishedRestoring(tab);
// See if content is as expected.
@@ -534,7 +548,7 @@ IN_PROC_BROWSER_TEST_F(TabRestoreTest, RestoreTabWithSpecialURLOnBack) {
// Restore the closed tab.
ASSERT_NO_FATAL_FAILURE(RestoreTab(0, 1));
- content::WebContents* tab = chrome::GetWebContentsAt(browser(), 1);
+ content::WebContents* tab = browser()->tab_strip_model()->GetWebContentsAt(1);
EnsureTabFinishedRestoring(tab);
ASSERT_EQ(http_url, tab->GetURL());
diff --git a/chrome/browser/ui/browser_browsertest.cc b/chrome/browser/ui/browser_browsertest.cc
index 16a5e9e..ed1e142 100644
--- a/chrome/browser/ui/browser_browsertest.cc
+++ b/chrome/browser/ui/browser_browsertest.cc
@@ -258,17 +258,17 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, JavascriptAlertActivatesTab) {
FilePath(kTitle1File)));
ui_test_utils::NavigateToURL(browser(), url);
AddTabAtIndex(0, url, content::PAGE_TRANSITION_TYPED);
- EXPECT_EQ(2, browser()->tab_count());
- EXPECT_EQ(0, browser()->active_index());
- WebContents* second_tab = chrome::GetWebContentsAt(browser(), 1);
+ EXPECT_EQ(2, browser()->tab_strip_model()->count());
+ EXPECT_EQ(0, browser()->tab_strip_model()->active_index());
+ WebContents* second_tab = browser()->tab_strip_model()->GetWebContentsAt(1);
ASSERT_TRUE(second_tab);
second_tab->GetRenderViewHost()->ExecuteJavascriptInWebFrame(
string16(),
ASCIIToUTF16("alert('Activate!');"));
AppModalDialog* alert = ui_test_utils::WaitForAppModalDialog();
alert->CloseModalDialog();
- EXPECT_EQ(2, browser()->tab_count());
- EXPECT_EQ(1, browser()->active_index());
+ EXPECT_EQ(2, browser()->tab_strip_model()->count());
+ EXPECT_EQ(1, browser()->tab_strip_model()->active_index());
}
@@ -295,7 +295,7 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, MAYBE_ThirtyFourTabs) {
chrome::AddSelectedTabWithURL(browser(), url,
content::PAGE_TRANSITION_TYPED);
}
- EXPECT_EQ(kTabCount, browser()->tab_count());
+ EXPECT_EQ(kTabCount, browser()->tab_strip_model()->count());
// See GetMaxRendererProcessCount() in
// content/browser/renderer_host/render_process_host_impl.cc
@@ -324,10 +324,11 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, ReloadThenCancelBeforeUnload) {
chrome::Reload(browser(), CURRENT_TAB);
AppModalDialog* alert = ui_test_utils::WaitForAppModalDialog();
alert->CloseModalDialog();
- EXPECT_FALSE(chrome::GetActiveWebContents(browser())->IsLoading());
+ EXPECT_FALSE(
+ browser()->tab_strip_model()->GetActiveWebContents()->IsLoading());
// Clear the beforeunload handler so the test can easily exit.
- chrome::GetActiveWebContents(browser())->GetRenderViewHost()->
+ browser()->tab_strip_model()->GetActiveWebContents()->GetRenderViewHost()->
ExecuteJavascriptInWebFrame(string16(),
ASCIIToUTF16("onbeforeunload=null;"));
}
@@ -352,12 +353,13 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, CancelBeforeUnloadResetsURL) {
// Cancel the dialog.
AppModalDialog* alert = ui_test_utils::WaitForAppModalDialog();
alert->CloseModalDialog();
- EXPECT_FALSE(chrome::GetActiveWebContents(browser())->IsLoading());
+ EXPECT_FALSE(
+ browser()->tab_strip_model()->GetActiveWebContents()->IsLoading());
// Verify there are no pending history items after the dialog is cancelled.
// (see crbug.com/93858)
- NavigationEntry* entry = chrome::GetActiveWebContents(browser())->
- GetController().GetPendingEntry();
+ NavigationEntry* entry = browser()->tab_strip_model()->
+ GetActiveWebContents()->GetController().GetPendingEntry();
EXPECT_EQ(NULL, entry);
// Wait for the ShouldClose_ACK to arrive. We can detect it by waiting for
@@ -366,7 +368,7 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, CancelBeforeUnloadResetsURL) {
EXPECT_EQ(url, browser()->toolbar_model()->GetURL());
// Clear the beforeunload handler so the test can easily exit.
- chrome::GetActiveWebContents(browser())->GetRenderViewHost()->
+ browser()->tab_strip_model()->GetActiveWebContents()->GetRenderViewHost()->
ExecuteJavascriptInWebFrame(string16(),
ASCIIToUTF16("onbeforeunload=null;"));
}
@@ -383,14 +385,14 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, CancelBeforeUnloadResetsURL) {
// Test for crbug.com/11647. A page closed with window.close() should not have
// two beforeunload dialogs shown.
IN_PROC_BROWSER_TEST_F(BrowserTest, MAYBE_SingleBeforeUnloadAfterWindowClose) {
- chrome::GetActiveWebContents(browser())->GetRenderViewHost()->
+ browser()->tab_strip_model()->GetActiveWebContents()->GetRenderViewHost()->
ExecuteJavascriptInWebFrame(string16(),
ASCIIToUTF16(kOpenNewBeforeUnloadPage));
// Close the new window with JavaScript, which should show a single
// beforeunload dialog. Then show another alert, to make it easy to verify
// that a second beforeunload dialog isn't shown.
- chrome::GetWebContentsAt(browser(), 0)->GetRenderViewHost()->
+ browser()->tab_strip_model()->GetWebContentsAt(0)->GetRenderViewHost()->
ExecuteJavascriptInWebFrame(string16(),
ASCIIToUTF16("w.close(); alert('bar');"));
AppModalDialog* alert = ui_test_utils::WaitForAppModalDialog();
@@ -530,7 +532,7 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, NullOpenerRedirectForksProcess) {
// Start with an http URL.
ui_test_utils::NavigateToURL(browser(), http_url);
- WebContents* oldtab = chrome::GetActiveWebContents(browser());
+ WebContents* oldtab = browser()->tab_strip_model()->GetActiveWebContents();
content::RenderProcessHost* process = oldtab->GetRenderProcessHost();
// Now open a tab to a blank page, set its opener to null, and redirect it
@@ -552,8 +554,8 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, NullOpenerRedirectForksProcess) {
// Wait for popup window to appear and finish navigating.
popup_observer.Wait();
- ASSERT_EQ(2, browser()->tab_count());
- WebContents* newtab = chrome::GetActiveWebContents(browser());
+ ASSERT_EQ(2, browser()->tab_strip_model()->count());
+ WebContents* newtab = browser()->tab_strip_model()->GetActiveWebContents();
EXPECT_TRUE(newtab);
EXPECT_NE(oldtab, newtab);
nav_observer.Wait();
@@ -586,8 +588,8 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, NullOpenerRedirectForksProcess) {
// Wait for popup window to appear and finish navigating.
popup_observer2.Wait();
- ASSERT_EQ(3, browser()->tab_count());
- WebContents* newtab2 = chrome::GetActiveWebContents(browser());
+ ASSERT_EQ(3, browser()->tab_strip_model()->count());
+ WebContents* newtab2 = browser()->tab_strip_model()->GetActiveWebContents();
EXPECT_TRUE(newtab2);
EXPECT_NE(oldtab, newtab2);
nav_observer2.Wait();
@@ -619,7 +621,7 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, OtherRedirectsDontForkProcess) {
// Start with an http URL.
ui_test_utils::NavigateToURL(browser(), http_url);
- WebContents* oldtab = chrome::GetActiveWebContents(browser());
+ WebContents* oldtab = browser()->tab_strip_model()->GetActiveWebContents();
content::RenderProcessHost* process = oldtab->GetRenderProcessHost();
// Now open a tab to a blank page, set its opener to null, and redirect it
@@ -640,8 +642,8 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, OtherRedirectsDontForkProcess) {
// Wait for popup window to appear and finish navigating.
popup_observer.Wait();
- ASSERT_EQ(2, browser()->tab_count());
- WebContents* newtab = chrome::GetActiveWebContents(browser());
+ ASSERT_EQ(2, browser()->tab_strip_model()->count());
+ WebContents* newtab = browser()->tab_strip_model()->GetActiveWebContents();
EXPECT_TRUE(newtab);
EXPECT_NE(oldtab, newtab);
nav_observer.Wait();
@@ -776,11 +778,11 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, DISABLED_ConvertTabToAppShortcut) {
GURL http_url(test_server()->GetURL(""));
ASSERT_TRUE(http_url.SchemeIs(chrome::kHttpScheme));
- ASSERT_EQ(1, browser()->tab_count());
- WebContents* initial_tab = chrome::GetWebContentsAt(browser(), 0);
+ ASSERT_EQ(1, browser()->tab_strip_model()->count());
+ WebContents* initial_tab = browser()->tab_strip_model()->GetWebContentsAt(0);
WebContents* app_tab = chrome::AddSelectedTabWithURL(
browser(), http_url, content::PAGE_TRANSITION_TYPED);
- ASSERT_EQ(2, browser()->tab_count());
+ ASSERT_EQ(2, browser()->tab_strip_model()->count());
ASSERT_EQ(1u, chrome::GetBrowserCount(browser()->profile()));
// Normal tabs should accept load drops.
@@ -803,13 +805,13 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, DISABLED_ConvertTabToAppShortcut) {
ASSERT_TRUE(app_browser);
// Check that the tab contents is in the new browser, and not in the old.
- ASSERT_EQ(1, browser()->tab_count());
- ASSERT_EQ(initial_tab, chrome::GetWebContentsAt(browser(), 0));
+ ASSERT_EQ(1, browser()->tab_strip_model()->count());
+ ASSERT_EQ(initial_tab, browser()->tab_strip_model()->GetWebContentsAt(0));
// Check that the appliaction browser has a single tab, and that tab contains
// the content that we app-ified.
- ASSERT_EQ(1, app_browser->tab_count());
- ASSERT_EQ(app_tab, chrome::GetWebContentsAt(app_browser, 0));
+ ASSERT_EQ(1, app_browser->tab_strip_model()->count());
+ ASSERT_EQ(app_tab, app_browser->tab_strip_model()->GetWebContentsAt(0));
// Normal tabs should accept load drops.
EXPECT_TRUE(initial_tab->GetMutableRendererPrefs()->can_accept_load_drops);
@@ -830,8 +832,8 @@ IN_PROC_BROWSER_TEST_F(BrowserTest,
ui_test_utils::NavigateToURL(browser(), url);
- NavigationEntry* entry = chrome::GetActiveWebContents(browser())->
- GetController().GetActiveEntry();
+ NavigationEntry* entry = browser()->tab_strip_model()->
+ GetActiveWebContents()->GetController().GetActiveEntry();
EXPECT_EQ(expected_favicon_url.spec(), entry->GetFavicon().url.spec());
}
@@ -850,8 +852,8 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, MAYBE_FaviconChange) {
ASSERT_TRUE(file_url.SchemeIs(chrome::kFileScheme));
ui_test_utils::NavigateToURL(browser(), file_url);
- NavigationEntry* entry = chrome::GetActiveWebContents(browser())->
- GetController().GetActiveEntry();
+ NavigationEntry* entry = browser()->tab_strip_model()->
+ GetActiveWebContents()->GetController().GetActiveEntry();
static const FilePath::CharType* kIcon =
FILE_PATH_LITERAL("test1.png");
GURL expected_favicon_url(
@@ -898,7 +900,7 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, TabClosingWhenRemovingExtension) {
model->RemoveObserver(&observer);
// There should only be one tab now.
- ASSERT_EQ(1, browser()->tab_count());
+ ASSERT_EQ(1, browser()->tab_strip_model()->count());
}
#if !defined(OS_MACOSX)
@@ -950,7 +952,8 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, PageLanguageDetection) {
AddTabAtIndex(0, GURL(test_server()->GetURL("files/english_page.html")),
content::PAGE_TRANSITION_TYPED);
- WebContents* current_web_contents = chrome::GetActiveWebContents(browser());
+ WebContents* current_web_contents =
+ browser()->tab_strip_model()->GetActiveWebContents();
TranslateTabHelper* translate_tab_helper =
TranslateTabHelper::FromWebContents(current_web_contents);
content::Source<WebContents> source(current_web_contents);
@@ -1042,7 +1045,7 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, RestorePinnedTabs) {
// We should get back an additional tab for the app, and another for the
// default home page.
- ASSERT_EQ(3, new_browser->tab_count());
+ ASSERT_EQ(3, new_browser->tab_strip_model()->count());
// Make sure the state matches.
TabStripModel* new_model = new_browser->tab_strip_model();
@@ -1164,7 +1167,8 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, ForwardDisabledOnForward) {
content::WindowedNotificationObserver back_nav_load_observer(
content::NOTIFICATION_LOAD_STOP,
content::Source<NavigationController>(
- &chrome::GetActiveWebContents(browser())->GetController()));
+ &browser()->tab_strip_model()->GetActiveWebContents()->
+ GetController()));
chrome::GoBack(browser(), CURRENT_TAB);
back_nav_load_observer.Wait();
CommandUpdater* command_updater =
@@ -1174,7 +1178,8 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, ForwardDisabledOnForward) {
content::WindowedNotificationObserver forward_nav_load_observer(
content::NOTIFICATION_LOAD_STOP,
content::Source<NavigationController>(
- &chrome::GetActiveWebContents(browser())->GetController()));
+ &browser()->tab_strip_model()->GetActiveWebContents()->
+ GetController()));
chrome::GoForward(browser(), CURRENT_TAB);
// This check will happen before the navigation completes, since the browser
// won't process the renderer's response until the Wait() call below.
@@ -1319,7 +1324,7 @@ IN_PROC_BROWSER_TEST_F(BrowserTest,
#define MAYBE_PageZoom PageZoom
#endif
IN_PROC_BROWSER_TEST_F(BrowserTest, MAYBE_PageZoom) {
- WebContents* contents = chrome::GetActiveWebContents(browser());
+ WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents();
bool enable_plus, enable_minus;
content::WindowedNotificationObserver zoom_in_observer(
@@ -1365,7 +1370,7 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, InterstitialCommandDisable) {
EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_SAVE_PAGE));
EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_ENCODING_MENU));
- WebContents* contents = chrome::GetActiveWebContents(browser());
+ WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents();
content::WindowedNotificationObserver interstitial_observer(
content::NOTIFICATION_INTERSTITIAL_ATTACHED,
@@ -1395,7 +1400,7 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, InterstitialCommandDisable) {
}
IN_PROC_BROWSER_TEST_F(BrowserTest, InterstitialCloseTab) {
- WebContents* contents = chrome::GetActiveWebContents(browser());
+ WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents();
content::WindowedNotificationObserver interstitial_observer(
content::NOTIFICATION_INTERSTITIAL_ATTACHED,
@@ -1443,7 +1448,8 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, UserGesturesReported) {
// Regression test for http://crbug.com/110707. Also tests that a user
// gesture is sent when a normal navigation (via e.g. the omnibox) is
// performed.
- WebContents* web_contents = chrome::GetActiveWebContents(browser());
+ WebContents* web_contents =
+ browser()->tab_strip_model()->GetActiveWebContents();
MockWebContentsObserver mock_observer(web_contents);
ASSERT_TRUE(test_server()->Start());
@@ -1480,13 +1486,13 @@ IN_PROC_BROWSER_TEST_F(BrowserTest2, NoTabsInPopups) {
chrome::RegisterAppPrefs(L"Test");
// We start with a normal browser with one tab.
- EXPECT_EQ(1, browser()->tab_count());
+ EXPECT_EQ(1, browser()->tab_strip_model()->count());
// Open a popup browser with a single blank foreground tab.
Browser* popup_browser = new Browser(
Browser::CreateParams(Browser::TYPE_POPUP, browser()->profile()));
chrome::AddBlankTabAt(popup_browser, -1, true);
- EXPECT_EQ(1, popup_browser->tab_count());
+ EXPECT_EQ(1, popup_browser->tab_strip_model()->count());
// Now try opening another tab in the popup browser.
AddTabWithURLParams params1(url, content::PAGE_TRANSITION_TYPED);
@@ -1494,16 +1500,16 @@ IN_PROC_BROWSER_TEST_F(BrowserTest2, NoTabsInPopups) {
EXPECT_EQ(popup_browser, params1.target);
// The popup should still only have one tab.
- EXPECT_EQ(1, popup_browser->tab_count());
+ EXPECT_EQ(1, popup_browser->tab_strip_model()->count());
// The normal browser should now have two.
- EXPECT_EQ(2, browser()->tab_count());
+ EXPECT_EQ(2, browser()->tab_strip_model()->count());
// Open an app frame browser with a single blank foreground tab.
Browser* app_browser = new Browser(Browser::CreateParams::CreateForApp(
L"Test", browser()->profile(), false));
chrome::AddBlankTabAt(app_browser, -1, true);
- EXPECT_EQ(1, app_browser->tab_count());
+ EXPECT_EQ(1, app_browser->tab_strip_model()->count());
// Now try opening another tab in the app browser.
AddTabWithURLParams params2(GURL(chrome::kAboutBlankURL),
@@ -1512,16 +1518,16 @@ IN_PROC_BROWSER_TEST_F(BrowserTest2, NoTabsInPopups) {
EXPECT_EQ(app_browser, params2.target);
// The popup should still only have one tab.
- EXPECT_EQ(1, app_browser->tab_count());
+ EXPECT_EQ(1, app_browser->tab_strip_model()->count());
// The normal browser should now have three.
- EXPECT_EQ(3, browser()->tab_count());
+ EXPECT_EQ(3, browser()->tab_strip_model()->count());
// Open an app frame popup browser with a single blank foreground tab.
Browser* app_popup_browser = new Browser(Browser::CreateParams::CreateForApp(
L"Test", browser()->profile(), false));
chrome::AddBlankTabAt(app_popup_browser, -1, true);
- EXPECT_EQ(1, app_popup_browser->tab_count());
+ EXPECT_EQ(1, app_popup_browser->tab_strip_model()->count());
// Now try opening another tab in the app popup browser.
AddTabWithURLParams params3(GURL(chrome::kAboutBlankURL),
@@ -1530,10 +1536,10 @@ IN_PROC_BROWSER_TEST_F(BrowserTest2, NoTabsInPopups) {
EXPECT_EQ(app_popup_browser, params3.target);
// The popup should still only have one tab.
- EXPECT_EQ(1, app_popup_browser->tab_count());
+ EXPECT_EQ(1, app_popup_browser->tab_strip_model()->count());
// The normal browser should now have four.
- EXPECT_EQ(4, browser()->tab_count());
+ EXPECT_EQ(4, browser()->tab_strip_model()->count());
// Close the additional browsers.
popup_browser->tab_strip_model()->CloseAllTabs();
@@ -1548,7 +1554,7 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, WindowOpenClose) {
string16 title = ASCIIToUTF16("Title Of Awesomeness");
content::TitleWatcher title_watcher(
- chrome::GetActiveWebContents(browser()), title);
+ browser()->tab_strip_model()->GetActiveWebContents(), title);
ui_test_utils::NavigateToURLBlockUntilNavigationsComplete(browser(), url, 2);
EXPECT_EQ(title, title_watcher.WaitAndGetTitle());
}
@@ -1586,7 +1592,7 @@ IN_PROC_BROWSER_TEST_F(ShowModalDialogTest, BasicTest) {
string16 expected_title(ASCIIToUTF16("SUCCESS"));
content::TitleWatcher title_watcher(
- chrome::GetActiveWebContents(browser()), expected_title);
+ browser()->tab_strip_model()->GetActiveWebContents(), expected_title);
ui_test_utils::NavigateToURL(browser(), url);
// Verify that we set a mark on successful dialog show.
@@ -1599,7 +1605,7 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, DisallowFileUrlUniversalAccessTest) {
string16 expected_title(ASCIIToUTF16("Disallowed"));
content::TitleWatcher title_watcher(
- chrome::GetActiveWebContents(browser()), expected_title);
+ browser()->tab_strip_model()->GetActiveWebContents(), expected_title);
title_watcher.AlsoWaitForTitle(ASCIIToUTF16("Allowed"));
ui_test_utils::NavigateToURL(browser(), url);
ASSERT_EQ(expected_title, title_watcher.WaitAndGetTitle());
@@ -1748,7 +1754,7 @@ IN_PROC_BROWSER_TEST_F(AppModeTest, EnableAppModeTest) {
// Confirm about:version contains some expected content.
IN_PROC_BROWSER_TEST_F(BrowserTest, AboutVersion) {
ui_test_utils::NavigateToURL(browser(), GURL(chrome::kAboutVersionURL));
- WebContents* tab = chrome::GetActiveWebContents(browser());
+ WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents();
ASSERT_GT(ui_test_utils::FindInPage(tab, ASCIIToUTF16("WebKit"), true, true,
NULL, NULL),
0);
@@ -1803,14 +1809,16 @@ class ClickModifierTest : public InProcessBrowserTest {
WindowOpenDisposition disposition) {
ui_test_utils::NavigateToURL(browser, url);
EXPECT_EQ(1u, chrome::GetBrowserCount(browser->profile()));
- EXPECT_EQ(1, browser->tab_count());
- content::WebContents* web_contents = chrome::GetActiveWebContents(browser);
+ EXPECT_EQ(1, browser->tab_strip_model()->count());
+ content::WebContents* web_contents =
+ browser->tab_strip_model()->GetActiveWebContents();
EXPECT_EQ(url, web_contents->GetURL());
if (disposition == CURRENT_TAB) {
+ content::WebContents* web_contents =
+ browser->tab_strip_model()->GetActiveWebContents();
NavigationController* controller =
- chrome::GetActiveWebContents(browser) ?
- &chrome::GetActiveWebContents(browser)->GetController() : NULL;
+ web_contents ? &web_contents->GetController() : NULL;
content::TestNavigationObserver same_tab_observer(
content::Source<NavigationController>(controller),
NULL,
@@ -1821,7 +1829,7 @@ class ClickModifierTest : public InProcessBrowserTest {
base::Bind(&content::RunThisRunLoop, base::Unretained(&run_loop)),
content::GetQuitTaskForRunLoop(&run_loop));
EXPECT_EQ(1u, chrome::GetBrowserCount(browser->profile()));
- EXPECT_EQ(1, browser->tab_count());
+ EXPECT_EQ(1, browser->tab_strip_model()->count());
EXPECT_EQ(getSecondPageTitle(), web_contents->GetTitle());
return;
}
@@ -1838,8 +1846,8 @@ class ClickModifierTest : public InProcessBrowserTest {
}
EXPECT_EQ(1u, chrome::GetBrowserCount(browser->profile()));
- EXPECT_EQ(2, browser->tab_count());
- web_contents = chrome::GetActiveWebContents(browser);
+ EXPECT_EQ(2, browser->tab_strip_model()->count());
+ web_contents = browser->tab_strip_model()->GetActiveWebContents();
WaitForLoadStop(web_contents);
if (disposition == NEW_FOREGROUND_TAB) {
EXPECT_EQ(getSecondPageTitle(), web_contents->GetTitle());
diff --git a/chrome/browser/ui/browser_commands.cc b/chrome/browser/ui/browser_commands.cc
index fef09f5..da8ccf3 100644
--- a/chrome/browser/ui/browser_commands.cc
+++ b/chrome/browser/ui/browser_commands.cc
@@ -107,7 +107,8 @@ void BookmarkCurrentPageInternal(Browser* browser, bool from_star) {
GURL url;
string16 title;
- WebContents* web_contents = GetActiveWebContents(browser);
+ WebContents* web_contents =
+ browser->tab_strip_model()->GetActiveWebContents();
GetURLAndTitleToBookmark(web_contents, &url, &title);
bool was_bookmarked = model->IsBookmarked(url);
if (!was_bookmarked && web_contents->GetBrowserContext()->IsOffTheRecord()) {
@@ -174,7 +175,8 @@ void ReloadInternal(Browser* browser,
}
bool HasConstrainedWindow(const Browser* browser) {
- WebContents* web_contents = GetActiveWebContents(browser);
+ WebContents* web_contents =
+ browser->tab_strip_model()->GetActiveWebContents();
if (!web_contents)
return false;
@@ -242,7 +244,7 @@ void RemoveCommandObserver(Browser* browser,
int GetContentRestrictions(const Browser* browser) {
int content_restrictions = 0;
- WebContents* current_tab = GetActiveWebContents(browser);
+ WebContents* current_tab = browser->tab_strip_model()->GetActiveWebContents();
if (current_tab) {
content_restrictions = current_tab->GetContentRestrictions();
NavigationEntry* active_entry =
@@ -324,7 +326,8 @@ void OpenURLOffTheRecord(Profile* profile,
}
bool CanGoBack(const Browser* browser) {
- return GetActiveWebContents(browser)->GetController().CanGoBack();
+ return browser->tab_strip_model()->GetActiveWebContents()->
+ GetController().CanGoBack();
}
void GoBack(Browser* browser, WindowOpenDisposition disposition) {
@@ -342,7 +345,8 @@ void GoBack(Browser* browser, WindowOpenDisposition disposition) {
}
bool CanGoForward(const Browser* browser) {
- return GetActiveWebContents(browser)->GetController().CanGoForward();
+ return browser->tab_strip_model()->GetActiveWebContents()->
+ GetController().CanGoForward();
}
void GoForward(Browser* browser, WindowOpenDisposition disposition) {
@@ -437,7 +441,7 @@ void OpenCurrentURL(Browser* browser) {
void Stop(Browser* browser) {
content::RecordAction(UserMetricsAction("Stop"));
- GetActiveWebContents(browser)->Stop();
+ browser->tab_strip_model()->GetActiveWebContents()->Stop();
}
#if !defined(OS_WIN)
@@ -465,7 +469,8 @@ void NewTab(Browser* browser) {
if (browser->is_type_tabbed()) {
AddBlankTabAt(browser, -1, true);
- GetActiveWebContents(browser)->GetView()->RestoreFocus();
+ browser->tab_strip_model()->GetActiveWebContents()->GetView()->
+ RestoreFocus();
} else {
Browser* b =
chrome::FindOrCreateTabbedBrowser(browser->profile(),
@@ -475,7 +480,7 @@ void NewTab(Browser* browser) {
// The call to AddBlankTabAt above did not set the focus to the tab as its
// window was not active, so we have to do it explicitly.
// See http://crbug.com/6380.
- GetActiveWebContents(b)->GetView()->RestoreFocus();
+ b->tab_strip_model()->GetActiveWebContents()->GetView()->RestoreFocus();
}
}
@@ -533,7 +538,7 @@ void MoveTabPrevious(Browser* browser) {
}
void SelectNumberedTab(Browser* browser, int index) {
- if (index < browser->tab_count()) {
+ if (index < browser->tab_strip_model()->count()) {
content::RecordAction(UserMetricsAction("SelectNumberedTab"));
browser->tab_strip_model()->ActivateTabAt(index, true);
}
@@ -550,7 +555,7 @@ void DuplicateTab(Browser* browser) {
}
bool CanDuplicateTab(const Browser* browser) {
- WebContents* contents = GetActiveWebContents(browser);
+ WebContents* contents = browser->tab_strip_model()->GetActiveWebContents();
return contents && contents->GetController().GetLastCommittedEntry();
}
@@ -611,7 +616,7 @@ WebContents* DuplicateTabAt(Browser* browser, int index) {
bool CanDuplicateTabAt(Browser* browser, int index) {
content::NavigationController& nc =
- GetWebContentsAt(browser, index)->GetController();
+ browser->tab_strip_model()->GetWebContentsAt(index)->GetController();
return nc.GetWebContents() && nc.GetLastCommittedEntry();
}
@@ -652,19 +657,21 @@ void BookmarkAllTabs(Browser* browser) {
}
bool CanBookmarkAllTabs(const Browser* browser) {
- return browser->tab_count() > 1 && CanBookmarkCurrentPage(browser);
+ return browser->tab_strip_model()->count() > 1 &&
+ CanBookmarkCurrentPage(browser);
}
void TogglePagePinnedToStartScreen(Browser* browser) {
#if defined(OS_WIN)
- MetroPinTabHelper::FromWebContents(GetActiveWebContents(browser))->
- TogglePinnedToStartScreen();
+ MetroPinTabHelper::FromWebContents(
+ browser->tab_strip_model()->GetActiveWebContents())->
+ TogglePinnedToStartScreen();
#endif
}
void SavePage(Browser* browser) {
content::RecordAction(UserMetricsAction("SavePage"));
- WebContents* current_tab = GetActiveWebContents(browser);
+ WebContents* current_tab = browser->tab_strip_model()->GetActiveWebContents();
if (current_tab && current_tab->GetContentsMimeType() == "application/pdf")
content::RecordAction(UserMetricsAction("PDF.SavePage"));
current_tab->OnSavePage();
@@ -711,7 +718,7 @@ void ShowChromeToMobileBubble(Browser* browser) {
void Print(Browser* browser) {
printing::PrintViewManager* print_view_manager =
printing::PrintViewManager::FromWebContents(
- GetActiveWebContents(browser));
+ browser->tab_strip_model()->GetActiveWebContents());
if (browser->profile()->GetPrefs()->GetBoolean(
prefs::kPrintPreviewDisabled))
print_view_manager->PrintNow();
@@ -732,7 +739,7 @@ bool CanPrint(const Browser* browser) {
void AdvancedPrint(Browser* browser) {
printing::PrintViewManager* print_view_manager =
printing::PrintViewManager::FromWebContents(
- GetActiveWebContents(browser));
+ browser->tab_strip_model()->GetActiveWebContents());
print_view_manager->AdvancedPrintNow();
}
@@ -746,13 +753,13 @@ bool CanAdvancedPrint(const Browser* browser) {
void PrintToDestination(Browser* browser) {
printing::PrintViewManager* print_view_manager =
printing::PrintViewManager::FromWebContents(
- GetActiveWebContents(browser));
+ browser->tab_strip_model()->GetActiveWebContents());
print_view_manager->PrintToDestination();
}
void EmailPageLocation(Browser* browser) {
content::RecordAction(UserMetricsAction("EmailPageLocation"));
- WebContents* wc = GetActiveWebContents(browser);
+ WebContents* wc = browser->tab_strip_model()->GetActiveWebContents();
DCHECK(wc);
std::string title = net::EscapeQueryParamValue(
@@ -765,7 +772,7 @@ void EmailPageLocation(Browser* browser) {
bool CanEmailPageLocation(const Browser* browser) {
return browser->toolbar_model()->ShouldDisplayURL() &&
- GetActiveWebContents(browser)->GetURL().is_valid();
+ browser->tab_strip_model()->GetActiveWebContents()->GetURL().is_valid();
}
void Cut(Browser* browser) {
@@ -806,10 +813,11 @@ void FindInPage(Browser* browser, bool find_next, bool forward_direction) {
// We always want to search for the contents of the find pasteboard on OS X.
find_text = GetFindPboardText();
#endif
- FindTabHelper::FromWebContents(GetActiveWebContents(browser))->
- StartFinding(find_text,
- forward_direction,
- false); // Not case sensitive.
+ FindTabHelper::FromWebContents(
+ browser->tab_strip_model()->GetActiveWebContents())->
+ StartFinding(find_text,
+ forward_direction,
+ false); // Not case sensitive.
}
}
@@ -817,7 +825,8 @@ void Zoom(Browser* browser, content::PageZoom zoom) {
if (browser->is_devtools())
return;
- chrome_page_zoom::Zoom(GetActiveWebContents(browser), zoom);
+ chrome_page_zoom::Zoom(browser->tab_strip_model()->GetActiveWebContents(),
+ zoom);
}
void FocusToolbar(Browser* browser) {
@@ -906,7 +915,8 @@ void OpenUpdateChromeDialog(Browser* browser) {
}
void ToggleSpeechInput(Browser* browser) {
- GetActiveWebContents(browser)->GetRenderViewHost()->ToggleSpeechInput();
+ browser->tab_strip_model()->GetActiveWebContents()->
+ GetRenderViewHost()->ToggleSpeechInput();
}
bool CanRequestTabletSite(WebContents* current_tab) {
@@ -916,7 +926,7 @@ bool CanRequestTabletSite(WebContents* current_tab) {
}
bool IsRequestingTabletSite(Browser* browser) {
- WebContents* current_tab = chrome::GetActiveWebContents(browser);
+ WebContents* current_tab = browser->tab_strip_model()->GetActiveWebContents();
if (!current_tab)
return false;
content::NavigationEntry* entry =
@@ -927,7 +937,7 @@ bool IsRequestingTabletSite(Browser* browser) {
}
void ToggleRequestTabletSite(Browser* browser) {
- WebContents* current_tab = GetActiveWebContents(browser);
+ WebContents* current_tab = browser->tab_strip_model()->GetActiveWebContents();
if (!current_tab)
return;
NavigationController& controller = current_tab->GetController();
@@ -959,7 +969,7 @@ void ClearCache(Browser* browser) {
}
bool IsDebuggerAttachedToCurrentTab(Browser* browser) {
- WebContents* contents = chrome::GetActiveWebContents(browser);
+ WebContents* contents = browser->tab_strip_model()->GetActiveWebContents();
return contents ?
content::DevToolsAgentHost::IsDebuggerAttached(contents) : false;
}
@@ -1052,13 +1062,15 @@ bool CanViewSource(const Browser* browser) {
void CreateApplicationShortcuts(Browser* browser) {
content::RecordAction(UserMetricsAction("CreateShortcut"));
- extensions::TabHelper::FromWebContents(GetActiveWebContents(browser))->
- CreateApplicationShortcuts();
+ extensions::TabHelper::FromWebContents(
+ browser->tab_strip_model()->GetActiveWebContents())->
+ CreateApplicationShortcuts();
}
bool CanCreateApplicationShortcuts(const Browser* browser) {
- return extensions::TabHelper::FromWebContents(GetActiveWebContents(browser))->
- CanCreateApplicationShortcuts();
+ return extensions::TabHelper::FromWebContents(
+ browser->tab_strip_model()->GetActiveWebContents())->
+ CanCreateApplicationShortcuts();
}
void ConvertTabToAppWindow(Browser* browser,
diff --git a/chrome/browser/ui/browser_navigator_browsertest.cc b/chrome/browser/ui/browser_navigator_browsertest.cc
index 4457ac7..97a1af2 100644
--- a/chrome/browser/ui/browser_navigator_browsertest.cc
+++ b/chrome/browser/ui/browser_navigator_browsertest.cc
@@ -93,7 +93,7 @@ Browser* BrowserNavigatorTest::CreateEmptyBrowserForApp(Browser::Type type,
WebContents* BrowserNavigatorTest::CreateWebContents() {
content::WebContents::CreateParams create_params(browser()->profile());
content::WebContents* base_web_contents =
- chrome::GetActiveWebContents(browser());
+ browser()->tab_strip_model()->GetActiveWebContents();
if (base_web_contents) {
create_params.initial_size =
base_web_contents->GetView()->GetContainerSize();
@@ -102,23 +102,24 @@ WebContents* BrowserNavigatorTest::CreateWebContents() {
}
void BrowserNavigatorTest::RunSuppressTest(WindowOpenDisposition disposition) {
- GURL old_url = chrome::GetActiveWebContents(browser())->GetURL();
+ GURL old_url = browser()->tab_strip_model()->GetActiveWebContents()->GetURL();
chrome::NavigateParams p(MakeNavigateParams());
p.disposition = disposition;
chrome::Navigate(&p);
// Nothing should have happened as a result of Navigate();
- EXPECT_EQ(1, browser()->tab_count());
+ EXPECT_EQ(1, browser()->tab_strip_model()->count());
EXPECT_EQ(1u, BrowserList::size());
- EXPECT_EQ(old_url, chrome::GetActiveWebContents(browser())->GetURL());
+ EXPECT_EQ(old_url,
+ browser()->tab_strip_model()->GetActiveWebContents()->GetURL());
}
void BrowserNavigatorTest::RunUseNonIncognitoWindowTest(const GURL& url) {
Browser* incognito_browser = CreateIncognitoBrowser();
EXPECT_EQ(2u, BrowserList::size());
- EXPECT_EQ(1, browser()->tab_count());
- EXPECT_EQ(1, incognito_browser->tab_count());
+ EXPECT_EQ(1, browser()->tab_strip_model()->count());
+ EXPECT_EQ(1, incognito_browser->tab_strip_model()->count());
// Navigate to the page.
chrome::NavigateParams p(MakeNavigateParams(incognito_browser));
@@ -130,8 +131,9 @@ void BrowserNavigatorTest::RunUseNonIncognitoWindowTest(const GURL& url) {
// This page should be opened in browser() window.
EXPECT_NE(incognito_browser, p.browser);
EXPECT_EQ(browser(), p.browser);
- EXPECT_EQ(2, browser()->tab_count());
- EXPECT_EQ(url, chrome::GetActiveWebContents(browser())->GetURL());
+ EXPECT_EQ(2, browser()->tab_strip_model()->count());
+ EXPECT_EQ(url,
+ browser()->tab_strip_model()->GetActiveWebContents()->GetURL());
}
void BrowserNavigatorTest::RunDoNothingIfIncognitoIsForcedTest(
@@ -155,9 +157,9 @@ void BrowserNavigatorTest::RunDoNothingIfIncognitoIsForcedTest(
// The page should not be opened.
EXPECT_EQ(browser, p.browser);
- EXPECT_EQ(1, browser->tab_count());
+ EXPECT_EQ(1, browser->tab_strip_model()->count());
EXPECT_EQ(GURL(chrome::kAboutBlankURL),
- chrome::GetActiveWebContents(browser)->GetURL());
+ browser->tab_strip_model()->GetActiveWebContents()->GetURL());
}
void BrowserNavigatorTest::Observe(
@@ -181,10 +183,11 @@ namespace {
// of the Browser remains the same and the current tab bears the loaded URL.
IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, Disposition_CurrentTab) {
ui_test_utils::NavigateToURL(browser(), GetGoogleURL());
- EXPECT_EQ(GetGoogleURL(), chrome::GetActiveWebContents(browser())->GetURL());
+ EXPECT_EQ(GetGoogleURL(),
+ browser()->tab_strip_model()->GetActiveWebContents()->GetURL());
// We should have one window with one tab.
EXPECT_EQ(1u, BrowserList::size());
- EXPECT_EQ(1, browser()->tab_count());
+ EXPECT_EQ(1, browser()->tab_strip_model()->count());
}
// This test verifies that a singleton tab is refocused if one is already opened
@@ -209,7 +212,7 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, Disposition_SingletonTabExisting) {
// We should have one browser with 3 tabs, the 3rd selected.
EXPECT_EQ(1u, BrowserList::size());
- EXPECT_EQ(2, browser()->active_index());
+ EXPECT_EQ(2, browser()->tab_strip_model()->active_index());
unsigned int previous_tab_contents_count =
created_tab_contents_count_ = 0;
@@ -222,7 +225,7 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, Disposition_SingletonTabExisting) {
// The middle tab should now be selected.
EXPECT_EQ(browser(), p.browser);
- EXPECT_EQ(1, browser()->active_index());
+ EXPECT_EQ(1, browser()->tab_strip_model()->active_index());
// No tab contents should have been created
EXPECT_EQ(previous_tab_contents_count,
@@ -240,8 +243,8 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
// We should have one browser with 2 tabs, 2nd selected.
EXPECT_EQ(1u, BrowserList::size());
- EXPECT_EQ(2, browser()->tab_count());
- EXPECT_EQ(1, browser()->active_index());
+ EXPECT_EQ(2, browser()->tab_strip_model()->count());
+ EXPECT_EQ(1, browser()->tab_strip_model()->active_index());
// Navigate to singleton_url2.
chrome::NavigateParams p(MakeNavigateParams());
@@ -251,8 +254,8 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
// We should now have 2 tabs, the 2nd one selected.
EXPECT_EQ(browser(), p.browser);
- EXPECT_EQ(2, browser()->tab_count());
- EXPECT_EQ(1, browser()->active_index());
+ EXPECT_EQ(2, browser()->tab_strip_model()->count());
+ EXPECT_EQ(1, browser()->tab_strip_model()->active_index());
// Navigate to singleton_url2, but with respect ref set.
p = MakeNavigateParams();
@@ -263,8 +266,8 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
// We should now have 3 tabs, the 3th one selected.
EXPECT_EQ(browser(), p.browser);
- EXPECT_EQ(3, browser()->tab_count());
- EXPECT_EQ(2, browser()->active_index());
+ EXPECT_EQ(3, browser()->tab_strip_model()->count());
+ EXPECT_EQ(2, browser()->tab_strip_model()->active_index());
// Navigate to singleton_url3.
p = MakeNavigateParams();
@@ -275,8 +278,8 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
// We should now have 4 tabs, the 4th one selected.
EXPECT_EQ(browser(), p.browser);
- EXPECT_EQ(4, browser()->tab_count());
- EXPECT_EQ(3, browser()->active_index());
+ EXPECT_EQ(4, browser()->tab_strip_model()->count());
+ EXPECT_EQ(3, browser()->tab_strip_model()->active_index());
}
IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
@@ -285,7 +288,7 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
// We should have one browser with 1 tab.
EXPECT_EQ(1u, BrowserList::size());
- EXPECT_EQ(0, browser()->active_index());
+ EXPECT_EQ(0, browser()->tab_strip_model()->active_index());
// Navigate to singleton_url1.
chrome::NavigateParams p(MakeNavigateParams());
@@ -295,36 +298,40 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
// We should now have 2 tabs, the 2nd one selected.
EXPECT_EQ(browser(), p.browser);
- EXPECT_EQ(2, browser()->tab_count());
- EXPECT_EQ(1, browser()->active_index());
+ EXPECT_EQ(2, browser()->tab_strip_model()->count());
+ EXPECT_EQ(1, browser()->tab_strip_model()->active_index());
}
// This test verifies that when a navigation results in a foreground tab, the
// tab count of the Browser increases and the selected tab shifts to the new
// foreground tab.
IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, Disposition_NewForegroundTab) {
- WebContents* old_contents = chrome::GetActiveWebContents(browser());
+ WebContents* old_contents =
+ browser()->tab_strip_model()->GetActiveWebContents();
chrome::NavigateParams p(MakeNavigateParams());
p.disposition = NEW_FOREGROUND_TAB;
chrome::Navigate(&p);
- EXPECT_NE(old_contents, chrome::GetActiveWebContents(browser()));
+ EXPECT_NE(old_contents,
+ browser()->tab_strip_model()->GetActiveWebContents());
EXPECT_EQ(browser()->tab_strip_model()->GetActiveWebContents(),
p.target_contents);
- EXPECT_EQ(2, browser()->tab_count());
+ EXPECT_EQ(2, browser()->tab_strip_model()->count());
}
// This test verifies that when a navigation results in a background tab, the
// tab count of the Browser increases but the selected tab remains the same.
IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, Disposition_NewBackgroundTab) {
- WebContents* old_contents = chrome::GetActiveWebContents(browser());
+ WebContents* old_contents =
+ browser()->tab_strip_model()->GetActiveWebContents();
chrome::NavigateParams p(MakeNavigateParams());
p.disposition = NEW_BACKGROUND_TAB;
chrome::Navigate(&p);
- WebContents* new_contents = chrome::GetActiveWebContents(browser());
+ WebContents* new_contents =
+ browser()->tab_strip_model()->GetActiveWebContents();
// The selected tab should have remained unchanged, since the new tab was
// opened in the background.
EXPECT_EQ(old_contents, new_contents);
- EXPECT_EQ(2, browser()->tab_count());
+ EXPECT_EQ(2, browser()->tab_strip_model()->count());
}
// This test verifies that when a navigation requiring a new foreground tab
@@ -351,8 +358,8 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
// We should be left with 2 windows, the popup with one tab and the browser()
// provided by the framework with two.
EXPECT_EQ(2u, BrowserList::size());
- EXPECT_EQ(1, popup->tab_count());
- EXPECT_EQ(2, browser()->tab_count());
+ EXPECT_EQ(1, popup->tab_strip_model()->count());
+ EXPECT_EQ(2, browser()->tab_strip_model()->count());
}
// This test verifies that when a navigation requiring a new foreground tab
@@ -386,9 +393,9 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
// 2. the incognito popup we created originally
// 3. the new incognito tabbed browser that was created by Navigate().
EXPECT_EQ(3u, BrowserList::size());
- EXPECT_EQ(1, browser()->tab_count());
- EXPECT_EQ(1, popup->tab_count());
- EXPECT_EQ(1, p.browser->tab_count());
+ EXPECT_EQ(1, browser()->tab_strip_model()->count());
+ EXPECT_EQ(1, popup->tab_strip_model()->count());
+ EXPECT_EQ(1, p.browser->tab_strip_model()->count());
EXPECT_TRUE(p.browser->is_type_tabbed());
}
@@ -413,8 +420,8 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, Disposition_NewPopup) {
// We should have two windows, the browser() provided by the framework and the
// new popup window.
EXPECT_EQ(2u, BrowserList::size());
- EXPECT_EQ(1, browser()->tab_count());
- EXPECT_EQ(1, p.browser->tab_count());
+ EXPECT_EQ(1, browser()->tab_strip_model()->count());
+ EXPECT_EQ(1, p.browser->tab_strip_model()->count());
}
// This test verifies that navigating with WindowOpenDisposition = NEW_POPUP
@@ -435,8 +442,8 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, Disposition_NewPopup_ExtensionId) {
// We should have two windows, the browser() provided by the framework and the
// new popup window.
EXPECT_EQ(2u, BrowserList::size());
- EXPECT_EQ(1, browser()->tab_count());
- EXPECT_EQ(1, p.browser->tab_count());
+ EXPECT_EQ(1, browser()->tab_strip_model()->count());
+ EXPECT_EQ(1, p.browser->tab_strip_model()->count());
}
// This test verifies that navigating with WindowOpenDisposition = NEW_POPUP
@@ -461,9 +468,9 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, Disposition_NewPopupFromPopup) {
// We should have three windows, the browser() provided by the framework,
// the first popup window, and the second popup window.
EXPECT_EQ(3u, BrowserList::size());
- EXPECT_EQ(1, browser()->tab_count());
- EXPECT_EQ(1, p1.browser->tab_count());
- EXPECT_EQ(1, p2.browser->tab_count());
+ EXPECT_EQ(1, browser()->tab_strip_model()->count());
+ EXPECT_EQ(1, p1.browser->tab_strip_model()->count());
+ EXPECT_EQ(1, p2.browser->tab_strip_model()->count());
}
// This test verifies that navigating with WindowOpenDisposition = NEW_POPUP
@@ -486,9 +493,9 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
// We should now have three windows, the app window, the app popup it created,
// and the original browser() provided by the framework.
EXPECT_EQ(3u, BrowserList::size());
- EXPECT_EQ(1, browser()->tab_count());
- EXPECT_EQ(1, app_browser->tab_count());
- EXPECT_EQ(1, p.browser->tab_count());
+ EXPECT_EQ(1, browser()->tab_strip_model()->count());
+ EXPECT_EQ(1, app_browser->tab_strip_model()->count());
+ EXPECT_EQ(1, p.browser->tab_strip_model()->count());
}
// This test verifies that navigating with WindowOpenDisposition = NEW_POPUP
@@ -517,10 +524,10 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
// We should now have four windows, the app window, the first app popup,
// the second app popup, and the original browser() provided by the framework.
EXPECT_EQ(4u, BrowserList::size());
- EXPECT_EQ(1, browser()->tab_count());
- EXPECT_EQ(1, app_browser->tab_count());
- EXPECT_EQ(1, p1.browser->tab_count());
- EXPECT_EQ(1, p2.browser->tab_count());
+ EXPECT_EQ(1, browser()->tab_strip_model()->count());
+ EXPECT_EQ(1, app_browser->tab_strip_model()->count());
+ EXPECT_EQ(1, p1.browser->tab_strip_model()->count());
+ EXPECT_EQ(1, p2.browser->tab_strip_model()->count());
}
// This test verifies that navigating with WindowOpenDisposition = NEW_POPUP
@@ -563,8 +570,8 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, Disposition_NewWindow) {
// We should now have two windows, the browser() provided by the framework and
// the new normal window.
EXPECT_EQ(2u, BrowserList::size());
- EXPECT_EQ(1, browser()->tab_count());
- EXPECT_EQ(1, p.browser->tab_count());
+ EXPECT_EQ(1, browser()->tab_strip_model()->count());
+ EXPECT_EQ(1, p.browser->tab_strip_model()->count());
}
// This test verifies that navigating with WindowOpenDisposition = INCOGNITO
@@ -586,8 +593,8 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, Disposition_Incognito) {
// We should now have two windows, the browser() provided by the framework and
// the new incognito window.
EXPECT_EQ(2u, BrowserList::size());
- EXPECT_EQ(1, browser()->tab_count());
- EXPECT_EQ(1, p.browser->tab_count());
+ EXPECT_EQ(1, browser()->tab_strip_model()->count());
+ EXPECT_EQ(1, p.browser->tab_strip_model()->count());
}
// This test verifies that navigating with WindowOpenDisposition = INCOGNITO
@@ -607,8 +614,8 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, Disposition_IncognitoRefocus) {
// We should now have two windows, the browser() provided by the framework and
// the incognito window we opened earlier.
EXPECT_EQ(2u, BrowserList::size());
- EXPECT_EQ(1, browser()->tab_count());
- EXPECT_EQ(2, incognito_browser->tab_count());
+ EXPECT_EQ(1, browser()->tab_strip_model()->count());
+ EXPECT_EQ(2, incognito_browser->tab_strip_model()->count());
}
// This test verifies that no navigation action occurs when
@@ -644,7 +651,7 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, TargetContents_ForegroundTab) {
// We should have one window, with two tabs.
EXPECT_EQ(1u, BrowserList::size());
- EXPECT_EQ(2, browser()->tab_count());
+ EXPECT_EQ(2, browser()->tab_strip_model()->count());
}
#if defined(OS_WIN)
@@ -681,8 +688,8 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, DISABLED_TargetContents_Popup) {
// We should have two windows, the new popup and the browser() provided by the
// framework.
EXPECT_EQ(2u, BrowserList::size());
- EXPECT_EQ(1, browser()->tab_count());
- EXPECT_EQ(1, p.browser->tab_count());
+ EXPECT_EQ(1, browser()->tab_strip_model()->count());
+ EXPECT_EQ(1, p.browser->tab_strip_model()->count());
}
#endif
@@ -705,7 +712,7 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, Tabstrip_InsertAtIndex) {
// We should have one window - the browser() provided by the framework.
EXPECT_EQ(1u, BrowserList::size());
- EXPECT_EQ(2, browser()->tab_count());
+ EXPECT_EQ(2, browser()->tab_strip_model()->count());
}
// This test verifies that constructing params with disposition = SINGLETON_TAB
@@ -718,8 +725,8 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
// We should have one browser with 2 tabs, the 2nd selected.
EXPECT_EQ(1u, BrowserList::size());
- EXPECT_EQ(2, browser()->tab_count());
- EXPECT_EQ(1, browser()->active_index());
+ EXPECT_EQ(2, browser()->tab_strip_model()->count());
+ EXPECT_EQ(1, browser()->tab_strip_model()->active_index());
// Navigate to a new singleton tab with a sub-page.
chrome::NavigateParams p(MakeNavigateParams());
@@ -732,10 +739,11 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
// The last tab should now be selected and navigated to the sub-page of the
// URL.
EXPECT_EQ(browser(), p.browser);
- EXPECT_EQ(3, browser()->tab_count());
- EXPECT_EQ(2, browser()->active_index());
+ EXPECT_EQ(3, browser()->tab_strip_model()->count());
+ EXPECT_EQ(2, browser()->tab_strip_model()->active_index());
EXPECT_EQ(GetContentSettingsURL(),
- ShortenUberURL(chrome::GetActiveWebContents(browser())->GetURL()));
+ ShortenUberURL(browser()->tab_strip_model()->
+ GetActiveWebContents()->GetURL()));
}
// This test verifies that constructing params with disposition = SINGLETON_TAB
@@ -751,8 +759,8 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
// We should have one browser with 3 tabs, the 3rd selected.
EXPECT_EQ(1u, BrowserList::size());
- EXPECT_EQ(3, browser()->tab_count());
- EXPECT_EQ(2, browser()->active_index());
+ EXPECT_EQ(3, browser()->tab_strip_model()->count());
+ EXPECT_EQ(2, browser()->tab_strip_model()->active_index());
// Navigate to singleton_url1.
chrome::NavigateParams p(MakeNavigateParams());
@@ -765,10 +773,11 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
// The middle tab should now be selected and navigated to the sub-page of the
// URL.
EXPECT_EQ(browser(), p.browser);
- EXPECT_EQ(3, browser()->tab_count());
- EXPECT_EQ(1, browser()->active_index());
+ EXPECT_EQ(3, browser()->tab_strip_model()->count());
+ EXPECT_EQ(1, browser()->tab_strip_model()->active_index());
EXPECT_EQ(GetContentSettingsURL(),
- ShortenUberURL(chrome::GetActiveWebContents(browser())->GetURL()));
+ ShortenUberURL(browser()->tab_strip_model()->
+ GetActiveWebContents()->GetURL()));
}
// This test verifies that constructing params with disposition = SINGLETON_TAB
@@ -784,8 +793,8 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
// We should have one browser with 3 tabs, the 3rd selected.
EXPECT_EQ(1u, BrowserList::size());
- EXPECT_EQ(3, browser()->tab_count());
- EXPECT_EQ(2, browser()->active_index());
+ EXPECT_EQ(3, browser()->tab_strip_model()->count());
+ EXPECT_EQ(2, browser()->tab_strip_model()->active_index());
// Navigate to singleton_url1.
chrome::NavigateParams p(MakeNavigateParams());
@@ -798,10 +807,11 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
// The middle tab should now be selected and navigated to the sub-page of the
// URL.
EXPECT_EQ(browser(), p.browser);
- EXPECT_EQ(3, browser()->tab_count());
- EXPECT_EQ(1, browser()->active_index());
+ EXPECT_EQ(3, browser()->tab_strip_model()->count());
+ EXPECT_EQ(1, browser()->tab_strip_model()->active_index());
EXPECT_EQ(GetClearBrowsingDataURL(),
- ShortenUberURL(chrome::GetActiveWebContents(browser())->GetURL()));
+ ShortenUberURL(browser()->tab_strip_model()->
+ GetActiveWebContents()->GetURL()));
}
// This test verifies that constructing params with disposition = SINGLETON_TAB
@@ -817,8 +827,8 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
// We should have one browser with 3 tabs, the 3rd selected.
EXPECT_EQ(1u, BrowserList::size());
- EXPECT_EQ(3, browser()->tab_count());
- EXPECT_EQ(2, browser()->active_index());
+ EXPECT_EQ(3, browser()->tab_strip_model()->count());
+ EXPECT_EQ(2, browser()->tab_strip_model()->active_index());
// Navigate to singleton_url1.
chrome::NavigateParams p(MakeNavigateParams());
@@ -830,10 +840,11 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
// The middle tab should now be selected.
EXPECT_EQ(browser(), p.browser);
- EXPECT_EQ(3, browser()->tab_count());
- EXPECT_EQ(1, browser()->active_index());
+ EXPECT_EQ(3, browser()->tab_strip_model()->count());
+ EXPECT_EQ(1, browser()->tab_strip_model()->active_index());
EXPECT_EQ(singleton_url1,
- ShortenUberURL(chrome::GetActiveWebContents(browser())->GetURL()));
+ ShortenUberURL(browser()->tab_strip_model()->
+ GetActiveWebContents()->GetURL()));
}
// This test verifies that constructing params with disposition = SINGLETON_TAB
@@ -847,8 +858,8 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
// We should have one browser with 2 tabs, the 2nd selected.
EXPECT_EQ(1u, BrowserList::size());
- EXPECT_EQ(2, browser()->tab_count());
- EXPECT_EQ(1, browser()->active_index());
+ EXPECT_EQ(2, browser()->tab_strip_model()->count());
+ EXPECT_EQ(1, browser()->tab_strip_model()->active_index());
// Navigate to a different settings path.
GURL singleton_url_target(GetClearBrowsingDataURL());
@@ -861,10 +872,11 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
// The second tab should still be selected, but navigated to the new path.
EXPECT_EQ(browser(), p.browser);
- EXPECT_EQ(2, browser()->tab_count());
- EXPECT_EQ(1, browser()->active_index());
+ EXPECT_EQ(2, browser()->tab_strip_model()->count());
+ EXPECT_EQ(1, browser()->tab_strip_model()->active_index());
EXPECT_EQ(singleton_url_target,
- ShortenUberURL(chrome::GetActiveWebContents(browser())->GetURL()));
+ ShortenUberURL(browser()->tab_strip_model()->
+ GetActiveWebContents()->GetURL()));
}
// This test verifies that constructing params with disposition = SINGLETON_TAB
@@ -872,13 +884,13 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
// query.
IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
Disposition_SingletonTabExisting_IgnoreQuery) {
- int initial_tab_count = browser()->tab_count();
+ int initial_tab_count = browser()->tab_strip_model()->count();
GURL singleton_url_current("chrome://settings/internet");
chrome::AddSelectedTabWithURL(browser(), singleton_url_current,
content::PAGE_TRANSITION_LINK);
- EXPECT_EQ(initial_tab_count + 1, browser()->tab_count());
- EXPECT_EQ(initial_tab_count, browser()->active_index());
+ EXPECT_EQ(initial_tab_count + 1, browser()->tab_strip_model()->count());
+ EXPECT_EQ(initial_tab_count, browser()->tab_strip_model()->active_index());
// Navigate to a different settings path.
GURL singleton_url_target(
@@ -893,8 +905,8 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
// Last tab should still be selected.
EXPECT_EQ(browser(), p.browser);
- EXPECT_EQ(initial_tab_count + 1, browser()->tab_count());
- EXPECT_EQ(initial_tab_count, browser()->active_index());
+ EXPECT_EQ(initial_tab_count + 1, browser()->tab_strip_model()->count());
+ EXPECT_EQ(initial_tab_count, browser()->tab_strip_model()->active_index());
}
// This test verifies that the settings page isn't opened in the incognito
@@ -923,7 +935,8 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
EXPECT_EQ(1u, BrowserList::size());
EXPECT_EQ(GetSettingsURL(),
- ShortenUberURL(chrome::GetActiveWebContents(browser())->GetURL()));
+ ShortenUberURL(browser()->tab_strip_model()->
+ GetActiveWebContents()->GetURL()));
}
// Settings page is expected to always open in normal mode regardless
@@ -977,8 +990,8 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
// We should have one browser with 2 tabs, the 2nd selected.
EXPECT_EQ(1u, BrowserList::size());
- EXPECT_EQ(2, browser()->tab_count());
- EXPECT_EQ(1, browser()->active_index());
+ EXPECT_EQ(2, browser()->tab_strip_model()->count());
+ EXPECT_EQ(1, browser()->tab_strip_model()->active_index());
// Kill the singleton tab.
web_contents->SetIsCrashed(base::TERMINATION_STATUS_PROCESS_CRASHED, -1);
@@ -1004,9 +1017,10 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
chrome::ShowSettings(browser());
observer.Wait();
}
- EXPECT_EQ(1, browser()->tab_count());
+ EXPECT_EQ(1, browser()->tab_strip_model()->count());
EXPECT_EQ(GetSettingsURL(),
- ShortenUberURL(chrome::GetActiveWebContents(browser())->GetURL()));
+ ShortenUberURL(browser()->tab_strip_model()->
+ GetActiveWebContents()->GetURL()));
}
IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
@@ -1022,9 +1036,10 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
chrome::ShowSettings(browser());
observer.Wait();
}
- EXPECT_EQ(1, browser()->tab_count());
+ EXPECT_EQ(1, browser()->tab_strip_model()->count());
EXPECT_EQ(GetSettingsURL(),
- ShortenUberURL(chrome::GetActiveWebContents(browser())->GetURL()));
+ ShortenUberURL(browser()->tab_strip_model()->
+ GetActiveWebContents()->GetURL()));
}
IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
@@ -1032,9 +1047,9 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
chrome::NavigateParams p(MakeNavigateParams());
p.url = GURL(chrome::kChromeUINewTabURL);
ui_test_utils::NavigateToURL(&p);
- EXPECT_EQ(1, browser()->tab_count());
+ EXPECT_EQ(1, browser()->tab_strip_model()->count());
EXPECT_EQ(GURL(chrome::kChromeUINewTabURL),
- chrome::GetActiveWebContents(browser())->GetURL());
+ browser()->tab_strip_model()->GetActiveWebContents()->GetURL());
{
content::WindowedNotificationObserver observer(
@@ -1043,18 +1058,20 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
chrome::ShowSettings(browser());
observer.Wait();
}
- EXPECT_EQ(1, browser()->tab_count());
+ EXPECT_EQ(1, browser()->tab_strip_model()->count());
EXPECT_EQ(GetSettingsURL(),
- ShortenUberURL(chrome::GetActiveWebContents(browser())->GetURL()));
+ ShortenUberURL(browser()->tab_strip_model()->
+ GetActiveWebContents()->GetURL()));
}
IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
NavigateFromPageToOptionsInNewTab) {
chrome::NavigateParams p(MakeNavigateParams());
ui_test_utils::NavigateToURL(&p);
- EXPECT_EQ(GetGoogleURL(), chrome::GetActiveWebContents(browser())->GetURL());
+ EXPECT_EQ(GetGoogleURL(),
+ browser()->tab_strip_model()->GetActiveWebContents()->GetURL());
EXPECT_EQ(1u, BrowserList::size());
- EXPECT_EQ(1, browser()->tab_count());
+ EXPECT_EQ(1, browser()->tab_strip_model()->count());
{
content::WindowedNotificationObserver observer(
@@ -1063,9 +1080,10 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
chrome::ShowSettings(browser());
observer.Wait();
}
- EXPECT_EQ(2, browser()->tab_count());
+ EXPECT_EQ(2, browser()->tab_strip_model()->count());
EXPECT_EQ(GetSettingsURL(),
- ShortenUberURL(chrome::GetActiveWebContents(browser())->GetURL()));
+ ShortenUberURL(browser()->tab_strip_model()->
+ GetActiveWebContents()->GetURL()));
}
IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
@@ -1077,10 +1095,10 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
chrome::ShowSettings(browser());
observer.Wait();
}
- EXPECT_EQ(1, browser()->tab_count());
+ EXPECT_EQ(1, browser()->tab_strip_model()->count());
chrome::NewTab(browser());
- EXPECT_EQ(2, browser()->tab_count());
+ EXPECT_EQ(2, browser()->tab_strip_model()->count());
{
content::WindowedNotificationObserver observer(
@@ -1089,9 +1107,10 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
chrome::ShowSettings(browser());
observer.Wait();
}
- EXPECT_EQ(2, browser()->tab_count());
+ EXPECT_EQ(2, browser()->tab_strip_model()->count());
EXPECT_EQ(GetSettingsURL(),
- ShortenUberURL(chrome::GetActiveWebContents(browser())->GetURL()));
+ ShortenUberURL(browser()->tab_strip_model()->
+ GetActiveWebContents()->GetURL()));
}
IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
@@ -1103,12 +1122,12 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
chrome::ShowClearBrowsingDataDialog(browser());
observer.Wait();
}
- EXPECT_EQ(1, browser()->tab_count());
+ EXPECT_EQ(1, browser()->tab_strip_model()->count());
EXPECT_EQ(GetClearBrowsingDataURL(),
- chrome::GetActiveWebContents(browser())->GetURL());
+ browser()->tab_strip_model()->GetActiveWebContents()->GetURL());
chrome::NewTab(browser());
- EXPECT_EQ(2, browser()->tab_count());
+ EXPECT_EQ(2, browser()->tab_strip_model()->count());
{
content::WindowedNotificationObserver observer(
@@ -1117,9 +1136,9 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
chrome::ShowClearBrowsingDataDialog(browser());
observer.Wait();
}
- EXPECT_EQ(2, browser()->tab_count());
+ EXPECT_EQ(2, browser()->tab_strip_model()->count());
EXPECT_EQ(GetClearBrowsingDataURL(),
- chrome::GetActiveWebContents(browser())->GetURL());
+ browser()->tab_strip_model()->GetActiveWebContents()->GetURL());
}
// Times out on mac, fails on linux.
@@ -1154,9 +1173,10 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
chrome::ShowSettings(browser());
observer.Wait();
}
- EXPECT_EQ(2, browser()->tab_count());
+ EXPECT_EQ(2, browser()->tab_strip_model()->count());
EXPECT_EQ(GetSettingsURL(),
- ShortenUberURL(chrome::GetActiveWebContents(browser())->GetURL()));
+ ShortenUberURL(browser()->tab_strip_model()->
+ GetActiveWebContents()->GetURL()));
}
// TODO(csilv): Update this for uber page. http://crbug.com/111579.
@@ -1169,9 +1189,9 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
chrome::ShowHistory(browser());
observer.Wait();
}
- EXPECT_EQ(1, browser()->tab_count());
+ EXPECT_EQ(1, browser()->tab_strip_model()->count());
EXPECT_EQ(GURL(chrome::kChromeUIHistoryFrameURL),
- chrome::GetActiveWebContents(browser())->GetURL());
+ browser()->tab_strip_model()->GetActiveWebContents()->GetURL());
}
IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
@@ -1183,9 +1203,9 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
chrome::ShowBookmarkManager(browser());
observer.Wait();
}
- EXPECT_EQ(1, browser()->tab_count());
+ EXPECT_EQ(1, browser()->tab_strip_model()->count());
EXPECT_EQ(GURL(chrome::kChromeUIBookmarksURL),
- chrome::GetActiveWebContents(browser())->GetURL());
+ browser()->tab_strip_model()->GetActiveWebContents()->GetURL());
}
IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
@@ -1197,9 +1217,9 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
chrome::ShowDownloads(browser());
observer.Wait();
}
- EXPECT_EQ(1, browser()->tab_count());
+ EXPECT_EQ(1, browser()->tab_strip_model()->count());
EXPECT_EQ(GURL(chrome::kChromeUIDownloadsURL),
- chrome::GetActiveWebContents(browser())->GetURL());
+ browser()->tab_strip_model()->GetActiveWebContents()->GetURL());
}
IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
diff --git a/chrome/browser/ui/browser_navigator_browsertest_chromeos.cc b/chrome/browser/ui/browser_navigator_browsertest_chromeos.cc
index 53066fd..4c61752 100644
--- a/chrome/browser/ui/browser_navigator_browsertest_chromeos.cc
+++ b/chrome/browser/ui/browser_navigator_browsertest_chromeos.cc
@@ -9,7 +9,7 @@
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_list.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/common/chrome_switches.h"
#include "chrome/test/base/ui_test_utils.h"
#include "content/public/browser/web_contents.h"
@@ -39,8 +39,8 @@ IN_PROC_BROWSER_TEST_F(BrowserGuestSessionNavigatorTest,
Browser* incognito_browser = CreateIncognitoBrowser();
EXPECT_EQ(2u, BrowserList::size());
- EXPECT_EQ(1, browser()->tab_count());
- EXPECT_EQ(1, incognito_browser->tab_count());
+ EXPECT_EQ(1, browser()->tab_strip_model()->count());
+ EXPECT_EQ(1, incognito_browser->tab_strip_model()->count());
// Navigate to the settings page.
chrome::NavigateParams p(MakeNavigateParams(incognito_browser));
@@ -53,9 +53,10 @@ IN_PROC_BROWSER_TEST_F(BrowserGuestSessionNavigatorTest,
// Settings page should be opened in incognito window.
EXPECT_NE(browser(), p.browser);
EXPECT_EQ(incognito_browser, p.browser);
- EXPECT_EQ(2, incognito_browser->tab_count());
+ EXPECT_EQ(2, incognito_browser->tab_strip_model()->count());
EXPECT_EQ(GURL("chrome://chrome/settings"),
- chrome::GetActiveWebContents(incognito_browser)->GetURL());
+ incognito_browser->tab_strip_model()->GetActiveWebContents()->
+ GetURL());
}
} // namespace
diff --git a/chrome/browser/ui/browser_tab_restore_service_delegate.cc b/chrome/browser/ui/browser_tab_restore_service_delegate.cc
index e60690a..9ae1bab 100644
--- a/chrome/browser/ui/browser_tab_restore_service_delegate.cc
+++ b/chrome/browser/ui/browser_tab_restore_service_delegate.cc
@@ -8,7 +8,6 @@
#include "chrome/browser/ui/browser_commands.h"
#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/browser_tabrestore.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 "content/public/browser/navigation_controller.h"
@@ -26,11 +25,11 @@ const SessionID& BrowserTabRestoreServiceDelegate::GetSessionID() const {
}
int BrowserTabRestoreServiceDelegate::GetTabCount() const {
- return browser_->tab_count();
+ return browser_->tab_strip_model()->count();
}
int BrowserTabRestoreServiceDelegate::GetSelectedIndex() const {
- return browser_->active_index();
+ return browser_->tab_strip_model()->active_index();
}
std::string BrowserTabRestoreServiceDelegate::GetAppName() const {
@@ -39,11 +38,11 @@ std::string BrowserTabRestoreServiceDelegate::GetAppName() const {
WebContents* BrowserTabRestoreServiceDelegate::GetWebContentsAt(
int index) const {
- return chrome::GetWebContentsAt(browser_, index);
+ return browser_->tab_strip_model()->GetWebContentsAt(index);
}
WebContents* BrowserTabRestoreServiceDelegate::GetActiveWebContents() const {
- return chrome::GetActiveWebContents(browser_);
+ return browser_->tab_strip_model()->GetActiveWebContents();
}
bool BrowserTabRestoreServiceDelegate::IsTabPinned(int index) const {
diff --git a/chrome/browser/ui/browser_tab_strip_model_delegate.cc b/chrome/browser/ui/browser_tab_strip_model_delegate.cc
index 62c401d..37d2e55 100644
--- a/chrome/browser/ui/browser_tab_strip_model_delegate.cc
+++ b/chrome/browser/ui/browser_tab_strip_model_delegate.cc
@@ -90,7 +90,8 @@ void BrowserTabStripModelDelegate::WillAddWebContents(
int BrowserTabStripModelDelegate::GetDragActions() const {
return TabStripModelDelegate::TAB_TEAROFF_ACTION |
- (browser_->tab_count() > 1 ? TabStripModelDelegate::TAB_MOVE_ACTION : 0);
+ (browser_->tab_strip_model()->count() > 1
+ ? TabStripModelDelegate::TAB_MOVE_ACTION : 0);
}
bool BrowserTabStripModelDelegate::CanDuplicateContentsAt(int index) {
diff --git a/chrome/browser/ui/chrome_pages.cc b/chrome/browser/ui/chrome_pages.cc
index 999ea18..1041ad2 100644
--- a/chrome/browser/ui/chrome_pages.cc
+++ b/chrome/browser/ui/chrome_pages.cc
@@ -16,6 +16,7 @@
#include "chrome/browser/ui/browser_navigator.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/singleton_tabs.h"
+#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/browser/ui/webui/options/content_settings_handler.h"
#include "chrome/browser/ui/webui/signin/login_ui_service.h"
#include "chrome/browser/ui/webui/signin/login_ui_service_factory.h"
@@ -217,7 +218,7 @@ void ShowSyncSetup(Browser* browser, SyncPromoUI::Source source) {
}
}
- DCHECK_GT(browser->tab_count(), 0);
+ DCHECK_GT(browser->tab_strip_model()->count(), 0);
}
}
diff --git a/chrome/browser/ui/cocoa/browser_window_controller.mm b/chrome/browser/ui/cocoa/browser_window_controller.mm
index bbbc107..ef9b999 100644
--- a/chrome/browser/ui/cocoa/browser_window_controller.mm
+++ b/chrome/browser/ui/cocoa/browser_window_controller.mm
@@ -1479,7 +1479,7 @@ enum {
- (NSInteger)numberOfTabs {
// count() includes pinned tabs.
- return browser_->tab_count();
+ return browser_->tab_strip_model()->count();
}
- (BOOL)hasLiveTabs {
diff --git a/chrome/browser/ui/singleton_tabs.cc b/chrome/browser/ui/singleton_tabs.cc
index 4059403..0d0a39e 100644
--- a/chrome/browser/ui/singleton_tabs.cc
+++ b/chrome/browser/ui/singleton_tabs.cc
@@ -84,8 +84,9 @@ int GetIndexOfSingletonTab(NavigateParams* params) {
&reverse_on_redirect);
// If there are several matches: prefer the active tab by starting there.
- int start_index = std::max(0, params->browser->active_index());
- int tab_count = params->browser->tab_count();
+ int start_index =
+ std::max(0, params->browser->tab_strip_model()->active_index());
+ int tab_count = params->browser->tab_strip_model()->count();
for (int i = 0; i < tab_count; ++i) {
int tab_index = (start_index + i) % tab_count;
content::WebContents* tab =
diff --git a/chrome/browser/ui/startup/startup_browser_creator_browsertest.cc b/chrome/browser/ui/startup/startup_browser_creator_browsertest.cc
index b700056..0e8df4bf 100644
--- a/chrome/browser/ui/startup/startup_browser_creator_browsertest.cc
+++ b/chrome/browser/ui/startup/startup_browser_creator_browsertest.cc
@@ -22,7 +22,6 @@
#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/browser_list.h"
#include "chrome/browser/ui/browser_list_observer.h"
-#include "chrome/browser/ui/browser_tabstrip.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/startup/startup_browser_creator.h"
#include "chrome/browser/ui/startup/startup_browser_creator_impl.h"
@@ -192,15 +191,16 @@ IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest,
ASSERT_NO_FATAL_FAILURE(FindOneOtherBrowser(&new_browser));
// 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());
for (size_t i=0; i < urls.size(); i++) {
- EXPECT_EQ(urls[i], chrome::GetWebContentsAt(new_browser, i)->GetURL());
+ EXPECT_EQ(urls[i], tab_strip->GetWebContentsAt(i)->GetURL());
}
// The two tabs, despite having the same site, should be in different
// SiteInstances.
- EXPECT_NE(chrome::GetWebContentsAt(new_browser, 0)->GetSiteInstance(),
- chrome::GetWebContentsAt(new_browser, 1)->GetSiteInstance());
+ EXPECT_NE(tab_strip->GetWebContentsAt(0)->GetSiteInstance(),
+ tab_strip->GetWebContentsAt(1)->GetSiteInstance());
}
// Verify that startup URLs aren't used when the process already exists
@@ -601,14 +601,16 @@ IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, StartupURLsForTwoProfiles) {
ASSERT_EQ(2u, chrome::GetBrowserCount(default_profile));
new_browser = FindOneOtherBrowserForProfile(default_profile, browser());
ASSERT_TRUE(new_browser);
- ASSERT_EQ(1, new_browser->tab_count());
- EXPECT_EQ(urls1[0], chrome::GetWebContentsAt(new_browser, 0)->GetURL());
+ TabStripModel* tab_strip = new_browser->tab_strip_model();
+ ASSERT_EQ(1, tab_strip->count());
+ EXPECT_EQ(urls1[0], tab_strip->GetWebContentsAt(0)->GetURL());
ASSERT_EQ(1u, chrome::GetBrowserCount(other_profile));
new_browser = FindOneOtherBrowserForProfile(other_profile, NULL);
ASSERT_TRUE(new_browser);
- ASSERT_EQ(1, new_browser->tab_count());
- EXPECT_EQ(urls2[0], chrome::GetWebContentsAt(new_browser, 0)->GetURL());
+ tab_strip = new_browser->tab_strip_model();
+ ASSERT_EQ(1, tab_strip->count());
+ EXPECT_EQ(urls2[0], tab_strip->GetWebContentsAt(0)->GetURL());
}
IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, UpdateWithTwoProfiles) {
@@ -671,16 +673,18 @@ IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, UpdateWithTwoProfiles) {
ASSERT_EQ(1u, chrome::GetBrowserCount(profile1));
new_browser = FindOneOtherBrowserForProfile(profile1, NULL);
ASSERT_TRUE(new_browser);
- ASSERT_EQ(1, new_browser->tab_count());
+ TabStripModel* tab_strip = new_browser->tab_strip_model();
+ ASSERT_EQ(1, tab_strip->count());
EXPECT_EQ(GURL(chrome::kAboutBlankURL),
- chrome::GetWebContentsAt(new_browser, 0)->GetURL());
+ tab_strip->GetWebContentsAt(0)->GetURL());
ASSERT_EQ(1u, chrome::GetBrowserCount(profile2));
new_browser = FindOneOtherBrowserForProfile(profile2, NULL);
ASSERT_TRUE(new_browser);
- ASSERT_EQ(1, new_browser->tab_count());
+ tab_strip = new_browser->tab_strip_model();
+ ASSERT_EQ(1, tab_strip->count());
EXPECT_EQ(GURL(chrome::kAboutBlankURL),
- chrome::GetWebContentsAt(new_browser, 0)->GetURL());
+ tab_strip->GetWebContentsAt(0)->GetURL());
}
IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest,
@@ -756,24 +760,27 @@ IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest,
ASSERT_EQ(1u, chrome::GetBrowserCount(profile_home1));
new_browser = FindOneOtherBrowserForProfile(profile_home1, NULL);
ASSERT_TRUE(new_browser);
- ASSERT_EQ(1, new_browser->tab_count());
+ TabStripModel* tab_strip = new_browser->tab_strip_model();
+ ASSERT_EQ(1, tab_strip->count());
EXPECT_EQ(GURL(chrome::kChromeUINewTabURL),
- chrome::GetWebContentsAt(new_browser, 0)->GetURL());
+ tab_strip->GetWebContentsAt(0)->GetURL());
// profile_urls opened the urls.
ASSERT_EQ(1u, chrome::GetBrowserCount(profile_urls));
new_browser = FindOneOtherBrowserForProfile(profile_urls, NULL);
ASSERT_TRUE(new_browser);
- ASSERT_EQ(1, new_browser->tab_count());
- EXPECT_EQ(urls[0], chrome::GetWebContentsAt(new_browser, 0)->GetURL());
+ tab_strip = new_browser->tab_strip_model();
+ ASSERT_EQ(1, tab_strip->count());
+ EXPECT_EQ(urls[0], tab_strip->GetWebContentsAt(0)->GetURL());
// profile_last opened the last open pages.
ASSERT_EQ(1u, chrome::GetBrowserCount(profile_last));
new_browser = FindOneOtherBrowserForProfile(profile_last, NULL);
ASSERT_TRUE(new_browser);
- ASSERT_EQ(1, new_browser->tab_count());
+ tab_strip = new_browser->tab_strip_model();
+ ASSERT_EQ(1, tab_strip->count());
EXPECT_EQ(GURL(chrome::kAboutBlankURL),
- chrome::GetWebContentsAt(new_browser, 0)->GetURL());
+ tab_strip->GetWebContentsAt(0)->GetURL());
// profile_home2 was not launched since it would've only opened the home page.
ASSERT_EQ(0u, chrome::GetBrowserCount(profile_home2));
@@ -846,10 +853,10 @@ IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, ProfilesLaunchedAfterCrash) {
ASSERT_EQ(1u, chrome::GetBrowserCount(profile_home));
new_browser = FindOneOtherBrowserForProfile(profile_home, NULL);
ASSERT_TRUE(new_browser);
- ASSERT_EQ(1, new_browser->tab_count());
- content::WebContents* web_contents = chrome::GetWebContentsAt(new_browser, 0);
- EXPECT_EQ(GURL(chrome::kChromeUINewTabURL),
- web_contents->GetURL());
+ TabStripModel* tab_strip = new_browser->tab_strip_model();
+ ASSERT_EQ(1, tab_strip->count());
+ content::WebContents* web_contents = tab_strip->GetWebContentsAt(0);
+ EXPECT_EQ(GURL(chrome::kChromeUINewTabURL), web_contents->GetURL());
EXPECT_EQ(1U,
InfoBarService::FromWebContents(web_contents)->GetInfoBarCount());
@@ -857,10 +864,10 @@ IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, ProfilesLaunchedAfterCrash) {
ASSERT_EQ(1u, chrome::GetBrowserCount(profile_last));
new_browser = FindOneOtherBrowserForProfile(profile_last, NULL);
ASSERT_TRUE(new_browser);
- ASSERT_EQ(1, new_browser->tab_count());
- web_contents = chrome::GetWebContentsAt(new_browser, 0);
- EXPECT_EQ(GURL(chrome::kChromeUINewTabURL),
- web_contents->GetURL());
+ tab_strip = new_browser->tab_strip_model();
+ ASSERT_EQ(1, tab_strip->count());
+ web_contents = tab_strip->GetWebContentsAt(0);
+ EXPECT_EQ(GURL(chrome::kChromeUINewTabURL), web_contents->GetURL());
EXPECT_EQ(1U,
InfoBarService::FromWebContents(web_contents)->GetInfoBarCount());
@@ -868,10 +875,10 @@ IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, ProfilesLaunchedAfterCrash) {
ASSERT_EQ(1u, chrome::GetBrowserCount(profile_urls));
new_browser = FindOneOtherBrowserForProfile(profile_urls, NULL);
ASSERT_TRUE(new_browser);
- ASSERT_EQ(1, new_browser->tab_count());
- web_contents = chrome::GetWebContentsAt(new_browser, 0);
- EXPECT_EQ(GURL(chrome::kChromeUINewTabURL),
- web_contents->GetURL());
+ tab_strip = new_browser->tab_strip_model();
+ ASSERT_EQ(1, tab_strip->count());
+ web_contents = tab_strip->GetWebContentsAt(0);
+ EXPECT_EQ(GURL(chrome::kChromeUINewTabURL), web_contents->GetURL());
EXPECT_EQ(1U,
InfoBarService::FromWebContents(web_contents)->GetInfoBarCount());
}
diff --git a/chrome/browser/ui/startup/startup_browser_creator_impl.cc b/chrome/browser/ui/startup/startup_browser_creator_impl.cc
index 31c3390..985086f 100644
--- a/chrome/browser/ui/startup/startup_browser_creator_impl.cc
+++ b/chrome/browser/ui/startup/startup_browser_creator_impl.cc
@@ -834,7 +834,7 @@ Browser* StartupBrowserCreatorImpl::OpenTabsInBrowser(Browser* browser,
}
if (!chrome::GetActiveWebContents(browser)) {
// TODO: this is a work around for 110909. Figure out why it's needed.
- if (!browser->tab_count())
+ if (!browser->tab_strip_model()->count())
chrome::AddBlankTabAt(browser, -1, true);
else
browser->tab_strip_model()->ActivateTabAt(0, false);
@@ -853,7 +853,7 @@ Browser* StartupBrowserCreatorImpl::OpenTabsInBrowser(Browser* browser,
void StartupBrowserCreatorImpl::AddInfoBarsIfNecessary(
Browser* browser,
chrome::startup::IsProcessStartup is_process_startup) {
- if (!browser || !profile_ || browser->tab_count() == 0)
+ if (!browser || !profile_ || browser->tab_strip_model()->count() == 0)
return;
if (HasPendingUncleanExit(browser->profile()))
diff --git a/chrome/browser/ui/sync/browser_synced_window_delegate.cc b/chrome/browser/ui/sync/browser_synced_window_delegate.cc
index ff9a69d..1b64be4 100644
--- a/chrome/browser/ui/sync/browser_synced_window_delegate.cc
+++ b/chrome/browser/ui/sync/browser_synced_window_delegate.cc
@@ -10,7 +10,6 @@
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/browser_list.h"
-#include "chrome/browser/ui/browser_tabstrip.h"
#include "chrome/browser/ui/sync/tab_contents_synced_tab_delegate.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
@@ -45,7 +44,7 @@ BrowserSyncedWindowDelegate::~BrowserSyncedWindowDelegate() {}
bool BrowserSyncedWindowDelegate::IsTabPinned(
const browser_sync::SyncedTabDelegate* tab) const {
- for (int i = 0; i < browser_->tab_count(); i++) {
+ for (int i = 0; i < browser_->tab_strip_model()->count(); i++) {
browser_sync::SyncedTabDelegate* current = GetTabAt(i);
if (tab == current)
return browser_->tab_strip_model()->IsTabPinned(i);
@@ -57,7 +56,7 @@ bool BrowserSyncedWindowDelegate::IsTabPinned(
browser_sync::SyncedTabDelegate* BrowserSyncedWindowDelegate::GetTabAt(
int index) const {
return TabContentsSyncedTabDelegate::FromWebContents(
- chrome::GetWebContentsAt(browser_, index));
+ browser_->tab_strip_model()->GetWebContentsAt(index));
}
SessionID::id_type BrowserSyncedWindowDelegate::GetTabIdAt(int index) const {
@@ -73,11 +72,11 @@ SessionID::id_type BrowserSyncedWindowDelegate::GetSessionId() const {
}
int BrowserSyncedWindowDelegate::GetTabCount() const {
- return browser_->tab_count();
+ return browser_->tab_strip_model()->count();
}
int BrowserSyncedWindowDelegate::GetActiveIndex() const {
- return browser_->active_index();
+ return browser_->tab_strip_model()->active_index();
}
bool BrowserSyncedWindowDelegate::IsApp() const {
diff --git a/chrome/browser/ui/uma_browsing_activity_observer.cc b/chrome/browser/ui/uma_browsing_activity_observer.cc
index 1687218..a5710e4 100644
--- a/chrome/browser/ui/uma_browsing_activity_observer.cc
+++ b/chrome/browser/ui/uma_browsing_activity_observer.cc
@@ -8,6 +8,7 @@
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_list.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 "content/public/browser/navigation_details.h"
#include "content/public/browser/notification_service.h"
@@ -76,13 +77,15 @@ void UMABrowsingActivityObserver::LogBrowserTabCount() const {
// Record how many tabs each window has open.
Browser* browser = (*browser_iterator);
UMA_HISTOGRAM_CUSTOM_COUNTS("Tabs.TabCountPerWindow",
- browser->tab_count(), 1, 200, 50);
- tab_count += browser->tab_count();
+ browser->tab_strip_model()->count(),
+ 1, 200, 50);
+ tab_count += browser->tab_strip_model()->count();
if (browser->window()->IsActive()) {
// Record how many tabs the active window has open.
UMA_HISTOGRAM_CUSTOM_COUNTS("Tabs.TabCountActiveWindow",
- browser->tab_count(), 1, 200, 50);
+ browser->tab_strip_model()->count(),
+ 1, 200, 50);
}
if (browser->is_app())
diff --git a/chrome/browser/ui/unload_controller.cc b/chrome/browser/ui/unload_controller.cc
index 5dbd6da..85aa8e7 100644
--- a/chrome/browser/ui/unload_controller.cc
+++ b/chrome/browser/ui/unload_controller.cc
@@ -82,7 +82,7 @@ bool UnloadController::ShouldCloseWindow() {
bool UnloadController::TabsNeedBeforeUnloadFired() {
if (tabs_needing_before_unload_fired_.empty()) {
- for (int i = 0; i < browser_->tab_count(); ++i) {
+ for (int i = 0; i < browser_->tab_strip_model()->count(); ++i) {
content::WebContents* contents =
browser_->tab_strip_model()->GetWebContentsAt(i);
if (contents->NeedToFireBeforeUnload())
diff --git a/chrome/browser/ui/webui/feedback_ui.cc b/chrome/browser/ui/webui/feedback_ui.cc
index 3983fc2..f5ff29f 100644
--- a/chrome/browser/ui/webui/feedback_ui.cc
+++ b/chrome/browser/ui/webui/feedback_ui.cc
@@ -169,7 +169,7 @@ std::string GetUserEmail() {
// Returns the index of the feedback tab if already open, -1 otherwise
int GetIndexOfFeedbackTab(Browser* browser) {
GURL feedback_url(chrome::kChromeUIFeedbackURL);
- for (int i = 0; i < browser->tab_count(); ++i) {
+ for (int i = 0; i < browser->tab_strip_model()->count(); ++i) {
WebContents* tab = browser->tab_strip_model()->GetWebContentsAt(i);
if (tab && tab->GetURL().GetWithEmptyPath() == feedback_url)
return i;
@@ -452,7 +452,7 @@ bool FeedbackHandler::Init() {
Browser* browser = chrome::FindBrowserWithID(session_id);
// Sanity checks.
- if (!browser || index >= browser->tab_count())
+ if (!browser || index >= browser->tab_strip_model()->count())
return false;
if (index >= 0) {
diff --git a/chrome/browser/ui/webui/ntp/app_launcher_handler.cc b/chrome/browser/ui/webui/ntp/app_launcher_handler.cc
index a2431bc..4bbcaa2 100644
--- a/chrome/browser/ui/webui/ntp/app_launcher_handler.cc
+++ b/chrome/browser/ui/webui/ntp/app_launcher_handler.cc
@@ -31,6 +31,7 @@
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/extensions/application_launch.h"
#include "chrome/browser/ui/extensions/extension_enable_flow.h"
+#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/browser/ui/webui/extensions/extension_icon_source.h"
#include "chrome/browser/ui/webui/ntp/new_tab_ui.h"
#include "chrome/browser/ui/webui/web_ui_util.h"
@@ -524,8 +525,10 @@ void AppLauncherHandler::HandleLaunchApp(const ListValue* args) {
WebContents* new_contents = OpenApplication(params);
// This will also destroy the handler, so do not perform any actions after.
- if (new_contents != old_contents && browser && browser->tab_count() > 1)
+ if (new_contents != old_contents && browser &&
+ browser->tab_strip_model()->count() > 1) {
chrome::CloseWebContents(browser, old_contents, true);
+ }
}
}
diff --git a/chrome/browser/ui/webui/ntp/suggestions_combiner.cc b/chrome/browser/ui/webui/ntp/suggestions_combiner.cc
index 6fcfc2d..1584625 100644
--- a/chrome/browser/ui/webui/ntp/suggestions_combiner.cc
+++ b/chrome/browser/ui/webui/ntp/suggestions_combiner.cc
@@ -12,7 +12,7 @@
#include "chrome/browser/profiles/profile.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/browser/ui/webui/ntp/suggestions_page_handler.h"
#include "chrome/browser/ui/webui/ntp/suggestions_source.h"
#include "chrome/browser/ui/webui/ntp/suggestions_source_discovery.h"
@@ -159,8 +159,9 @@ bool SuggestionsCombiner::IsUrlAlreadyOpen(const GURL &url) {
!browser->profile()->IsSameProfile(profile_))
continue;
- for (int i = 0; i < browser->tab_count(); i++) {
- const content::WebContents* tab = chrome::GetWebContentsAt(browser, i);
+ for (int i = 0; i < browser->tab_strip_model()->count(); i++) {
+ const content::WebContents* tab =
+ browser->tab_strip_model()->GetWebContentsAt(i);
if (tab->GetURL() == url)
return true;
}
diff --git a/chrome/browser/ui/webui/print_preview/print_preview_ui_browsertest.cc b/chrome/browser/ui/webui/print_preview/print_preview_ui_browsertest.cc
index 3359496..2c59b1e 100644
--- a/chrome/browser/ui/webui/print_preview/print_preview_ui_browsertest.cc
+++ b/chrome/browser/ui/webui/print_preview/print_preview_ui_browsertest.cc
@@ -6,6 +6,7 @@
#include "chrome/app/chrome_command_ids.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_commands.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"
@@ -38,7 +39,7 @@ class PrintPreviewTest : public InProcessBrowserTest {
IN_PROC_BROWSER_TEST_F(PrintPreviewTest, PrintCommands) {
// We start off at about:blank page.
// Make sure there is 1 tab and print is enabled.
- ASSERT_EQ(1, browser()->tab_count());
+ ASSERT_EQ(1, browser()->tab_strip_model()->count());
ASSERT_TRUE(chrome::IsCommandEnabled(browser(), IDC_PRINT));
diff --git a/chrome/browser/ui/webui/print_preview/print_preview_ui_unittest.cc b/chrome/browser/ui/webui/print_preview/print_preview_ui_unittest.cc
index f4e069b..79ecf52 100644
--- a/chrome/browser/ui/webui/print_preview/print_preview_ui_unittest.cc
+++ b/chrome/browser/ui/webui/print_preview/print_preview_ui_unittest.cc
@@ -81,7 +81,7 @@ TEST_F(PrintPreviewUIUnitTest, PrintPreviewData) {
controller->GetOrCreatePreviewDialog(initiator_tab);
EXPECT_NE(initiator_tab, preview_dialog);
- EXPECT_EQ(1, browser()->tab_count());
+ EXPECT_EQ(1, browser()->tab_strip_model()->count());
EXPECT_EQ(1U, GetConstrainedWindowCount(initiator_tab));
PrintPreviewUI* preview_ui = static_cast<PrintPreviewUI*>(
@@ -136,7 +136,7 @@ TEST_F(PrintPreviewUIUnitTest, PrintPreviewDraftPages) {
controller->GetOrCreatePreviewDialog(initiator_tab);
EXPECT_NE(initiator_tab, preview_dialog);
- EXPECT_EQ(1, browser()->tab_count());
+ EXPECT_EQ(1, browser()->tab_strip_model()->count());
EXPECT_EQ(1U, GetConstrainedWindowCount(initiator_tab));
PrintPreviewUI* preview_ui = static_cast<PrintPreviewUI*>(
@@ -198,7 +198,7 @@ TEST_F(PrintPreviewUIUnitTest, GetCurrentPrintPreviewStatus) {
controller->GetOrCreatePreviewDialog(initiator_tab);
EXPECT_NE(initiator_tab, preview_dialog);
- EXPECT_EQ(1, browser()->tab_count());
+ EXPECT_EQ(1, browser()->tab_strip_model()->count());
EXPECT_EQ(1U, GetConstrainedWindowCount(initiator_tab));
PrintPreviewUI* preview_ui = static_cast<PrintPreviewUI*>(
@@ -241,13 +241,13 @@ TEST_F(PrintPreviewUIUnitTest, GetCurrentPrintPreviewStatus) {
}
TEST_F(PrintPreviewUIUnitTest, InitiatorTabGetsFocusOnPrintPreviewDialogClose) {
- EXPECT_EQ(1, browser()->tab_count());
+ EXPECT_EQ(1, browser()->tab_strip_model()->count());
WebContents* initiator_tab =
WebContentsTester::CreateTestWebContentsCountFocus(profile(), NULL);
WebContentsTester* initiator_tester = WebContentsTester::For(initiator_tab);
chrome::AddWebContents(browser(), NULL, initiator_tab,
NEW_FOREGROUND_TAB, gfx::Rect(), false, NULL);
- EXPECT_EQ(2, browser()->tab_count());
+ EXPECT_EQ(2, browser()->tab_strip_model()->count());
EXPECT_EQ(0, initiator_tester->GetNumberOfFocusCalls());
printing::PrintPreviewDialogController* controller =
@@ -261,7 +261,7 @@ TEST_F(PrintPreviewUIUnitTest, InitiatorTabGetsFocusOnPrintPreviewDialogClose) {
controller->GetOrCreatePreviewDialog(initiator_tab);
EXPECT_NE(initiator_tab, preview_dialog);
- EXPECT_EQ(2, browser()->tab_count());
+ EXPECT_EQ(2, browser()->tab_strip_model()->count());
EXPECT_EQ(1U, GetConstrainedWindowCount(initiator_tab));
EXPECT_EQ(0, initiator_tester->GetNumberOfFocusCalls());
@@ -271,7 +271,7 @@ TEST_F(PrintPreviewUIUnitTest, InitiatorTabGetsFocusOnPrintPreviewDialogClose) {
preview_ui->OnPrintPreviewDialogClosed();
- EXPECT_EQ(2, browser()->tab_count());
+ EXPECT_EQ(2, browser()->tab_strip_model()->count());
EXPECT_EQ(0U, GetConstrainedWindowCount(initiator_tab));
EXPECT_EQ(1, initiator_tester->GetNumberOfFocusCalls());
}
diff --git a/chrome/browser/ui/webui/web_dialog_web_contents_delegate_unittest.cc b/chrome/browser/ui/webui/web_dialog_web_contents_delegate_unittest.cc
index 49c158d..d2607f5 100644
--- a/chrome/browser/ui/webui/web_dialog_web_contents_delegate_unittest.cc
+++ b/chrome/browser/ui/webui/web_dialog_web_contents_delegate_unittest.cc
@@ -11,6 +11,7 @@
#include "chrome/browser/history/history_types.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_list.h"
+#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/browser/ui/webui/chrome_web_contents_handler.h"
#include "chrome/common/url_constants.h"
#include "chrome/test/base/browser_with_test_window_test.h"
@@ -72,7 +73,7 @@ TEST_F(WebDialogWebContentsDelegateTest, DoNothingMethodsTest) {
test_web_contents_delegate_->CloseContents(NULL);
test_web_contents_delegate_->UpdateTargetURL(NULL, 0, GURL());
test_web_contents_delegate_->MoveContents(NULL, gfx::Rect());
- EXPECT_EQ(0, browser()->tab_count());
+ EXPECT_EQ(0, browser()->tab_strip_model()->count());
EXPECT_EQ(1U, BrowserList::size());
}
@@ -81,7 +82,7 @@ TEST_F(WebDialogWebContentsDelegateTest, OpenURLFromTabTest) {
NULL, OpenURLParams(GURL(chrome::kAboutBlankURL), Referrer(),
NEW_FOREGROUND_TAB, content::PAGE_TRANSITION_LINK, false));
// This should create a new foreground tab in the existing browser.
- EXPECT_EQ(1, browser()->tab_count());
+ EXPECT_EQ(1, browser()->tab_strip_model()->count());
EXPECT_EQ(1U, BrowserList::size());
}
@@ -91,7 +92,7 @@ TEST_F(WebDialogWebContentsDelegateTest, AddNewContentsForegroundTabTest) {
test_web_contents_delegate_->AddNewContents(
NULL, contents, NEW_FOREGROUND_TAB, gfx::Rect(), false, NULL);
// This should create a new foreground tab in the existing browser.
- EXPECT_EQ(1, browser()->tab_count());
+ EXPECT_EQ(1, browser()->tab_strip_model()->count());
EXPECT_EQ(1U, BrowserList::size());
}
@@ -105,7 +106,7 @@ TEST_F(WebDialogWebContentsDelegateTest, DetachTest) {
NEW_FOREGROUND_TAB, content::PAGE_TRANSITION_LINK, false));
test_web_contents_delegate_->AddNewContents(NULL, NULL, NEW_FOREGROUND_TAB,
gfx::Rect(), false, NULL);
- EXPECT_EQ(0, browser()->tab_count());
+ EXPECT_EQ(0, browser()->tab_strip_model()->count());
EXPECT_EQ(1U, BrowserList::size());
}
diff --git a/chrome/test/security_tests/sandbox_browsertest.cc b/chrome/test/security_tests/sandbox_browsertest.cc
index 6305a8e..bf76c29 100644
--- a/chrome/test/security_tests/sandbox_browsertest.cc
+++ b/chrome/test/security_tests/sandbox_browsertest.cc
@@ -4,6 +4,7 @@
#include "base/command_line.h"
#include "chrome/browser/ui/browser.h"
+#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/test/base/in_process_browser_test.h"
@@ -21,6 +22,6 @@ class SandboxTest : public InProcessBrowserTest {
#if defined(OS_WIN)
// Verifies that chrome is running properly.
IN_PROC_BROWSER_TEST_F(SandboxTest, ExecuteDll) {
- EXPECT_EQ(1, browser()->tab_count());
+ EXPECT_EQ(1, browser()->tab_strip_model()->count());
}
#endif