diff options
43 files changed, 247 insertions, 193 deletions
diff --git a/chrome/browser/accessibility/accessibility_extension_apitest.cc b/chrome/browser/accessibility/accessibility_extension_apitest.cc index 3bcd98f..6ca265b 100644 --- a/chrome/browser/accessibility/accessibility_extension_apitest.cc +++ b/chrome/browser/accessibility/accessibility_extension_apitest.cc @@ -7,7 +7,7 @@ #include "chrome/browser/api/infobars/simple_alert_infobar_delegate.h" #include "chrome/browser/extensions/extension_apitest.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" // Times out on win asan, http://crbug.com/166026 @@ -17,7 +17,8 @@ #define MAYBE_GetAlertsForTab GetAlertsForTab #endif IN_PROC_BROWSER_TEST_F(ExtensionApiTest, MAYBE_GetAlertsForTab) { - content::WebContents* web_contents = chrome::GetActiveWebContents(browser()); + content::WebContents* web_contents = + browser()->tab_strip_model()->GetActiveWebContents(); ASSERT_TRUE(web_contents); InfoBarService* infobar_service = InfoBarService::FromWebContents(web_contents); diff --git a/chrome/browser/autofill/DEPS b/chrome/browser/autofill/DEPS index f99f61b..d3ebebd 100644 --- a/chrome/browser/autofill/DEPS +++ b/chrome/browser/autofill/DEPS @@ -42,6 +42,7 @@ specific_include_rules = { "!chrome/browser/ui/browser.h", "!chrome/browser/ui/browser_tabstrip.h", "!chrome/browser/ui/browser_window.h", + "!chrome/browser/ui/tabs/tab_strip_model.h", ], # TODO(joi): May be able to get rid of the need for this by moving diff --git a/chrome/browser/autofill/autofill_browsertest.cc b/chrome/browser/autofill/autofill_browsertest.cc index d4cd4ef..ab41c34 100644 --- a/chrome/browser/autofill/autofill_browsertest.cc +++ b/chrome/browser/autofill/autofill_browsertest.cc @@ -27,8 +27,8 @@ #include "chrome/browser/translate/translate_infobar_delegate.h" #include "chrome/browser/translate/translate_manager.h" #include "chrome/browser/ui/browser.h" -#include "chrome/browser/ui/browser_tabstrip.h" #include "chrome/browser/ui/browser_window.h" +#include "chrome/browser/ui/tabs/tab_strip_model.h" #include "chrome/common/chrome_notification_types.h" #include "chrome/common/render_messages.h" #include "chrome/test/base/in_process_browser_test.h" @@ -134,8 +134,8 @@ class WindowedPersonalDataManagerObserver const content::NotificationSource& source, const content::NotificationDetails& details) OVERRIDE { // Accept in the infobar. - infobar_service_ = - InfoBarService::FromWebContents(chrome::GetActiveWebContents(browser_)); + infobar_service_ = InfoBarService::FromWebContents( + browser_->tab_strip_model()->GetActiveWebContents()); InfoBarDelegate* infobar = infobar_service_->GetInfoBarDelegateAt(0); ConfirmInfoBarDelegate* confirm_infobar = @@ -292,7 +292,7 @@ class AutofillTest : public InProcessBrowserTest { const std::string& expected_value) { std::string value; ASSERT_TRUE(content::ExecuteScriptAndExtractString( - chrome::GetActiveWebContents(browser()), + browser()->tab_strip_model()->GetActiveWebContents(), "window.domAutomationController.send(" " document.getElementById('" + field_name + "').value);", &value)); @@ -300,7 +300,8 @@ class AutofillTest : public InProcessBrowserTest { } RenderViewHost* render_view_host() { - return chrome::GetActiveWebContents(browser())->GetRenderViewHost(); + return browser()->tab_strip_model()->GetActiveWebContents()-> + GetRenderViewHost(); } void SimulateURLFetch(bool success) { @@ -345,7 +346,9 @@ class AutofillTest : public InProcessBrowserTest { void FocusFirstNameField() { LOG(WARNING) << "Clicking on the tab."; - content::SimulateMouseClick(chrome::GetActiveWebContents(browser()), 0, + content::SimulateMouseClick( + browser()->tab_strip_model()->GetActiveWebContents(), + 0, WebKit::WebMouseEvent::ButtonLeft); LOG(WARNING) << "Focusing the first name field."; @@ -375,8 +378,9 @@ class AutofillTest : public InProcessBrowserTest { void SendKeyAndWait(ui::KeyboardCode key, int notification_type) { content::WindowedNotificationObserver observer( notification_type, content::Source<RenderViewHost>(render_view_host())); - content::SimulateKeyPress(chrome::GetActiveWebContents(browser()), - key, false, false, false, false); + content::SimulateKeyPress( + browser()->tab_strip_model()->GetActiveWebContents(), + key, false, false, false, false); observer.Wait(); } @@ -799,7 +803,7 @@ IN_PROC_BROWSER_TEST_F(AutofillTest, MAYBE_AutofillAfterReload) { // Reload the page. LOG(WARNING) << "Reloading the page."; - WebContents* tab = chrome::GetActiveWebContents(browser()); + WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); tab->GetController().Reload(false); content::WaitForLoadStop(tab); @@ -849,8 +853,8 @@ IN_PROC_BROWSER_TEST_F(AutofillTest, DISABLED_AutofillAfterTranslate) { RenderViewHostTester::TestOnMessageReceived( render_view_host(), ChromeViewHostMsg_TranslateLanguageDetermined(0, "ja", true)); - TranslateInfoBarDelegate* infobar = - InfoBarService::FromWebContents(chrome::GetActiveWebContents(browser()))-> + TranslateInfoBarDelegate* infobar = InfoBarService::FromWebContents( + browser()->tab_strip_model()->GetActiveWebContents())-> GetInfoBarDelegateAt(0)->AsTranslateInfoBarDelegate(); ASSERT_TRUE(infobar != NULL); @@ -1084,7 +1088,8 @@ IN_PROC_BROWSER_TEST_F(AutofillTest, InvalidCreditCardNumberIsNotAggregated) { SubmitCreditCard("Bob Smith", card.c_str(), "12", "2014"); ASSERT_EQ(0u, InfoBarService::FromWebContents( - chrome::GetActiveWebContents(browser()))->GetInfoBarCount()); + browser()->tab_strip_model()->GetActiveWebContents())-> + GetInfoBarCount()); } // Test whitespaces and separator chars are stripped for valid CC numbers. @@ -1306,7 +1311,8 @@ IN_PROC_BROWSER_TEST_F(AutofillTest, CCInfoNotStoredWhenAutocompleteOff) { ASSERT_EQ(0u, InfoBarService::FromWebContents( - chrome::GetActiveWebContents(browser()))->GetInfoBarCount()); + browser()->tab_strip_model()->GetActiveWebContents())-> + GetInfoBarCount()); } // http://crbug.com/150084 @@ -1362,7 +1368,7 @@ IN_PROC_BROWSER_TEST_F(AutofillTest, MAYBE_FormFillableOnReset) { PopulateForm("NAME_FIRST"); ASSERT_TRUE(content::ExecuteScript( - chrome::GetActiveWebContents(browser()), + browser()->tab_strip_model()->GetActiveWebContents(), "document.getElementById('testform').reset()")); PopulateForm("NAME_FIRST"); @@ -1510,7 +1516,8 @@ IN_PROC_BROWSER_TEST_F(AutofillTest, MAYBE_FormFillLatencyAfterSubmit) { content::WindowedNotificationObserver load_stop_observer( content::NOTIFICATION_LOAD_STOP, content::Source<content::NavigationController>( - &chrome::GetActiveWebContents(browser())->GetController())); + &browser()->tab_strip_model()->GetActiveWebContents()-> + GetController())); ASSERT_TRUE(content::ExecuteScript( render_view_host(), @@ -1550,8 +1557,9 @@ IN_PROC_BROWSER_TEST_F(AutofillTest, MAYBE_DisableAutocompleteWhileFilling) { // Press the down arrow to select the suggestion and attempt to preview the // autofilled form. - content::SimulateKeyPress(chrome::GetActiveWebContents(browser()), - ui::VKEY_DOWN, false, false, false, false); + content::SimulateKeyPress( + browser()->tab_strip_model()->GetActiveWebContents(), + ui::VKEY_DOWN, false, false, false, false); // Wait for any IPCs to complete by performing an action that generates an // IPC that's easy to wait for. Chrome shouldn't crash. diff --git a/chrome/browser/autofill/autofill_external_delegate_browsertest.cc b/chrome/browser/autofill/autofill_external_delegate_browsertest.cc index 473abd7..996f19a 100644 --- a/chrome/browser/autofill/autofill_external_delegate_browsertest.cc +++ b/chrome/browser/autofill/autofill_external_delegate_browsertest.cc @@ -9,6 +9,7 @@ #include "chrome/browser/ui/autofill/autofill_popup_view.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/url_constants.h" #include "chrome/test/base/in_process_browser_test.h" #include "content/public/browser/navigation_controller.h" @@ -56,7 +57,7 @@ class AutofillExternalDelegateBrowserTest virtual ~AutofillExternalDelegateBrowserTest() {} virtual void SetUpOnMainThread() OVERRIDE { - web_contents_ = chrome::GetActiveWebContents(browser()); + web_contents_ = browser()->tab_strip_model()->GetActiveWebContents(); ASSERT_TRUE(web_contents_ != NULL); Observe(web_contents_); diff --git a/chrome/browser/autofill/form_structure_browsertest.cc b/chrome/browser/autofill/form_structure_browsertest.cc index e7304fb..e44d782 100644 --- a/chrome/browser/autofill/form_structure_browsertest.cc +++ b/chrome/browser/autofill/form_structure_browsertest.cc @@ -12,7 +12,7 @@ #include "chrome/browser/autofill/data_driven_test.h" #include "chrome/browser/autofill/form_structure.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/test/base/in_process_browser_test.h" #include "chrome/test/base/ui_test_utils.h" @@ -68,8 +68,8 @@ void FormStructureBrowserTest::GenerateResults(const std::string& input, ASSERT_NO_FATAL_FAILURE(ui_test_utils::NavigateToURL(browser(), HTMLToDataURI(input))); - AutofillManager* autofill_manager = - AutofillManager::FromWebContents(chrome::GetActiveWebContents(browser())); + AutofillManager* autofill_manager = AutofillManager::FromWebContents( + browser()->tab_strip_model()->GetActiveWebContents()); ASSERT_NE(static_cast<AutofillManager*>(NULL), autofill_manager); std::vector<FormStructure*> forms = autofill_manager->form_structures_.get(); *output = FormStructureBrowserTest::FormStructuresToString(forms); diff --git a/chrome/browser/automation/automation_misc_browsertest.cc b/chrome/browser/automation/automation_misc_browsertest.cc index 597ace3..97efd95 100644 --- a/chrome/browser/automation/automation_misc_browsertest.cc +++ b/chrome/browser/automation/automation_misc_browsertest.cc @@ -8,7 +8,7 @@ #include "base/callback.h" #include "chrome/browser/automation/automation_provider_observers.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/automation_constants.h" #include "chrome/common/automation_events.h" #include "chrome/test/base/in_process_browser_test.h" @@ -72,7 +72,7 @@ IN_PROC_BROWSER_TEST_F(AutomationMiscBrowserTest, ProcessMouseEvent) { .Times(2); content::RenderViewHost* view = - chrome::GetActiveWebContents(browser())->GetRenderViewHost(); + browser()->tab_strip_model()->GetActiveWebContents()->GetRenderViewHost(); ASSERT_TRUE(content::ExecuteScript( view, "window.didClick = false;" diff --git a/chrome/browser/browser_encoding_browsertest.cc b/chrome/browser/browser_encoding_browsertest.cc index 8c5fe94..5a03ce8 100644 --- a/chrome/browser/browser_encoding_browsertest.cc +++ b/chrome/browser/browser_encoding_browsertest.cc @@ -11,7 +11,7 @@ #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_commands.h" -#include "chrome/browser/ui/browser_tabstrip.h" +#include "chrome/browser/ui/tabs/tab_strip_model.h" #include "chrome/common/pref_names.h" #include "chrome/test/base/in_process_browser_test.h" #include "chrome/test/base/ui_test_utils.h" @@ -123,7 +123,7 @@ class BrowserEncodingTest SavePackageFinishedObserver observer( content::BrowserContext::GetDownloadManager(browser()->profile()), loop_runner->QuitClosure()); - chrome::GetActiveWebContents(browser())->SavePage( + browser()->tab_strip_model()->GetActiveWebContents()->SavePage( full_file_name, temp_sub_resource_dir_, content::SAVE_PAGE_TYPE_AS_COMPLETE_HTML); loop_runner->Run(); @@ -165,7 +165,8 @@ IN_PROC_BROWSER_TEST_P(BrowserEncodingTest, TestEncodingAliasMapping) { GURL url = content::URLRequestMockHTTPJob::GetMockUrl(test_file_path); ui_test_utils::NavigateToURL(browser(), url); EXPECT_EQ(GetParam().encoding_name, - chrome::GetActiveWebContents(browser())->GetEncoding()); + browser()->tab_strip_model()->GetActiveWebContents()-> + GetEncoding()); } INSTANTIATE_TEST_CASE_P(EncodingAliases, @@ -183,7 +184,8 @@ IN_PROC_BROWSER_TEST_F(BrowserEncodingTest, TestOverrideEncoding) { test_dir_path = test_dir_path.AppendASCII(kTestFileName); GURL url = content::URLRequestMockHTTPJob::GetMockUrl(test_dir_path); ui_test_utils::NavigateToURL(browser(), url); - content::WebContents* web_contents = chrome::GetActiveWebContents(browser()); + content::WebContents* web_contents = + browser()->tab_strip_model()->GetActiveWebContents(); EXPECT_EQ("ISO-8859-1", web_contents->GetEncoding()); // Override the encoding to "gb18030". @@ -288,7 +290,8 @@ IN_PROC_BROWSER_TEST_F(BrowserEncodingTest, MAYBE_TestEncodingAutoDetect) { browser()->profile()->GetPrefs()->SetString(prefs::kDefaultCharset, "ISO-8859-4"); - content::WebContents* web_contents = chrome::GetActiveWebContents(browser()); + content::WebContents* web_contents = + browser()->tab_strip_model()->GetActiveWebContents(); for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kTestDatas); ++i) { // Disable auto detect if it is on. browser()->profile()->GetPrefs()->SetBoolean( diff --git a/chrome/browser/browsing_data/browsing_data_remover_browsertest.cc b/chrome/browser/browsing_data/browsing_data_remover_browsertest.cc index e67a8e7..8ecdc64 100644 --- a/chrome/browser/browsing_data/browsing_data_remover_browsertest.cc +++ b/chrome/browser/browsing_data/browsing_data_remover_browsertest.cc @@ -9,7 +9,7 @@ #include "chrome/browser/prefs/pref_service.h" #include "chrome/browser/profiles/profile.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/pref_names.h" #include "chrome/test/base/in_process_browser_test.h" @@ -47,7 +47,7 @@ class BrowsingDataRemoverBrowserTest : public InProcessBrowserTest { const std::string& result) { std::string data; ASSERT_TRUE(content::ExecuteScriptAndExtractString( - chrome::GetActiveWebContents(browser()), script, &data)); + browser()->tab_strip_model()->GetActiveWebContents(), script, &data)); ASSERT_EQ(data, result); } diff --git a/chrome/browser/chrome_switches_browsertest.cc b/chrome/browser/chrome_switches_browsertest.cc index 5464f27..82af672 100644 --- a/chrome/browser/chrome_switches_browsertest.cc +++ b/chrome/browser/chrome_switches_browsertest.cc @@ -4,7 +4,7 @@ #include "base/command_line.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/test/base/in_process_browser_test.h" #include "chrome/test/base/ui_test_utils.h" @@ -40,7 +40,7 @@ IN_PROC_BROWSER_TEST_F(HostRulesTest, TestMap) { std::string html; EXPECT_TRUE(content::ExecuteScriptAndExtractString( - chrome::GetActiveWebContents(browser()), + browser()->tab_strip_model()->GetActiveWebContents(), "window.domAutomationController.send(document.body.outerHTML);", &html)); diff --git a/chrome/browser/chrome_to_mobile_service_unittest.cc b/chrome/browser/chrome_to_mobile_service_unittest.cc index d4eb05e..59c07ec 100644 --- a/chrome/browser/chrome_to_mobile_service_unittest.cc +++ b/chrome/browser/chrome_to_mobile_service_unittest.cc @@ -10,7 +10,8 @@ #include "chrome/browser/command_updater.h" #include "chrome/browser/prefs/pref_service.h" #include "chrome/browser/signin/token_service.h" -#include "chrome/browser/ui/browser_tabstrip.h" +#include "chrome/browser/ui/browser.h" +#include "chrome/browser/ui/tabs/tab_strip_model.h" #include "chrome/common/chrome_notification_types.h" #include "chrome/common/extensions/feature_switch.h" #include "chrome/common/pref_names.h" @@ -172,7 +173,7 @@ TEST_F(ChromeToMobileServiceTest, CertainSchemesAreRequired) { }; content::NavigationController* controller = - &chrome::GetActiveWebContents(browser())->GetController(); + &browser()->tab_strip_model()->GetActiveWebContents()->GetController(); for (size_t i = 0; i < ARRAYSIZE_UNSAFE(cases); ++i) { NavigateAndCommit(controller, GURL(cases[i].url)); EXPECT_EQ(cases[i].enabled, UpdateAndGetVerifiedCommandState()); diff --git a/chrome/browser/chromeos/extensions/file_browser_resource_throttle_browsertest.cc b/chrome/browser/chromeos/extensions/file_browser_resource_throttle_browsertest.cc index 0e0e928..581efc5 100644 --- a/chrome/browser/chromeos/extensions/file_browser_resource_throttle_browsertest.cc +++ b/chrome/browser/chromeos/extensions/file_browser_resource_throttle_browsertest.cc @@ -15,7 +15,7 @@ #include "chrome/browser/google_apis/test_server/http_server.h" #include "chrome/browser/prefs/pref_service.h" #include "chrome/browser/ui/browser.h" -#include "chrome/browser/ui/browser_tabstrip.cc" +#include "chrome/browser/ui/tabs/tab_strip_model.h" #include "chrome/common/pref_names.cc" #include "chrome/test/base/ui_test_utils.h" #include "content/public/browser/download_item.h" @@ -260,7 +260,8 @@ IN_PROC_BROWSER_TEST_F(FileBrowserResourceThrottleExtensionApiTest, Basic) { // Get child and routing id from the current web contents (the real values // should be used so the FileBrowserHandlerEventRouter can correctly extract // profile from them). - WebContents* web_contents = chrome::GetActiveWebContents(browser()); + WebContents* web_contents = + browser()->tab_strip_model()->GetActiveWebContents(); ASSERT_TRUE(web_contents); int child_id = web_contents->GetRenderProcessHost()->GetID(); int routing_id = web_contents->GetRoutingID(); @@ -365,7 +366,8 @@ IN_PROC_BROWSER_TEST_F(FileBrowserResourceThrottleExtensionApiTest, downloads_dir_.path().Append(FILE_PATH_LITERAL("download_target.txt")); // Set the downloads parameters. - content::WebContents* web_contents = chrome::GetActiveWebContents(browser()); + content::WebContents* web_contents = + browser()->tab_strip_model()->GetActiveWebContents(); ASSERT_TRUE(web_contents); scoped_ptr<DownloadUrlParameters> params( DownloadUrlParameters::FromWebContents(web_contents, url)); diff --git a/chrome/browser/chromeos/memory/oom_priority_manager_browsertest.cc b/chrome/browser/chromeos/memory/oom_priority_manager_browsertest.cc index 2bb34b0..1bb925ef 100644 --- a/chrome/browser/chromeos/memory/oom_priority_manager_browsertest.cc +++ b/chrome/browser/chromeos/memory/oom_priority_manager_browsertest.cc @@ -6,7 +6,6 @@ #include "chrome/browser/chromeos/memory/oom_priority_manager.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_commands.h" -#include "chrome/browser/ui/browser_tabstrip.h" #include "chrome/browser/ui/find_bar/find_bar_controller.h" #include "chrome/browser/ui/tabs/tab_strip_model.h" #include "chrome/common/url_constants.h" @@ -117,7 +116,7 @@ IN_PROC_BROWSER_TEST_F(OomPriorityManagerTest, OomPriorityManagerBasics) { reload1.Wait(); // Make sure the FindBarController gets the right WebContents. EXPECT_EQ(browser()->GetFindBarController()->web_contents(), - chrome::GetActiveWebContents(browser())); + browser()->tab_strip_model()->GetActiveWebContents()); EXPECT_EQ(0, browser()->tab_strip_model()->active_index()); EXPECT_FALSE(browser()->tab_strip_model()->IsTabDiscarded(0)); EXPECT_FALSE(browser()->tab_strip_model()->IsTabDiscarded(1)); diff --git a/chrome/browser/collected_cookies_browsertest.cc b/chrome/browser/collected_cookies_browsertest.cc index 0c129c7..cf9f281 100644 --- a/chrome/browser/collected_cookies_browsertest.cc +++ b/chrome/browser/collected_cookies_browsertest.cc @@ -9,7 +9,7 @@ #include "chrome/browser/net/url_fixer_upper.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_dialogs.h" -#include "chrome/browser/ui/browser_tabstrip.h" +#include "chrome/browser/ui/tabs/tab_strip_model.h" #include "chrome/common/url_constants.h" #include "chrome/test/base/in_process_browser_test.h" #include "chrome/test/base/ui_test_utils.h" @@ -36,7 +36,8 @@ IN_PROC_BROWSER_TEST_F(CollectedCookiesTest, DoubleDisplay) { browser(), test_server()->GetURL("files/cookie1.html")); // Click on the info link twice. - content::WebContents* web_contents = chrome::GetActiveWebContents(browser()); + content::WebContents* web_contents = + browser()->tab_strip_model()->GetActiveWebContents(); chrome::ShowCollectedCookiesDialog(web_contents); chrome::ShowCollectedCookiesDialog(web_contents); } @@ -53,7 +54,8 @@ IN_PROC_BROWSER_TEST_F(CollectedCookiesTest, NavigateAway) { browser(), test_server()->GetURL("files/cookie1.html")); // Click on the info link. - content::WebContents* web_contents = chrome::GetActiveWebContents(browser()); + content::WebContents* web_contents = + browser()->tab_strip_model()->GetActiveWebContents(); chrome::ShowCollectedCookiesDialog(web_contents); // Navigate to another page. diff --git a/chrome/browser/content_settings/content_settings_browsertest.cc b/chrome/browser/content_settings/content_settings_browsertest.cc index b34c95b1..976364a 100644 --- a/chrome/browser/content_settings/content_settings_browsertest.cc +++ b/chrome/browser/content_settings/content_settings_browsertest.cc @@ -13,7 +13,6 @@ #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_commands.h" -#include "chrome/browser/ui/browser_tabstrip.h" #include "chrome/browser/ui/tabs/tab_strip_model.h" #include "chrome/common/chrome_notification_types.h" #include "chrome/common/render_messages.h" @@ -232,7 +231,8 @@ IN_PROC_BROWSER_TEST_F(ContentSettingsTest, RedirectLoopCookies) { ui_test_utils::NavigateToURL(browser(), test_url); - content::WebContents* web_contents = chrome::GetActiveWebContents(browser()); + content::WebContents* web_contents = + browser()->tab_strip_model()->GetActiveWebContents(); ASSERT_EQ(UTF8ToUTF16(test_url.spec() + " failed to load"), web_contents->GetTitle()); @@ -248,7 +248,8 @@ IN_PROC_BROWSER_TEST_F(ContentSettingsTest, ContentSettingsBlockDataURLs) { ui_test_utils::NavigateToURL(browser(), url); - content::WebContents* web_contents = chrome::GetActiveWebContents(browser()); + content::WebContents* web_contents = + browser()->tab_strip_model()->GetActiveWebContents(); ASSERT_EQ(UTF8ToUTF16("Data URL"), web_contents->GetTitle()); EXPECT_TRUE(TabSpecificContentSettings::FromWebContents(web_contents)-> @@ -273,7 +274,8 @@ IN_PROC_BROWSER_TEST_F(ContentSettingsTest, RedirectCrossOrigin) { ui_test_utils::NavigateToURL(browser(), test_url); - content::WebContents* web_contents = chrome::GetActiveWebContents(browser()); + content::WebContents* web_contents = + browser()->tab_strip_model()->GetActiveWebContents(); EXPECT_TRUE(TabSpecificContentSettings::FromWebContents(web_contents)-> IsContentBlocked(CONTENT_SETTINGS_TYPE_COOKIES)); @@ -307,10 +309,10 @@ IN_PROC_BROWSER_TEST_F(ClickToPlayPluginTest, Basic) { string16 expected_title(ASCIIToUTF16("OK")); content::TitleWatcher title_watcher( - chrome::GetActiveWebContents(browser()), expected_title); + browser()->tab_strip_model()->GetActiveWebContents(), expected_title); content::RenderViewHost* host = - chrome::GetActiveWebContents(browser())->GetRenderViewHost(); + browser()->tab_strip_model()->GetActiveWebContents()->GetRenderViewHost(); host->Send(new ChromeViewMsg_LoadBlockedPlugins( host->GetRoutingID(), std::string())); @@ -333,7 +335,7 @@ IN_PROC_BROWSER_TEST_F(ClickToPlayPluginTest, AllowException) { string16 expected_title(ASCIIToUTF16("OK")); content::TitleWatcher title_watcher( - chrome::GetActiveWebContents(browser()), expected_title); + browser()->tab_strip_model()->GetActiveWebContents(), expected_title); ui_test_utils::NavigateToURL(browser(), url); EXPECT_EQ(expected_title, title_watcher.WaitAndGetTitle()); } @@ -352,7 +354,7 @@ IN_PROC_BROWSER_TEST_F(ClickToPlayPluginTest, BlockException) { string16 expected_title(ASCIIToUTF16("Click To Play")); content::TitleWatcher title_watcher( - chrome::GetActiveWebContents(browser()), expected_title); + browser()->tab_strip_model()->GetActiveWebContents(), expected_title); ui_test_utils::NavigateToURL(browser(), url); EXPECT_EQ(expected_title, title_watcher.WaitAndGetTitle()); } @@ -367,20 +369,20 @@ IN_PROC_BROWSER_TEST_F(ClickToPlayPluginTest, LoadAllBlockedPlugins) { string16 expected_title1(ASCIIToUTF16("1")); content::TitleWatcher title_watcher1( - chrome::GetActiveWebContents(browser()), expected_title1); + browser()->tab_strip_model()->GetActiveWebContents(), expected_title1); content::RenderViewHost* host = - chrome::GetActiveWebContents(browser())->GetRenderViewHost(); + browser()->tab_strip_model()->GetActiveWebContents()->GetRenderViewHost(); host->Send(new ChromeViewMsg_LoadBlockedPlugins( host->GetRoutingID(), std::string())); EXPECT_EQ(expected_title1, title_watcher1.WaitAndGetTitle()); string16 expected_title2(ASCIIToUTF16("2")); content::TitleWatcher title_watcher2( - chrome::GetActiveWebContents(browser()), expected_title2); + browser()->tab_strip_model()->GetActiveWebContents(), expected_title2); ASSERT_TRUE(content::ExecuteScript( - chrome::GetActiveWebContents(browser()), "window.inject()")); + browser()->tab_strip_model()->GetActiveWebContents(), "window.inject()")); EXPECT_EQ(expected_title2, title_watcher2.WaitAndGetTitle()); } @@ -395,15 +397,15 @@ IN_PROC_BROWSER_TEST_F(ClickToPlayPluginTest, NoCallbackAtLoad) { // Inject the callback function into the HTML page generated by the browser. ASSERT_TRUE(content::ExecuteScript( - chrome::GetActiveWebContents(browser()), + browser()->tab_strip_model()->GetActiveWebContents(), "CallOnStartup = function() { document.title = \"OK\"; }")); string16 expected_title(ASCIIToUTF16("OK")); content::TitleWatcher title_watcher( - chrome::GetActiveWebContents(browser()), expected_title); + browser()->tab_strip_model()->GetActiveWebContents(), expected_title); content::RenderViewHost* host = - chrome::GetActiveWebContents(browser())->GetRenderViewHost(); + browser()->tab_strip_model()->GetActiveWebContents()->GetRenderViewHost(); host->Send(new ChromeViewMsg_LoadBlockedPlugins( host->GetRoutingID(), std::string())); @@ -420,10 +422,10 @@ IN_PROC_BROWSER_TEST_F(ClickToPlayPluginTest, DeleteSelfAtLoad) { string16 expected_title(ASCIIToUTF16("OK")); content::TitleWatcher title_watcher( - chrome::GetActiveWebContents(browser()), expected_title); + browser()->tab_strip_model()->GetActiveWebContents(), expected_title); content::RenderViewHost* host = - chrome::GetActiveWebContents(browser())->GetRenderViewHost(); + browser()->tab_strip_model()->GetActiveWebContents()->GetRenderViewHost(); host->Send(new ChromeViewMsg_LoadBlockedPlugins( host->GetRoutingID(), std::string())); diff --git a/chrome/browser/crash_recovery_browsertest.cc b/chrome/browser/crash_recovery_browsertest.cc index bd44e0e..1211e3d 100644 --- a/chrome/browser/crash_recovery_browsertest.cc +++ b/chrome/browser/crash_recovery_browsertest.cc @@ -5,7 +5,7 @@ #include "base/file_path.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_commands.h" -#include "chrome/browser/ui/browser_tabstrip.h" +#include "chrome/browser/ui/tabs/tab_strip_model.h" #include "chrome/common/url_constants.h" #include "chrome/test/base/in_process_browser_test.h" #include "chrome/test/base/ui_test_utils.h" @@ -53,7 +53,8 @@ IN_PROC_BROWSER_TEST_F(CrashRecoveryBrowserTest, Reload) { content::WindowedNotificationObserver observer( content::NOTIFICATION_LOAD_STOP, content::Source<NavigationController>( - &chrome::GetActiveWebContents(browser())->GetController())); + &browser()->tab_strip_model()->GetActiveWebContents()-> + GetController())); chrome::Reload(browser(), CURRENT_TAB); observer.Wait(); ASSERT_TRUE(ui_test_utils::GetCurrentTabTitle(browser(), @@ -81,7 +82,8 @@ IN_PROC_BROWSER_TEST_F(CrashRecoveryBrowserTest, LoadInNewTab) { content::WindowedNotificationObserver observer( content::NOTIFICATION_LOAD_STOP, content::Source<NavigationController>( - &chrome::GetActiveWebContents(browser())->GetController())); + &browser()->tab_strip_model()->GetActiveWebContents()-> + GetController())); chrome::Reload(browser(), CURRENT_TAB); observer.Wait(); ASSERT_TRUE(ui_test_utils::GetCurrentTabTitle(browser(), diff --git a/chrome/browser/custom_handlers/protocol_handler_registry_browsertest.cc b/chrome/browser/custom_handlers/protocol_handler_registry_browsertest.cc index f1096ce..00623e0 100644 --- a/chrome/browser/custom_handlers/protocol_handler_registry_browsertest.cc +++ b/chrome/browser/custom_handlers/protocol_handler_registry_browsertest.cc @@ -10,7 +10,7 @@ #include "chrome/app/chrome_command_ids.h" #include "chrome/browser/tab_contents/render_view_context_menu.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/test/base/in_process_browser_test.h" #include "chrome/test/base/ui_test_utils.h" #include "content/public/browser/navigation_controller.h" @@ -52,7 +52,8 @@ class RegisterProtocolHandlerBrowserTest : public InProcessBrowserTest { params.media_type = WebKit::WebContextMenuData::MediaTypeNone; params.link_url = url; params.unfiltered_link_url = url; - WebContents* web_contents = chrome::GetActiveWebContents(browser()); + WebContents* web_contents = + browser()->tab_strip_model()->GetActiveWebContents(); params.page_url = web_contents->GetController().GetActiveEntry()->GetURL(); #if defined(OS_MACOSX) params.writing_direction_default = 0; @@ -60,7 +61,7 @@ class RegisterProtocolHandlerBrowserTest : public InProcessBrowserTest { params.writing_direction_right_to_left = 0; #endif // OS_MACOSX TestRenderViewContextMenu* menu = new TestRenderViewContextMenu( - chrome::GetActiveWebContents(browser()), params); + browser()->tab_strip_model()->GetActiveWebContents(), params); menu->Init(); return menu; } @@ -108,5 +109,6 @@ IN_PROC_BROWSER_TEST_F(RegisterProtocolHandlerBrowserTest, CustomHandler) { ui_test_utils::NavigateToURL(browser(), GURL("foo:test")); - ASSERT_EQ(handler_url, chrome::GetActiveWebContents(browser())->GetURL()); + ASSERT_EQ(handler_url, + browser()->tab_strip_model()->GetActiveWebContents()->GetURL()); } diff --git a/chrome/browser/do_not_track_browsertest.cc b/chrome/browser/do_not_track_browsertest.cc index fb30fcf..71fbcda 100644 --- a/chrome/browser/do_not_track_browsertest.cc +++ b/chrome/browser/do_not_track_browsertest.cc @@ -7,7 +7,7 @@ #include "chrome/browser/prefs/pref_service.h" #include "chrome/browser/profiles/profile.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/pref_names.h" #include "chrome/test/base/in_process_browser_test.h" #include "chrome/test/base/ui_test_utils.h" @@ -27,7 +27,7 @@ IN_PROC_BROWSER_TEST_F(DoNotTrackTest, Simple) { ui_test_utils::NavigateToURL(browser(), url); int matches = ui_test_utils::FindInPage( - chrome::GetActiveWebContents(browser()), + browser()->tab_strip_model()->GetActiveWebContents(), string16(ASCIIToUTF16("1")), true /* forward */, false /* match case */, NULL /* ordinal */, NULL /* selection_rect */); @@ -48,7 +48,7 @@ IN_PROC_BROWSER_TEST_F(DoNotTrackTest, Redirect) { ui_test_utils::NavigateToURL(browser(), url); int matches = ui_test_utils::FindInPage( - chrome::GetActiveWebContents(browser()), + browser()->tab_strip_model()->GetActiveWebContents(), string16(ASCIIToUTF16("1")), true /* forward */, false /* match case */, NULL /* ordinal */, NULL /* selection_rect */); @@ -62,11 +62,11 @@ IN_PROC_BROWSER_TEST_F(DoNotTrackTest, DOMProperty) { prefs->SetBoolean(prefs::kEnableDoNotTrack, true); ASSERT_NO_FATAL_FAILURE(content::WaitForLoadStop( - chrome::GetActiveWebContents(browser()))); + browser()->tab_strip_model()->GetActiveWebContents())); std::string do_not_track; EXPECT_TRUE(content::ExecuteScriptAndExtractString( - chrome::GetActiveWebContents(browser()), + browser()->tab_strip_model()->GetActiveWebContents(), "window.domAutomationController.send(navigator.doNotTrack)", &do_not_track)); EXPECT_EQ("1", do_not_track); @@ -76,7 +76,7 @@ IN_PROC_BROWSER_TEST_F(DoNotTrackTest, DOMProperty) { prefs->SetBoolean(prefs::kEnableDoNotTrack, false); EXPECT_TRUE(content::ExecuteScriptAndExtractString( - chrome::GetActiveWebContents(browser()), + browser()->tab_strip_model()->GetActiveWebContents(), "window.domAutomationController.send(" " navigator.doNotTrack === null ? '0' : '1')", &do_not_track)); diff --git a/chrome/browser/extensions/api/extension_action/page_as_browser_action_apitest.cc b/chrome/browser/extensions/api/extension_action/page_as_browser_action_apitest.cc index c065eea..49d9a04 100644 --- a/chrome/browser/extensions/api/extension_action/page_as_browser_action_apitest.cc +++ b/chrome/browser/extensions/api/extension_action/page_as_browser_action_apitest.cc @@ -14,9 +14,9 @@ #include "chrome/browser/extensions/extension_tab_util.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/browser.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/tabs/tab_strip_model.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/extensions/extension.h" #include "chrome/test/base/ui_test_utils.h" @@ -77,7 +77,7 @@ IN_PROC_BROWSER_TEST_F(PageAsBrowserActionApiTest, Basic) { // Test that we received the changes. int tab_id = ExtensionTabUtil::GetTabId( - chrome::GetActiveWebContents(browser())); + browser()->tab_strip_model()->GetActiveWebContents()); ExtensionAction* action = extension_action_manager()->GetBrowserAction(*extension); ASSERT_TRUE(action); @@ -116,7 +116,7 @@ IN_PROC_BROWSER_TEST_F(PageAsBrowserActionApiTest, AddPopup) { ASSERT_TRUE(extension) << message_; int tab_id = ExtensionTabUtil::GetTabId( - chrome::GetActiveWebContents(browser())); + browser()->tab_strip_model()->GetActiveWebContents()); ExtensionAction* page_action = extension_action_manager()->GetBrowserAction(*extension); @@ -164,7 +164,7 @@ IN_PROC_BROWSER_TEST_F(PageAsBrowserActionApiTest, RemovePopup) { ASSERT_TRUE(extension) << message_; int tab_id = ExtensionTabUtil::GetTabId( - chrome::GetActiveWebContents(browser())); + browser()->tab_strip_model()->GetActiveWebContents()); ExtensionAction* page_action = extension_action_manager()->GetBrowserAction(*extension); diff --git a/chrome/browser/extensions/extension_resource_request_policy_apitest.cc b/chrome/browser/extensions/extension_resource_request_policy_apitest.cc index 28f456a..3ccd727 100644 --- a/chrome/browser/extensions/extension_resource_request_policy_apitest.cc +++ b/chrome/browser/extensions/extension_resource_request_policy_apitest.cc @@ -5,7 +5,7 @@ #include "base/logging.h" #include "chrome/browser/extensions/extension_apitest.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/test/base/ui_test_utils.h" #include "content/public/browser/web_contents.h" @@ -51,7 +51,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionResourceRequestPolicyTest, OriginPrivileges) { browser(), web_resource.ReplaceComponents(make_host_a_com)); std::string result; ASSERT_TRUE(content::ExecuteScriptAndExtractString( - chrome::GetActiveWebContents(browser()), + browser()->tab_strip_model()->GetActiveWebContents(), "window.domAutomationController.send(document.title)", &result)); EXPECT_EQ(result, "Loaded"); @@ -63,7 +63,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionResourceRequestPolicyTest, OriginPrivileges) { "non_existent_extension.html")); ui_test_utils::NavigateToURL(browser(), non_existent_extension); ASSERT_TRUE(content::ExecuteScriptAndExtractString( - chrome::GetActiveWebContents(browser()), + browser()->tab_strip_model()->GetActiveWebContents(), "window.domAutomationController.send(document.title)", &result)); EXPECT_EQ(result, "Image failed to load"); @@ -77,7 +77,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionResourceRequestPolicyTest, OriginPrivileges) { ui_test_utils::NavigateToURL(browser(), GURL(std::string("data:text/html;charset=utf-8,") + file_source)); ASSERT_TRUE(content::ExecuteScriptAndExtractString( - chrome::GetActiveWebContents(browser()), + browser()->tab_strip_model()->GetActiveWebContents(), "window.domAutomationController.send(document.title)", &result)); EXPECT_EQ(result, "Loaded"); @@ -93,7 +93,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionResourceRequestPolicyTest, OriginPrivileges) { browser(), GURL("chrome-extension://pbkkcbgdkliohhfaeefcijaghglkahja/index.html")); ASSERT_TRUE(content::ExecuteScriptAndExtractString( - chrome::GetActiveWebContents(browser()), + browser()->tab_strip_model()->GetActiveWebContents(), "window.domAutomationController.send(document.title)", &result)); EXPECT_EQ(result, "Loaded"); @@ -157,7 +157,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionResourceRequestPolicyTest, "web_accessible/accessible_resource.html")); ui_test_utils::NavigateToURL(browser(), accessible_resource); ASSERT_TRUE(content::ExecuteScriptAndExtractString( - chrome::GetActiveWebContents(browser()), + browser()->tab_strip_model()->GetActiveWebContents(), "window.domAutomationController.send(document.title)", &result)); EXPECT_EQ("Loaded", result); @@ -169,7 +169,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionResourceRequestPolicyTest, ui_test_utils::NavigateToURL( browser(), xhr_accessible_resource); ASSERT_TRUE(content::ExecuteScriptAndExtractString( - chrome::GetActiveWebContents(browser()), + browser()->tab_strip_model()->GetActiveWebContents(), "window.domAutomationController.send(document.title)", &result)); EXPECT_EQ("XHR completed with status: 200", result); @@ -181,7 +181,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionResourceRequestPolicyTest, ui_test_utils::NavigateToURL( browser(), xhr_inaccessible_resource); ASSERT_TRUE(content::ExecuteScriptAndExtractString( - chrome::GetActiveWebContents(browser()), + browser()->tab_strip_model()->GetActiveWebContents(), "window.domAutomationController.send(document.title)", &result)); EXPECT_EQ("XHR failed to load resource", result); @@ -192,7 +192,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionResourceRequestPolicyTest, "web_accessible/nonaccessible_resource.html")); ui_test_utils::NavigateToURL(browser(), nonaccessible_resource); ASSERT_TRUE(content::ExecuteScriptAndExtractString( - chrome::GetActiveWebContents(browser()), + browser()->tab_strip_model()->GetActiveWebContents(), "window.domAutomationController.send(document.title)", &result)); EXPECT_EQ("Image failed to load", result); @@ -203,7 +203,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionResourceRequestPolicyTest, "web_accessible/nonexistent_resource.html")); ui_test_utils::NavigateToURL(browser(), nonexistent_resource); ASSERT_TRUE(content::ExecuteScriptAndExtractString( - chrome::GetActiveWebContents(browser()), + browser()->tab_strip_model()->GetActiveWebContents(), "window.domAutomationController.send(document.title)", &result)); EXPECT_EQ("Image failed to load", result); @@ -214,7 +214,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionResourceRequestPolicyTest, "web_accessible/nonaccessible_chrome_resource_scheme.html")); ui_test_utils::NavigateToURL(browser(), nonaccessible_cer_resource); ASSERT_TRUE(content::ExecuteScriptAndExtractString( - chrome::GetActiveWebContents(browser()), + browser()->tab_strip_model()->GetActiveWebContents(), "window.domAutomationController.send(document.title)", &result)); EXPECT_EQ("Loading CER:// failed.", result); @@ -228,7 +228,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionResourceRequestPolicyTest, ui_test_utils::NavigateToURLBlockUntilNavigationsComplete( browser(), accessible_newtab_override, 2); ASSERT_TRUE(content::ExecuteScriptAndExtractString( - chrome::GetActiveWebContents(browser()), + browser()->tab_strip_model()->GetActiveWebContents(), "window.domAutomationController.send(document.title)", &result)); EXPECT_EQ("New Tab Page Loaded Successfully", result); @@ -248,7 +248,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionResourceRequestPolicyTest, "web_accessible/accessible_resource_with_csp.html")); ui_test_utils::NavigateToURL(browser(), accessible_resource_with_csp); ASSERT_TRUE(content::ExecuteScriptAndExtractString( - chrome::GetActiveWebContents(browser()), + browser()->tab_strip_model()->GetActiveWebContents(), "window.domAutomationController.send(document.title)", &result)); EXPECT_EQ("Loaded", result); diff --git a/chrome/browser/iframe_browsertest.cc b/chrome/browser/iframe_browsertest.cc index fff8968..f3ef8a29 100644 --- a/chrome/browser/iframe_browsertest.cc +++ b/chrome/browser/iframe_browsertest.cc @@ -5,7 +5,7 @@ #include "base/file_path.h" #include "base/utf_string_conversions.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/test/base/in_process_browser_test.h" #include "chrome/test/base/ui_test_utils.h" #include "content/public/browser/web_contents.h" @@ -19,7 +19,7 @@ class IFrameTest : public InProcessBrowserTest { ui_test_utils::NavigateToURL(browser(), url); EXPECT_EQ(ASCIIToUTF16(page_title), - chrome::GetActiveWebContents(browser())->GetTitle()); + browser()->tab_strip_model()->GetActiveWebContents()->GetTitle()); } }; diff --git a/chrome/browser/page_cycler/page_cycler.cc b/chrome/browser/page_cycler/page_cycler.cc index ef66161..1208a48 100644 --- a/chrome/browser/page_cycler/page_cycler.cc +++ b/chrome/browser/page_cycler/page_cycler.cc @@ -16,7 +16,7 @@ #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_commands.h" #include "chrome/browser/ui/browser_list.h" -#include "chrome/browser/ui/browser_tabstrip.h" +#include "chrome/browser/ui/tabs/tab_strip_model.h" #include "chrome/common/chrome_notification_types.h" #include "chrome/test/base/chrome_process_util.h" #include "chrome/test/perf/perf_test.h" @@ -33,7 +33,8 @@ using content::WebContents; PageCycler::PageCycler(Browser* browser, const FilePath& urls_file) - : content::WebContentsObserver(chrome::GetActiveWebContents(browser)), + : content::WebContentsObserver( + browser->tab_strip_model()->GetActiveWebContents()), browser_(browser), urls_file_(urls_file), url_index_(0), @@ -134,7 +135,7 @@ void PageCycler::BeginCycle() { // result in the browser being in a state of loading when PageCycler is ready // to start. Instead of interrupting the load, we wait for it to finish, and // will call LoadNextURL() from DidFinishLoad() or DidFailProvisionalLoad(). - if (chrome::GetActiveWebContents(browser_)->IsLoading()) + if (browser_->tab_strip_model()->GetActiveWebContents()->IsLoading()) return; LoadNextURL(); } diff --git a/chrome/browser/repost_form_warning_browsertest.cc b/chrome/browser/repost_form_warning_browsertest.cc index 5d20319..25df39d 100644 --- a/chrome/browser/repost_form_warning_browsertest.cc +++ b/chrome/browser/repost_form_warning_browsertest.cc @@ -5,7 +5,7 @@ #include "chrome/app/chrome_command_ids.h" #include "chrome/browser/net/url_fixer_upper.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/browser/ui/web_contents_modal_dialog_manager.h" #include "chrome/common/chrome_notification_types.h" #include "chrome/common/url_constants.h" @@ -32,7 +32,8 @@ IN_PROC_BROWSER_TEST_F(RepostFormWarningTest, TestDoubleReload) { GURL("javascript:document.getElementById('form').submit()")); // Try to reload it twice, checking for repost. - content::WebContents* web_contents = chrome::GetActiveWebContents(browser()); + content::WebContents* web_contents = + browser()->tab_strip_model()->GetActiveWebContents(); web_contents->GetController().Reload(true); web_contents->GetController().Reload(true); @@ -61,7 +62,8 @@ IN_PROC_BROWSER_TEST_F(RepostFormWarningTest, TestLoginAfterRepost) { GURL("javascript:document.getElementById('form').submit()")); // Try to reload it, checking for repost. - content::WebContents* web_contents = chrome::GetActiveWebContents(browser()); + content::WebContents* web_contents = + browser()->tab_strip_model()->GetActiveWebContents(); web_contents->GetController().Reload(true); // Navigate to a page that requires authentication, bringing up another diff --git a/chrome/browser/ui/browser_focus_uitest.cc b/chrome/browser/ui/browser_focus_uitest.cc index 1f23a0d..939391d 100644 --- a/chrome/browser/ui/browser_focus_uitest.cc +++ b/chrome/browser/ui/browser_focus_uitest.cc @@ -394,8 +394,9 @@ IN_PROC_BROWSER_TEST_F(BrowserFocusTest, MAYBE_TabsRememberFocusFindInPage) { ui_test_utils::NavigateToURL(browser(), url); chrome::Find(browser()); - ui_test_utils::FindInPage(chrome::GetActiveWebContents(browser()), - ASCIIToUTF16("a"), true, false, NULL, NULL); + ui_test_utils::FindInPage( + browser()->tab_strip_model()->GetActiveWebContents(), + ASCIIToUTF16("a"), true, false, NULL, NULL); ASSERT_TRUE(IsViewFocused(VIEW_ID_FIND_IN_PAGE_TEXT_FIELD)); // Focus the location bar. @@ -484,7 +485,7 @@ IN_PROC_BROWSER_TEST_F(BrowserFocusTest, LocationBarLockFocus) { chrome::FocusLocationBar(browser()); ASSERT_TRUE(content::ExecuteScript( - chrome::GetActiveWebContents(browser()), + browser()->tab_strip_model()->GetActiveWebContents(), "stealFocus();")); // Make sure the location bar is still focused. @@ -530,7 +531,7 @@ IN_PROC_BROWSER_TEST_F(BrowserFocusTest, MAYBE_FocusTraversal) { // Let's make sure the focus is on the expected element in the page. std::string actual; ASSERT_TRUE(content::ExecuteScriptAndExtractString( - chrome::GetActiveWebContents(browser()), + browser()->tab_strip_model()->GetActiveWebContents(), "window.domAutomationController.send(getFocusedElement());", &actual)); ASSERT_STREQ(kExpElementIDs[j], actual.c_str()); @@ -546,7 +547,8 @@ IN_PROC_BROWSER_TEST_F(BrowserFocusTest, MAYBE_FocusTraversal) { browser(), ui::VKEY_TAB, false, false, false, false, content::NOTIFICATION_FOCUS_CHANGED_IN_PAGE, content::NotificationSource(content::Source<RenderViewHost>( - chrome::GetActiveWebContents(browser())->GetRenderViewHost())), + browser()->tab_strip_model()->GetActiveWebContents()-> + GetRenderViewHost())), details)); } else { // On the last tab key press, the focus returns to the browser. @@ -589,7 +591,8 @@ IN_PROC_BROWSER_TEST_F(BrowserFocusTest, MAYBE_FocusTraversal) { browser(), ui::VKEY_TAB, false, true, false, false, content::NOTIFICATION_FOCUS_CHANGED_IN_PAGE, content::NotificationSource(content::Source<RenderViewHost>( - chrome::GetActiveWebContents(browser())->GetRenderViewHost())), + browser()->tab_strip_model()->GetActiveWebContents()-> + GetRenderViewHost())), details)); } else { // On the last tab key press, the focus returns to the browser. @@ -602,7 +605,7 @@ IN_PROC_BROWSER_TEST_F(BrowserFocusTest, MAYBE_FocusTraversal) { // Let's make sure the focus is on the expected element in the page. std::string actual; ASSERT_TRUE(content::ExecuteScriptAndExtractString( - chrome::GetActiveWebContents(browser()), + browser()->tab_strip_model()->GetActiveWebContents(), "window.domAutomationController.send(getFocusedElement());", &actual)); ASSERT_STREQ(next_element, actual.c_str()); @@ -628,9 +631,9 @@ IN_PROC_BROWSER_TEST_F(BrowserFocusTest, MAYBE_FocusTraversalOnInterstitial) { ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER)); // Let's show an interstitial. - TestInterstitialPage* interstitial_page = - new TestInterstitialPage(chrome::GetActiveWebContents(browser()), - true, GURL("http://interstitial.com")); + TestInterstitialPage* interstitial_page = new TestInterstitialPage( + browser()->tab_strip_model()->GetActiveWebContents(), + true, GURL("http://interstitial.com")); // Give some time for the interstitial to show. MessageLoop::current()->PostDelayedTask(FROM_HERE, MessageLoop::QuitClosure(), @@ -745,13 +748,13 @@ IN_PROC_BROWSER_TEST_F(BrowserFocusTest, DISABLED_InterstitialFocus) { // Page should have focus. ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER)); - EXPECT_TRUE(chrome::GetActiveWebContents(browser())->GetRenderViewHost()-> - GetView()->HasFocus()); + EXPECT_TRUE(browser()->tab_strip_model()->GetActiveWebContents()-> + GetRenderViewHost()->GetView()->HasFocus()); // Let's show an interstitial. - TestInterstitialPage* interstitial_page = - new TestInterstitialPage(chrome::GetActiveWebContents(browser()), - true, GURL("http://interstitial.com")); + TestInterstitialPage* interstitial_page = new TestInterstitialPage( + browser()->tab_strip_model()->GetActiveWebContents(), + true, GURL("http://interstitial.com")); // Give some time for the interstitial to show. MessageLoop::current()->PostDelayedTask(FROM_HERE, MessageLoop::QuitClosure(), @@ -831,26 +834,26 @@ IN_PROC_BROWSER_TEST_F(BrowserFocusTest, DISABLED_TabInitialFocus) { // Open the history tab, focus should be on the tab contents. chrome::ShowHistory(browser()); ASSERT_NO_FATAL_FAILURE(content::WaitForLoadStop( - chrome::GetActiveWebContents(browser()))); + browser()->tab_strip_model()->GetActiveWebContents())); EXPECT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER)); // Open the new tab, focus should be on the location bar. chrome::NewTab(browser()); ASSERT_NO_FATAL_FAILURE(content::WaitForLoadStop( - chrome::GetActiveWebContents(browser()))); + browser()->tab_strip_model()->GetActiveWebContents())); EXPECT_TRUE(IsViewFocused(location_bar_focus_view_id_)); // Open the download tab, focus should be on the tab contents. chrome::ShowDownloads(browser()); ASSERT_NO_FATAL_FAILURE(content::WaitForLoadStop( - chrome::GetActiveWebContents(browser()))); + browser()->tab_strip_model()->GetActiveWebContents())); EXPECT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER)); // Open about:blank, focus should be on the location bar. chrome::AddSelectedTabWithURL(browser(), GURL(chrome::kAboutBlankURL), content::PAGE_TRANSITION_LINK); ASSERT_NO_FATAL_FAILURE(content::WaitForLoadStop( - chrome::GetActiveWebContents(browser()))); + browser()->tab_strip_model()->GetActiveWebContents())); EXPECT_TRUE(IsViewFocused(location_bar_focus_view_id_)); } @@ -873,7 +876,8 @@ IN_PROC_BROWSER_TEST_F(BrowserFocusTest, FocusOnReload) { content::WindowedNotificationObserver observer( content::NOTIFICATION_LOAD_STOP, content::Source<NavigationController>( - &chrome::GetActiveWebContents(browser())->GetController())); + &browser()->tab_strip_model()->GetActiveWebContents()-> + GetController())); chrome::Reload(browser(), CURRENT_TAB); observer.Wait(); } @@ -888,7 +892,8 @@ IN_PROC_BROWSER_TEST_F(BrowserFocusTest, FocusOnReload) { content::WindowedNotificationObserver observer( content::NOTIFICATION_LOAD_STOP, content::Source<NavigationController>( - &chrome::GetActiveWebContents(browser())->GetController())); + &browser()->tab_strip_model()->GetActiveWebContents()-> + GetController())); chrome::Reload(browser(), CURRENT_TAB); observer.Wait(); } @@ -905,12 +910,13 @@ IN_PROC_BROWSER_TEST_F(BrowserFocusTest, DISABLED_FocusOnReloadCrashedTab) { // Open a regular page, crash, reload. ui_test_utils::NavigateToURL(browser(), test_server()->GetURL(kSimplePage)); - content::CrashTab(chrome::GetActiveWebContents(browser())); + content::CrashTab(browser()->tab_strip_model()->GetActiveWebContents()); { content::WindowedNotificationObserver observer( content::NOTIFICATION_LOAD_STOP, content::Source<NavigationController>( - &chrome::GetActiveWebContents(browser())->GetController())); + &browser()->tab_strip_model()->GetActiveWebContents()-> + GetController())); chrome::Reload(browser(), CURRENT_TAB); observer.Wait(); } diff --git a/chrome/browser/ui/cocoa/extensions/media_galleries_dialog_cocoa_browsertest.mm b/chrome/browser/ui/cocoa/extensions/media_galleries_dialog_cocoa_browsertest.mm index 7777712..9574c44 100644 --- a/chrome/browser/ui/cocoa/extensions/media_galleries_dialog_cocoa_browsertest.mm +++ b/chrome/browser/ui/cocoa/extensions/media_galleries_dialog_cocoa_browsertest.mm @@ -5,8 +5,9 @@ #include "chrome/browser/ui/cocoa/extensions/media_galleries_dialog_cocoa.h" #include "chrome/browser/media_gallery/media_galleries_dialog_controller_mock.h" -#include "chrome/browser/ui/browser_tabstrip.h" +#include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/cocoa/constrained_window/constrained_window_alert.h" +#include "chrome/browser/ui/tabs/tab_strip_model.h" #include "chrome/browser/ui/web_contents_modal_dialog_manager.h" #include "chrome/test/base/in_process_browser_test.h" #include "content/public/test/test_utils.h" @@ -26,7 +27,8 @@ class MediaGalleriesDialogBrowserTest : public InProcessBrowserTest { IN_PROC_BROWSER_TEST_F(MediaGalleriesDialogBrowserTest, Close) { NiceMock<MediaGalleriesDialogControllerMock> controller; - content::WebContents* web_contents = chrome::GetActiveWebContents(browser()); + content::WebContents* web_contents = + browser()->tab_strip_model()->GetActiveWebContents(); EXPECT_CALL(controller, web_contents()). WillRepeatedly(Return(web_contents)); diff --git a/chrome/browser/ui/cocoa/ssl_client_certificate_selector_cocoa_browsertest.mm b/chrome/browser/ui/cocoa/ssl_client_certificate_selector_cocoa_browsertest.mm index 77ee17e..1de9bca 100644 --- a/chrome/browser/ui/cocoa/ssl_client_certificate_selector_cocoa_browsertest.mm +++ b/chrome/browser/ui/cocoa/ssl_client_certificate_selector_cocoa_browsertest.mm @@ -8,8 +8,9 @@ #include "base/bind.h" #include "chrome/browser/ssl/ssl_client_certificate_selector_test.h" +#include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_commands.h" -#include "chrome/browser/ui/browser_tabstrip.h" +#include "chrome/browser/ui/tabs/tab_strip_model.h" #include "chrome/browser/ui/web_contents_modal_dialog_manager.h" #include "chrome/browser/ssl/ssl_client_certificate_selector.h" #include "content/public/browser/web_contents.h" @@ -32,7 +33,8 @@ typedef SSLClientCertificateSelectorTestBase SSLClientCertificateSelectorCocoaTest; IN_PROC_BROWSER_TEST_F(SSLClientCertificateSelectorCocoaTest, Basic) { - content::WebContents* web_contents = chrome::GetActiveWebContents(browser()); + content::WebContents* web_contents = + browser()->tab_strip_model()->GetActiveWebContents(); WebContentsModalDialogManager* web_contents_modal_dialog_manager = WebContentsModalDialogManager::FromWebContents(web_contents); EXPECT_FALSE(web_contents_modal_dialog_manager->IsShowingDialog()); @@ -68,7 +70,8 @@ IN_PROC_BROWSER_TEST_F(SSLClientCertificateSelectorCocoaTest, HideShow) { initWithNetworkSession:auth_requestor_->http_network_session_ certRequestInfo:auth_requestor_->cert_request_info_ callback:chrome::SelectCertificateCallback()]; - content::WebContents* web_contents = chrome::GetActiveWebContents(browser()); + content::WebContents* web_contents = + browser()->tab_strip_model()->GetActiveWebContents(); [selector displayForWebContents:web_contents]; content::RunAllPendingInMessageLoop(); diff --git a/chrome/browser/ui/fullscreen/fullscreen_controller_interactive_browsertest.cc b/chrome/browser/ui/fullscreen/fullscreen_controller_interactive_browsertest.cc index 85c2b772..ff74c5d 100644 --- a/chrome/browser/ui/fullscreen/fullscreen_controller_interactive_browsertest.cc +++ b/chrome/browser/ui/fullscreen/fullscreen_controller_interactive_browsertest.cc @@ -7,9 +7,9 @@ #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_commands.h" -#include "chrome/browser/ui/browser_tabstrip.h" #include "chrome/browser/ui/browser_window.h" #include "chrome/browser/ui/fullscreen/fullscreen_controller_test.h" +#include "chrome/browser/ui/tabs/tab_strip_model.h" #include "chrome/test/base/interactive_test_utils.h" #include "chrome/test/base/ui_test_utils.h" #include "content/public/browser/render_view_host.h" @@ -50,7 +50,7 @@ class FullscreenControllerInteractiveTest // Verify that IsMouseLocked is consistent between the // Fullscreen Controller and the Render View Host View. EXPECT_TRUE(browser()->IsMouseLocked() == - chrome::GetActiveWebContents(browser())-> + browser()->tab_strip_model()->GetActiveWebContents()-> GetRenderViewHost()->GetView()->IsMouseLocked()); return browser()->IsMouseLocked(); } @@ -156,7 +156,7 @@ FullscreenControllerInteractiveTest::TestFullscreenMouseLockContentSettings() { void FullscreenControllerInteractiveTest::ToggleTabFullscreen_Internal( bool enter_fullscreen, bool retry_until_success) { - WebContents* tab = chrome::GetActiveWebContents(browser()); + WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); do { FullscreenNotificationObserver fullscreen_observer; browser()->ToggleFullscreenModeForTab(tab, enter_fullscreen); @@ -363,7 +363,7 @@ IN_PROC_BROWSER_TEST_F( AddTabAtIndex(0, GURL(kAboutBlankURL), PAGE_TRANSITION_TYPED); - WebContents* tab = chrome::GetActiveWebContents(browser()); + WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); { FullscreenNotificationObserver fullscreen_observer; diff --git a/chrome/browser/ui/fullscreen/fullscreen_controller_test.cc b/chrome/browser/ui/fullscreen/fullscreen_controller_test.cc index 1e0df0f..ea26d7b 100644 --- a/chrome/browser/ui/fullscreen/fullscreen_controller_test.cc +++ b/chrome/browser/ui/fullscreen/fullscreen_controller_test.cc @@ -7,9 +7,9 @@ #include "base/command_line.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_commands.h" -#include "chrome/browser/ui/browser_tabstrip.h" #include "chrome/browser/ui/browser_window.h" #include "chrome/browser/ui/fullscreen/fullscreen_controller.h" +#include "chrome/browser/ui/tabs/tab_strip_model.h" #include "chrome/common/chrome_switches.h" #include "content/public/browser/web_contents.h" #include "content/public/test/test_navigation_observer.h" @@ -22,7 +22,7 @@ const char FullscreenControllerTest::kFullscreenMouseLockHTML[] = void FullscreenControllerTest::RequestToLockMouse( bool user_gesture, bool last_unlocked_by_target) { - WebContents* tab = chrome::GetActiveWebContents(browser()); + WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); browser()->RequestToLockMouse(tab, user_gesture, last_unlocked_by_target); } diff --git a/chrome/browser/ui/gtk/browser_window_gtk.cc b/chrome/browser/ui/gtk/browser_window_gtk.cc index ad2da1d..f3fa078 100644 --- a/chrome/browser/ui/gtk/browser_window_gtk.cc +++ b/chrome/browser/ui/gtk/browser_window_gtk.cc @@ -41,7 +41,6 @@ #include "chrome/browser/ui/browser_commands.h" #include "chrome/browser/ui/browser_dialogs.h" #include "chrome/browser/ui/browser_list.h" -#include "chrome/browser/ui/browser_tabstrip.h" #include "chrome/browser/ui/browser_window_state.h" #include "chrome/browser/ui/find_bar/find_bar_controller.h" #include "chrome/browser/ui/find_bar/find_tab_helper.h" @@ -740,7 +739,8 @@ void BrowserWindowGtk::BookmarkBarStateChanged( } void BrowserWindowGtk::UpdateDevTools() { - UpdateDevToolsForContents(chrome::GetActiveWebContents(browser_.get())); + UpdateDevToolsForContents( + browser_->tab_strip_model()->GetActiveWebContents()); } void BrowserWindowGtk::UpdateLoadingAnimations(bool should_animate) { @@ -770,7 +770,8 @@ void BrowserWindowGtk::LoadingAnimationCallback() { tabstrip_->UpdateLoadingAnimations(); } else if (ShouldShowWindowIcon()) { // ... or in the window icon area for popups and app windows. - WebContents* web_contents = chrome::GetActiveWebContents(browser_.get()); + WebContents* web_contents = + browser_->tab_strip_model()->GetActiveWebContents(); // GetSelectedTabContents can return NULL for example under Purify when // the animations are running slowly and this function is called on // a timer through LoadingAnimationCallback. @@ -1111,17 +1112,17 @@ void BrowserWindowGtk::ShowCreateChromeAppShortcutsDialog( void BrowserWindowGtk::Cut() { gtk_window_util::DoCut( - window_, chrome::GetActiveWebContents(browser_.get())); + window_, browser_->tab_strip_model()->GetActiveWebContents()); } void BrowserWindowGtk::Copy() { gtk_window_util::DoCopy( - window_, chrome::GetActiveWebContents(browser_.get())); + window_, browser_->tab_strip_model()->GetActiveWebContents()); } void BrowserWindowGtk::Paste() { gtk_window_util::DoPaste( - window_, chrome::GetActiveWebContents(browser_.get())); + window_, browser_->tab_strip_model()->GetActiveWebContents()); } gfx::Rect BrowserWindowGtk::GetInstantBounds() { @@ -1157,7 +1158,8 @@ void BrowserWindowGtk::ShowPasswordGenerationBubble( const gfx::Rect& rect, const content::PasswordForm& form, autofill::PasswordGenerator* password_generator) { - WebContents* web_contents = chrome::GetActiveWebContents(browser_.get()); + WebContents* web_contents = + browser_->tab_strip_model()->GetActiveWebContents(); if (!web_contents || !web_contents->GetContentNativeView()) { return; } @@ -1180,8 +1182,8 @@ void BrowserWindowGtk::Observe(int type, void BrowserWindowGtk::TabDetachedAt(WebContents* contents, int index) { // We use index here rather than comparing |contents| because by this time // the model has already removed |contents| from its list, so - // chrome::GetActiveWebContents(browser_.get()) will return NULL or something - // else. + // browser_->tab_strip_model()->GetActiveWebContents() will return NULL or + // something else. if (index == browser_->tab_strip_model()->active_index()) { infobar_container_->ChangeInfoBarService(NULL); UpdateDevToolsForContents(NULL); @@ -1979,7 +1981,8 @@ gboolean BrowserWindowGtk::OnKeyPress(GtkWidget* widget, GdkEventKey* event) { // If a widget besides the native view is focused, we have to try to handle // the custom accelerators before letting it handle them. - WebContents* current_web_contents = chrome::GetActiveWebContents(browser()); + WebContents* current_web_contents = + browser()->tab_strip_model()->GetActiveWebContents(); // The current tab might not have a render view if it crashed. if (!current_web_contents || !current_web_contents->GetContentNativeView() || !gtk_widget_is_focus(current_web_contents->GetContentNativeView())) { diff --git a/chrome/browser/ui/omnibox/omnibox_view_browsertest.cc b/chrome/browser/ui/omnibox/omnibox_view_browsertest.cc index 1769afb..94b762d 100644 --- a/chrome/browser/ui/omnibox/omnibox_view_browsertest.cc +++ b/chrome/browser/ui/omnibox/omnibox_view_browsertest.cc @@ -22,7 +22,6 @@ #include "chrome/browser/search_engines/template_url_service_factory.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_commands.h" -#include "chrome/browser/ui/browser_tabstrip.h" #include "chrome/browser/ui/browser_window.h" #include "chrome/browser/ui/omnibox/location_bar.h" #include "chrome/browser/ui/omnibox/omnibox_popup_model.h" @@ -590,9 +589,10 @@ class OmniboxViewTest : public InProcessBrowserTest, ASSERT_TRUE(SendKeyAndWait(browser(), ui::VKEY_RETURN, ui::EF_CONTROL_DOWN, content::NOTIFICATION_NAV_ENTRY_COMMITTED, content::Source<content::NavigationController>( - &chrome::GetActiveWebContents(browser())->GetController()))); + &browser()->tab_strip_model()->GetActiveWebContents()-> + GetController()))); - GURL url = chrome::GetActiveWebContents(browser())->GetURL(); + GURL url = browser()->tab_strip_model()->GetActiveWebContents()->GetURL(); EXPECT_STREQ(kDesiredTLDHostname, url.host().c_str()); } @@ -626,8 +626,9 @@ class OmniboxViewTest : public InProcessBrowserTest, ASSERT_TRUE(SendKeyAndWait(browser(), ui::VKEY_RETURN, 0, content::NOTIFICATION_NAV_ENTRY_COMMITTED, content::Source<content::NavigationController>( - &chrome::GetActiveWebContents(browser())->GetController()))); - GURL url = chrome::GetActiveWebContents(browser())->GetURL(); + &browser()->tab_strip_model()->GetActiveWebContents()-> + GetController()))); + GURL url = browser()->tab_strip_model()->GetActiveWebContents()->GetURL(); EXPECT_STREQ(kSearchTextURL, url.spec().c_str()); // Test that entering a single character then Enter performs a search. @@ -646,8 +647,9 @@ class OmniboxViewTest : public InProcessBrowserTest, ASSERT_TRUE(SendKeyAndWait(browser(), ui::VKEY_RETURN, 0, content::NOTIFICATION_NAV_ENTRY_COMMITTED, content::Source<content::NavigationController>( - &chrome::GetActiveWebContents(browser())->GetController()))); - url = chrome::GetActiveWebContents(browser())->GetURL(); + &browser()->tab_strip_model()->GetActiveWebContents()-> + GetController()))); + url = browser()->tab_strip_model()->GetActiveWebContents()->GetURL(); EXPECT_STREQ(kSearchSingleCharURL, url.spec().c_str()); } diff --git a/chrome/browser/ui/toolbar/wrench_menu_model_unittest.cc b/chrome/browser/ui/toolbar/wrench_menu_model_unittest.cc index bbd9585..52f2fb6 100644 --- a/chrome/browser/ui/toolbar/wrench_menu_model_unittest.cc +++ b/chrome/browser/ui/toolbar/wrench_menu_model_unittest.cc @@ -6,10 +6,10 @@ #include "chrome/app/chrome_command_ids.h" #include "chrome/browser/ui/browser.h" -#include "chrome/browser/ui/browser_tabstrip.h" #include "chrome/browser/ui/global_error/global_error.h" #include "chrome/browser/ui/global_error/global_error_service.h" #include "chrome/browser/ui/global_error/global_error_service_factory.h" +#include "chrome/browser/ui/tabs/tab_strip_model.h" #include "chrome/test/base/browser_with_test_window_test.h" #include "chrome/test/base/menu_model_test.h" #include "chrome/test/base/testing_profile.h" @@ -201,6 +201,6 @@ class EncodingMenuModelTest : public BrowserWithTestWindowTest, TEST_F(EncodingMenuModelTest, IsCommandIdCheckedWithNoTabs) { EncodingMenuModel model(browser()); - ASSERT_EQ(NULL, chrome::GetActiveWebContents(browser())); + ASSERT_EQ(NULL, browser()->tab_strip_model()->GetActiveWebContents()); EXPECT_FALSE(model.IsCommandIdChecked(IDC_ENCODING_ISO88591)); } diff --git a/chrome/browser/ui/views/bookmarks/bookmark_context_menu_controller_views_win.cc b/chrome/browser/ui/views/bookmarks/bookmark_context_menu_controller_views_win.cc index 04a986e..01780f7 100644 --- a/chrome/browser/ui/views/bookmarks/bookmark_context_menu_controller_views_win.cc +++ b/chrome/browser/ui/views/bookmarks/bookmark_context_menu_controller_views_win.cc @@ -10,9 +10,9 @@ #include "chrome/browser/ui/bookmarks/bookmark_utils.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_finder.h" -#include "chrome/browser/ui/browser_tabstrip.h" #include "chrome/browser/ui/browser_window.h" #include "chrome/browser/ui/host_desktop.h" +#include "chrome/browser/ui/tabs/tab_strip_model.h" #include "content/public/browser/page_navigator.h" #include "content/public/browser/user_metrics.h" #include "content/public/browser/web_contents.h" @@ -128,11 +128,11 @@ void BookmarkContextMenuControllerViewsWin::ExecuteCommand(int id) { false, chrome::HOST_DESKTOP_TYPE_NATIVE); content::PageNavigator* navigator = NULL; - if (!browser || !chrome::GetActiveWebContents(browser)) { + if (!browser || !browser->tab_strip_model()->GetActiveWebContents()) { navigator = &navigator_impl; } else { browser->window()->Activate(); - navigator = chrome::GetActiveWebContents(browser); + navigator = browser->tab_strip_model()->GetActiveWebContents(); } chrome::OpenAll(parent_widget()->GetNativeWindow(), navigator, diff --git a/chrome/browser/ui/webui/constrained_web_dialog_ui_browsertest.cc b/chrome/browser/ui/webui/constrained_web_dialog_ui_browsertest.cc index bfb0d7a..6030fb4 100644 --- a/chrome/browser/ui/webui/constrained_web_dialog_ui_browsertest.cc +++ b/chrome/browser/ui/webui/constrained_web_dialog_ui_browsertest.cc @@ -7,7 +7,7 @@ #include "base/utf_string_conversions.h" #include "chrome/browser/profiles/profile.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/browser/ui/web_contents_modal_dialog_manager.h" #include "chrome/browser/ui/webui/constrained_web_dialog_ui.h" #include "chrome/common/url_constants.h" @@ -60,7 +60,8 @@ IN_PROC_BROWSER_TEST_F(ConstrainedWebDialogBrowserTest, BasicTest) { // The delegate deletes itself. WebDialogDelegate* delegate = new ui::test::TestWebDialogDelegate( GURL(chrome::kChromeUIConstrainedHTMLTestURL)); - WebContents* web_contents = chrome::GetActiveWebContents(browser()); + WebContents* web_contents = + browser()->tab_strip_model()->GetActiveWebContents(); ASSERT_TRUE(web_contents); ConstrainedWebDialogDelegate* dialog_delegate = @@ -79,7 +80,8 @@ IN_PROC_BROWSER_TEST_F(ConstrainedWebDialogBrowserTest, // The delegate deletes itself. WebDialogDelegate* delegate = new ui::test::TestWebDialogDelegate( GURL(chrome::kChromeUIConstrainedHTMLTestURL)); - WebContents* web_contents = chrome::GetActiveWebContents(browser()); + WebContents* web_contents = + browser()->tab_strip_model()->GetActiveWebContents(); ASSERT_TRUE(web_contents); ConstrainedWebDialogDelegate* dialog_delegate = diff --git a/chrome/browser/ui/webui/inspect_ui_browsertest.cc b/chrome/browser/ui/webui/inspect_ui_browsertest.cc index ad52ebe6..158cd0b 100644 --- a/chrome/browser/ui/webui/inspect_ui_browsertest.cc +++ b/chrome/browser/ui/webui/inspect_ui_browsertest.cc @@ -3,7 +3,7 @@ // found in the LICENSE file. #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/url_constants.h" #include "chrome/test/base/in_process_browser_test.h" #include "chrome/test/base/ui_test_utils.h" @@ -41,7 +41,8 @@ IN_PROC_BROWSER_TEST_F(InspectUITest, DISABLED_SharedWorkersList) { NEW_FOREGROUND_TAB, ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); - WebContents* web_contents = chrome::GetActiveWebContents(browser()); + WebContents* web_contents = + browser()->tab_strip_model()->GetActiveWebContents(); ASSERT_TRUE(web_contents != NULL); std::string result; diff --git a/chrome/browser/ui/webui/options/options_ui_browsertest.cc b/chrome/browser/ui/webui/options/options_ui_browsertest.cc index 8dfd2cb..39e51a8 100644 --- a/chrome/browser/ui/webui/options/options_ui_browsertest.cc +++ b/chrome/browser/ui/webui/options/options_ui_browsertest.cc @@ -7,7 +7,7 @@ #include "base/string16.h" #include "base/utf_string_conversions.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/url_constants.h" #include "chrome/test/base/ui_test_utils.h" #include "content/public/browser/web_contents.h" @@ -28,7 +28,7 @@ void OptionsBrowserTest::NavigateToSettings() { void OptionsBrowserTest::VerifyNavbar() { bool navbar_exist = false; EXPECT_TRUE(content::ExecuteScriptAndExtractBool( - chrome::GetActiveWebContents(browser()), + browser()->tab_strip_model()->GetActiveWebContents(), "domAutomationController.send(" " !!document.getElementById('navigation'))", &navbar_exist)); @@ -36,7 +36,8 @@ void OptionsBrowserTest::VerifyNavbar() { } void OptionsBrowserTest::VerifyTitle() { - string16 title = chrome::GetActiveWebContents(browser())->GetTitle(); + string16 title = + browser()->tab_strip_model()->GetActiveWebContents()->GetTitle(); string16 expected_title = l10n_util::GetStringUTF16(IDS_SETTINGS_TITLE); EXPECT_NE(title.find(expected_title), string16::npos); } diff --git a/chrome/browser/ui/webui/options/preferences_browsertest.cc b/chrome/browser/ui/webui/options/preferences_browsertest.cc index 89a9dec..9d5289d 100644 --- a/chrome/browser/ui/webui/options/preferences_browsertest.cc +++ b/chrome/browser/ui/webui/options/preferences_browsertest.cc @@ -17,7 +17,7 @@ #include "chrome/browser/policy/policy_map.h" #include "chrome/browser/profiles/profile.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/pref_names.h" #include "chrome/common/url_constants.h" @@ -74,7 +74,8 @@ PreferencesBrowserTest::~PreferencesBrowserTest() { void PreferencesBrowserTest::SetUpOnMainThread() { ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUISettingsFrameURL)); - content::WebContents* web_contents = chrome::GetActiveWebContents(browser()); + content::WebContents* web_contents = + browser()->tab_strip_model()->GetActiveWebContents(); ASSERT_TRUE(web_contents); render_view_host_ = web_contents->GetRenderViewHost(); ASSERT_TRUE(render_view_host_); diff --git a/chrome/test/base/browser_with_test_window_test.cc b/chrome/test/base/browser_with_test_window_test.cc index 0bac364..6e34bd22 100644 --- a/chrome/test/base/browser_with_test_window_test.cc +++ b/chrome/test/base/browser_with_test_window_test.cc @@ -6,8 +6,8 @@ #include "base/synchronization/waitable_event.h" #include "chrome/browser/profiles/profile_destroyer.h" +#include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_navigator.h" -#include "chrome/browser/ui/browser_tabstrip.h" #include "chrome/browser/ui/tabs/tab_strip_model.h" #include "chrome/common/render_messages.h" #include "chrome/test/base/testing_profile.h" @@ -142,7 +142,8 @@ void BrowserWithTestWindowTest::NavigateAndCommit( } void BrowserWithTestWindowTest::NavigateAndCommitActiveTab(const GURL& url) { - NavigateAndCommit(&chrome::GetActiveWebContents(browser())->GetController(), + NavigateAndCommit(&browser()->tab_strip_model()->GetActiveWebContents()-> + GetController(), url); } @@ -150,8 +151,8 @@ void BrowserWithTestWindowTest::NavigateAndCommitActiveTabWithTitle( Browser* navigating_browser, const GURL& url, const string16& title) { - NavigationController* controller = - &chrome::GetActiveWebContents(navigating_browser)->GetController(); + NavigationController* controller = &navigating_browser->tab_strip_model()-> + GetActiveWebContents()->GetController(); NavigateAndCommit(controller, url); controller->GetActiveEntry()->SetTitle(title); } diff --git a/chrome/test/base/tracing_browsertest.cc b/chrome/test/base/tracing_browsertest.cc index 89b688f8..0d05f95 100644 --- a/chrome/test/base/tracing_browsertest.cc +++ b/chrome/test/base/tracing_browsertest.cc @@ -7,7 +7,8 @@ #include "base/debug/trace_event.h" #include "base/message_loop.h" #include "base/run_loop.h" -#include "chrome/browser/ui/browser_tabstrip.h" +#include "chrome/browser/ui/browser.h" +#include "chrome/browser/ui/tabs/tab_strip_model.h" #include "chrome/test/base/in_process_browser_test.h" #include "chrome/test/base/ui_test_utils.h" #include "content/public/browser/render_view_host.h" @@ -29,8 +30,8 @@ class TracingBrowserTest : public InProcessBrowserTest { // Execute some no-op javascript on the current tab - this triggers a trace // event in RenderViewImpl::OnScriptEvalRequest (from the renderer process). void ExecuteJavascriptOnCurrentTab() { - content::RenderViewHost* rvh = - chrome::GetActiveWebContents(browser())->GetRenderViewHost(); + content::RenderViewHost* rvh = browser()->tab_strip_model()-> + GetActiveWebContents()->GetRenderViewHost(); ASSERT_TRUE(rvh); ASSERT_TRUE(content::ExecuteScript(rvh, ";")); } diff --git a/chrome/test/data/webui/certificate_viewer_ui_test-inl.h b/chrome/test/data/webui/certificate_viewer_ui_test-inl.h index 0658b9c..bce2f44 100644 --- a/chrome/test/data/webui/certificate_viewer_ui_test-inl.h +++ b/chrome/test/data/webui/certificate_viewer_ui_test-inl.h @@ -4,8 +4,8 @@ #include "chrome/browser/certificate_viewer.h" #include "chrome/browser/ui/browser.h" -#include "chrome/browser/ui/browser_tabstrip.h" #include "chrome/browser/ui/browser_window.h" +#include "chrome/browser/ui/tabs/tab_strip_model.h" #include "chrome/browser/ui/webui/certificate_viewer_webui.h" #include "chrome/browser/ui/webui/web_ui_browsertest.h" #include "chrome/common/url_constants.h" @@ -39,7 +39,7 @@ void CertificateViewerUITest::ShowCertificateViewer() { CertificateViewerDialog* dialog = new CertificateViewerDialog( google_cert); dialog->AddObserver(&dialog_observer); - dialog->Show(chrome::GetActiveWebContents(browser()), + dialog->Show(browser()->tab_strip_model()->GetActiveWebContents(), browser()->window()->GetNativeWindow()); dialog->RemoveObserver(&dialog_observer); content::WebUI* webui = dialog_observer.GetWebUI(); diff --git a/chrome/test/gpu/gpu_mapsgl_endurance_browsertest.cc b/chrome/test/gpu/gpu_mapsgl_endurance_browsertest.cc index 61dec5b..891f18a 100644 --- a/chrome/test/gpu/gpu_mapsgl_endurance_browsertest.cc +++ b/chrome/test/gpu/gpu_mapsgl_endurance_browsertest.cc @@ -10,8 +10,8 @@ #include "base/json/json_reader.h" #include "base/path_service.h" #include "chrome/browser/ui/browser.h" -#include "chrome/browser/ui/browser_tabstrip.h" #include "chrome/browser/ui/browser_window.h" +#include "chrome/browser/ui/tabs/tab_strip_model.h" #include "chrome/browser/ui/window_snapshot/window_snapshot.h" #include "chrome/common/chrome_paths.h" #include "chrome/test/base/in_process_browser_test.h" @@ -232,7 +232,7 @@ class MapsGLEnduranceTest : public InProcessBrowserTest { gfx::Rect root_bounds = browser()->window()->GetBounds(); gfx::Rect tab_contents_bounds; - chrome::GetActiveWebContents(browser())->GetContainerBounds( + browser()->tab_strip_model()->GetActiveWebContents()->GetContainerBounds( &tab_contents_bounds); gfx::Rect snapshot_bounds(tab_contents_bounds.x() - root_bounds.x(), @@ -259,8 +259,8 @@ class MapsGLEnduranceTest : public InProcessBrowserTest { // have if the tab contents have the desired size. gfx::Rect GetNewTabContainerBounds(const gfx::Size& desired_size) { gfx::Rect container_rect; - chrome::GetActiveWebContents( - browser())->GetContainerBounds(&container_rect); + browser()->tab_strip_model()->GetActiveWebContents()-> + GetContainerBounds(&container_rect); // Size cannot be negative, so use a point. gfx::Point correction( desired_size.width() - container_rect.size().width(), diff --git a/chrome/test/gpu/webgl_infobar_browsertest.cc b/chrome/test/gpu/webgl_infobar_browsertest.cc index 936e0d7..9cd2eb0 100644 --- a/chrome/test/gpu/webgl_infobar_browsertest.cc +++ b/chrome/test/gpu/webgl_infobar_browsertest.cc @@ -10,7 +10,7 @@ #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_commands.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_notification_types.h" #include "chrome/common/chrome_paths.h" #include "chrome/common/chrome_switches.h" @@ -85,7 +85,8 @@ IN_PROC_BROWSER_TEST_F(WebGLInfobarTest, ContextLossRaisesInfobar) { infobar_added.Wait(); EXPECT_EQ(1u, InfoBarService::FromWebContents( - chrome::GetActiveWebContents(browser()))->GetInfoBarCount()); + browser()->tab_strip_model()->GetActiveWebContents())-> + GetInfoBarCount()); } IN_PROC_BROWSER_TEST_F(WebGLInfobarTest, ContextLossInfobarReload) { @@ -117,12 +118,13 @@ IN_PROC_BROWSER_TEST_F(WebGLInfobarTest, ContextLossInfobarReload) { content::NotificationService::AllSources()); SimulateGPUCrash(browser()); infobar_added.Wait(); - ASSERT_EQ(1u, + EXPECT_EQ(1u, InfoBarService::FromWebContents( - chrome::GetActiveWebContents(browser()))->GetInfoBarCount()); - InfoBarDelegate* delegate = - InfoBarService::FromWebContents( - chrome::GetActiveWebContents(browser()))->GetInfoBarDelegateAt(0); + browser()->tab_strip_model()->GetActiveWebContents())-> + GetInfoBarCount()); + InfoBarDelegate* delegate = InfoBarService::FromWebContents( + browser()->tab_strip_model()->GetActiveWebContents())-> + GetInfoBarDelegateAt(0); ASSERT_TRUE(delegate); ASSERT_TRUE(delegate->AsThreeDAPIInfoBarDelegate()); delegate->AsConfirmInfoBarDelegate()->Cancel(); diff --git a/chrome/test/nacl/nacl_browsertest_util.cc b/chrome/test/nacl/nacl_browsertest_util.cc index b4f4ee8..0a94f7b 100644 --- a/chrome/test/nacl/nacl_browsertest_util.cc +++ b/chrome/test/nacl/nacl_browsertest_util.cc @@ -8,7 +8,8 @@ #include "base/json/json_reader.h" #include "base/path_service.h" #include "base/values.h" -#include "chrome/browser/ui/browser_tabstrip.h" +#include "chrome/browser/ui/browser.h" +#include "chrome/browser/ui/tabs/tab_strip_model.h" #include "chrome/common/chrome_paths.h" #include "chrome/common/chrome_switches.h" #include "chrome/test/base/ui_test_utils.h" @@ -209,7 +210,7 @@ GURL NaClBrowserTestBase::TestURL(const FilePath::StringType& url_fragment) { bool NaClBrowserTestBase::RunJavascriptTest(const GURL& url, TestMessageHandler* handler) { JavascriptTestObserver observer( - chrome::GetActiveWebContents(browser())->GetRenderViewHost(), + browser()->tab_strip_model()->GetActiveWebContents()->GetRenderViewHost(), handler); ui_test_utils::NavigateToURL(browser(), url); return observer.Run(); diff --git a/chrome/test/perf/rendering/latency_tests.cc b/chrome/test/perf/rendering/latency_tests.cc index 639c26e..1e51a5b 100644 --- a/chrome/test/perf/rendering/latency_tests.cc +++ b/chrome/test/perf/rendering/latency_tests.cc @@ -14,7 +14,7 @@ #include "base/timer.h" #include "base/version.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_paths.h" #include "chrome/common/chrome_switches.h" #include "chrome/test/base/tracing.h" @@ -647,7 +647,7 @@ void LatencyTest::GetMeanFrameTimeMicros(int* frame_time) const { void LatencyTest::SendInput() { content::RenderViewHost* rvh = - chrome::GetActiveWebContents(browser())->GetRenderViewHost(); + browser()->tab_strip_model()->GetActiveWebContents()->GetRenderViewHost(); WebKit::WebMouseEvent mouse_event; mouse_event.movementX = 1; mouse_x_ += mouse_event.movementX; diff --git a/chrome/test/perf/rendering/throughput_tests.cc b/chrome/test/perf/rendering/throughput_tests.cc index 2757425..e58b898 100644 --- a/chrome/test/perf/rendering/throughput_tests.cc +++ b/chrome/test/perf/rendering/throughput_tests.cc @@ -15,8 +15,8 @@ #include "base/values.h" #include "chrome/browser/net/url_fixer_upper.h" #include "chrome/browser/ui/browser.h" -#include "chrome/browser/ui/browser_tabstrip.h" #include "chrome/browser/ui/browser_window.h" +#include "chrome/browser/ui/tabs/tab_strip_model.h" #include "chrome/browser/ui/window_snapshot/window_snapshot.h" #include "chrome/common/chrome_paths.h" #include "chrome/common/chrome_switches.h" @@ -220,7 +220,7 @@ class ThroughputTest : public BrowserPerfTest { gfx::Rect root_bounds = browser()->window()->GetBounds(); gfx::Rect tab_contents_bounds; - chrome::GetActiveWebContents(browser())->GetContainerBounds( + browser()->tab_strip_model()->GetActiveWebContents()->GetContainerBounds( &tab_contents_bounds); gfx::Rect snapshot_bounds(tab_contents_bounds.x() - root_bounds.x(), @@ -327,7 +327,8 @@ class ThroughputTest : public BrowserPerfTest { LOG(INFO) << gurl_.possibly_invalid_spec(); ui_test_utils::NavigateToURLWithDisposition( browser(), gurl_, CURRENT_TAB, ui_test_utils::BROWSER_TEST_NONE); - content::WaitForLoadStop(chrome::GetActiveWebContents(browser())); + content::WaitForLoadStop( + browser()->tab_strip_model()->GetActiveWebContents()); // Let the test spin up. LOG(INFO) << "Spinning up test..."; @@ -389,7 +390,7 @@ class ThroughputTest : public BrowserPerfTest { // Close the tab so that we can quit without timing out during the // wait-for-idle stage in browser_test framework. - chrome::GetActiveWebContents(browser())->Close(); + browser()->tab_strip_model()->GetActiveWebContents()->Close(); } private: |