diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-03 05:53:20 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-03 05:53:20 +0000 |
commit | 4ca153033f022dc6e11d6094daed41b1ed0a995f (patch) | |
tree | f4720517b10953166f84707ca3ec8b82de860884 | |
parent | 08bd3d71d969061b1588e6a4210f6d74b0ec0c6d (diff) | |
download | chromium_src-4ca153033f022dc6e11d6094daed41b1ed0a995f.zip chromium_src-4ca153033f022dc6e11d6094daed41b1ed0a995f.tar.gz chromium_src-4ca153033f022dc6e11d6094daed41b1ed0a995f.tar.bz2 |
Replace most of Browser::GetSelectedTabContents calls into Browser::GetSelectedWebContents. I've converted the easy ones, I'll do the ones with more dependencies in a separate change to keep things trivial to review.
I considered taking out GetSelectedTabContents altogether and having people just use GetSelectedTabContentsWrapper()->web_contents() per the existing comment in browser.h, but there are a lot of callers and it seemed too long to type.
BUG=98716
TBR=joi
Review URL: http://codereview.chromium.org/9015022
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@116122 0039d316-1c4b-4281-b951-d872f2087c98
137 files changed, 878 insertions, 765 deletions
diff --git a/chrome/browser/accessibility/accessibility_win_browsertest.cc b/chrome/browser/accessibility/accessibility_win_browsertest.cc index 2135b68..8d700e0 100644 --- a/chrome/browser/accessibility/accessibility_win_browsertest.cc +++ b/chrome/browser/accessibility/accessibility_win_browsertest.cc @@ -16,9 +16,9 @@ #include "chrome/test/base/ui_test_utils.h" #include "content/browser/renderer_host/render_view_host.h" #include "content/browser/renderer_host/render_widget_host_view_win.h" -#include "content/browser/tab_contents/tab_contents.h" #include "content/public/browser/notification_service.h" #include "content/public/browser/notification_types.h" +#include "content/public/browser/web_contents.h" #include "third_party/iaccessible2/ia2_api_all.h" #include "third_party/isimpledom/ISimpleDOMNode.h" @@ -196,7 +196,7 @@ void RecursiveFindNodeInAccessibilityTree( IAccessible* AccessibilityWinBrowserTest::GetRendererAccessible() { HWND hwnd_render_widget_host_view = - browser()->GetSelectedTabContents()->GetRenderWidgetHostView()-> + browser()->GetSelectedWebContents()->GetRenderWidgetHostView()-> GetNativeView(); // Invoke windows screen reader detection by sending the WM_GETOBJECT message @@ -216,7 +216,7 @@ AccessibilityWinBrowserTest::GetRendererAccessible() { } void AccessibilityWinBrowserTest::ExecuteScript(wstring script) { - browser()->GetSelectedTabContents()->GetRenderViewHost()-> + browser()->GetSelectedWebContents()->GetRenderViewHost()-> ExecuteJavascriptInWebFrame(L"", script); } diff --git a/chrome/browser/accessibility/dump_accessibility_tree_browsertest.cc b/chrome/browser/accessibility/dump_accessibility_tree_browsertest.cc index 77a7f4d..b8f8559 100644 --- a/chrome/browser/accessibility/dump_accessibility_tree_browsertest.cc +++ b/chrome/browser/accessibility/dump_accessibility_tree_browsertest.cc @@ -77,7 +77,7 @@ class DumpAccessibilityTreeTest : public InProcessBrowserTest { IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, PlatformTreeDifferenceTest) { RenderWidgetHostView* host_view = - browser()->GetSelectedTabContents()->GetRenderWidgetHostView(); + browser()->GetSelectedWebContents()->GetRenderWidgetHostView(); RenderWidgetHost* host = host_view->GetRenderWidgetHost(); RenderViewHost* view_host = static_cast<RenderViewHost*>(host); view_host->set_save_accessibility_tree_for_testing(true); diff --git a/chrome/browser/autofill/autofill_browsertest.cc b/chrome/browser/autofill/autofill_browsertest.cc index 4d1d1e6..5d5897c 100644 --- a/chrome/browser/autofill/autofill_browsertest.cc +++ b/chrome/browser/autofill/autofill_browsertest.cc @@ -28,12 +28,15 @@ #include "chrome/test/base/ui_test_utils.h" #include "content/browser/renderer_host/mock_render_process_host.h" #include "content/browser/renderer_host/render_view_host.h" -#include "content/browser/tab_contents/tab_contents.h" +#include "content/browser/tab_contents/navigation_controller.h" #include "content/public/browser/notification_service.h" +#include "content/public/browser/web_contents.h" #include "content/test/test_url_fetcher_factory.h" #include "testing/gtest/include/gtest/gtest.h" #include "ui/base/keycodes/keyboard_codes.h" +using content::WebContents; + static const char* kDataURIPrefix = "data:text/html;charset=utf-8,"; static const char* kTestFormString = "<form action=\"http://www.example.com/\" method=\"POST\">" @@ -129,14 +132,14 @@ class AutofillTest : public InProcessBrowserTest { const std::string& expected_value) { std::string value; ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractString( - browser()->GetSelectedTabContents()->GetRenderViewHost(), L"", + browser()->GetSelectedWebContents()->GetRenderViewHost(), L"", L"window.domAutomationController.send(" L"document.getElementById('" + field_name + L"').value);", &value)); EXPECT_EQ(expected_value, value); } RenderViewHost* render_view_host() { - return browser()->GetSelectedTabContents()->GetRenderViewHost(); + return browser()->GetSelectedWebContents()->GetRenderViewHost(); } void SimulateURLFetch(bool success) { @@ -633,8 +636,8 @@ IN_PROC_BROWSER_TEST_F(AutofillTest, MAYBE_AutofillAfterReload) { // Reload the page. LOG(WARNING) << "Reloading the page."; - TabContents* tab = - browser()->GetSelectedTabContentsWrapper()->tab_contents(); + WebContents* tab = + browser()->GetSelectedTabContentsWrapper()->web_contents(); tab->GetController().Reload(false); ui_test_utils::WaitForLoadStop(tab); diff --git a/chrome/browser/automation/automation_provider.cc b/chrome/browser/automation/automation_provider.cc index 9622c94..9d0ca8a 100644 --- a/chrome/browser/automation/automation_provider.cc +++ b/chrome/browser/automation/automation_provider.cc @@ -917,7 +917,7 @@ void AutomationProvider::ExecuteExtensionActionInActiveTabAsync( profile_->GetExtensionMessageService(); Browser* browser = browser_tracker_->GetResource(browser_handle); if (extension && service && message_service && browser) { - int tab_id = ExtensionTabUtil::GetTabId(browser->GetSelectedTabContents()); + int tab_id = ExtensionTabUtil::GetTabId(browser->GetSelectedWebContents()); if (extension->page_action()) { service->browser_event_router()->PageActionExecuted( browser->profile(), extension->id(), "action", tab_id, "", 1); diff --git a/chrome/browser/automation/automation_provider_observers.cc b/chrome/browser/automation/automation_provider_observers.cc index cc31ca7..62c4aa0 100644 --- a/chrome/browser/automation/automation_provider_observers.cc +++ b/chrome/browser/automation/automation_provider_observers.cc @@ -1080,7 +1080,7 @@ bool ExecuteBrowserCommandObserver::CreateAndRegisterObserver( case IDC_FORWARD: case IDC_RELOAD: { new NavigationNotificationObserver( - &browser->GetSelectedTabContents()->GetController(), + &browser->GetSelectedWebContents()->GetController(), automation, reply_message, 1, false, false); break; } diff --git a/chrome/browser/automation/automation_tab_helper_browsertest.cc b/chrome/browser/automation/automation_tab_helper_browsertest.cc index d5d8174..388d4df 100644 --- a/chrome/browser/automation/automation_tab_helper_browsertest.cc +++ b/chrome/browser/automation/automation_tab_helper_browsertest.cc @@ -19,12 +19,12 @@ #include "chrome/test/base/in_process_browser_test.h" #include "chrome/test/base/ui_test_utils.h" #include "content/browser/renderer_host/render_view_host.h" -#include "content/browser/tab_contents/tab_contents.h" #include "content/public/browser/notification_details.h" #include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_registrar.h" #include "content/public/browser/notification_service.h" #include "content/public/browser/notification_source.h" +#include "content/public/browser/web_contents.h" #include "net/base/net_util.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" @@ -91,7 +91,7 @@ class AutomationTabHelperBrowserTest : public InProcessBrowserTest { std::string script = base::StringPrintf("runTestCase(%d);", test_case_number); RenderViewHost* host = - browser()->GetSelectedTabContents()->GetRenderViewHost(); + browser()->GetSelectedWebContents()->GetRenderViewHost(); if (wait_for_response) { ASSERT_TRUE(ui_test_utils::ExecuteJavaScript( host, L"", ASCIIToWide(script))); diff --git a/chrome/browser/automation/testing_automation_provider.cc b/chrome/browser/automation/testing_automation_provider.cc index 8650080..f7f59ae 100644 --- a/chrome/browser/automation/testing_automation_provider.cc +++ b/chrome/browser/automation/testing_automation_provider.cc @@ -3538,7 +3538,7 @@ void TestingAutomationProvider::OmniboxAcceptInput( DictionaryValue* args, IPC::Message* reply_message) { NavigationController& controller = - browser->GetSelectedTabContents()->GetController(); + browser->GetSelectedWebContents()->GetController(); new OmniboxAcceptNotificationObserver(&controller, this, reply_message); browser->window()->GetLocationBar()->AcceptInput(); } @@ -5846,7 +5846,7 @@ void TestingAutomationProvider::LaunchApp( service->extension_prefs()->GetLaunchContainer( extension, ExtensionPrefs::LAUNCH_REGULAR); - TabContents* old_contents = browser->GetSelectedTabContents(); + WebContents* old_contents = browser->GetSelectedWebContents(); if (!old_contents) { AutomationJSONReply(this, reply_message).SendError( "Cannot identify selected tab contents."); diff --git a/chrome/browser/bookmarks/bookmark_utils.cc b/chrome/browser/bookmarks/bookmark_utils.cc index 62cc9c7..dae8644 100644 --- a/chrome/browser/bookmarks/bookmark_utils.cc +++ b/chrome/browser/bookmarks/bookmark_utils.cc @@ -157,7 +157,7 @@ void OpenAllImpl(const BookmarkNode* node, // the current page, reset the navigator just to be sure. Browser* new_browser = BrowserList::GetLastActiveWithProfile(profile); if (new_browser) { - TabContents* current_tab = new_browser->GetSelectedTabContents(); + WebContents* current_tab = new_browser->GetSelectedWebContents(); DCHECK(new_browser && current_tab); if (new_browser && current_tab) *navigator = current_tab; @@ -385,14 +385,14 @@ void OpenAll(gfx::NativeWindow parent, NewBrowserPageNavigator navigator_impl(profile); if (!navigator) { Browser* browser = BrowserList::FindTabbedBrowser(profile, false); - if (!browser || !browser->GetSelectedTabContents()) { + if (!browser || !browser->GetSelectedWebContents()) { navigator = &navigator_impl; } else { if (initial_disposition != NEW_WINDOW && initial_disposition != OFF_THE_RECORD) { browser->window()->Activate(); } - navigator = browser->GetSelectedTabContents(); + navigator = browser->GetSelectedWebContents(); } } @@ -652,21 +652,21 @@ void RegisterUserPrefs(PrefService* prefs) { PrefService::UNSYNCABLE_PREF); } -void GetURLAndTitleToBookmark(TabContents* tab_contents, +void GetURLAndTitleToBookmark(WebContents* web_contents, GURL* url, string16* title) { - *url = tab_contents->GetURL(); - *title = tab_contents->GetTitle(); + *url = web_contents->GetURL(); + *title = web_contents->GetTitle(); } void GetURLAndTitleToBookmarkFromCurrentTab(Profile* profile, GURL* url, string16* title) { Browser* browser = BrowserList::GetLastActiveWithProfile(profile); - TabContents* tab_contents = browser ? browser->GetSelectedTabContents() + WebContents* web_contents = browser ? browser->GetSelectedWebContents() : NULL; - if (tab_contents) - GetURLAndTitleToBookmark(tab_contents, url, title); + if (web_contents) + GetURLAndTitleToBookmark(web_contents, url, title); } void GetURLsForOpenTabs( diff --git a/chrome/browser/bookmarks/bookmark_utils.h b/chrome/browser/bookmarks/bookmark_utils.h index 67846a8..97f83f5 100644 --- a/chrome/browser/bookmarks/bookmark_utils.h +++ b/chrome/browser/bookmarks/bookmark_utils.h @@ -25,6 +25,7 @@ class TabContents; namespace content { class PageNavigator; +class WebContents; } namespace views { @@ -191,8 +192,8 @@ void ToggleWhenVisible(Profile* profile); // Register user preferences for BookmarksBar. void RegisterUserPrefs(PrefService* prefs); -// Fills in the URL and title for a bookmark of |tab_contents|. -void GetURLAndTitleToBookmark(TabContents* tab_contents, +// Fills in the URL and title for a bookmark of |web_contents|. +void GetURLAndTitleToBookmark(content::WebContents* web_contents, GURL* url, string16* title); diff --git a/chrome/browser/browser_commands_unittest.cc b/chrome/browser/browser_commands_unittest.cc index b2cd8da..60ccb42 100644 --- a/chrome/browser/browser_commands_unittest.cc +++ b/chrome/browser/browser_commands_unittest.cc @@ -161,14 +161,14 @@ TEST_F(BrowserCommandsTest, BackForwardInNewTab) { CommitPendingLoad(&second->GetController()); browser()->GoBack(NEW_FOREGROUND_TAB); ASSERT_EQ(3, browser()->active_index()); - ASSERT_EQ(url1, browser()->GetSelectedTabContents()->GetURL()); + ASSERT_EQ(url1, browser()->GetSelectedWebContents()->GetURL()); // Same thing again for forward. // TODO(brettw) bug 11055: see the comment above about why we need this. - CommitPendingLoad(&browser()->GetSelectedTabContents()->GetController()); + CommitPendingLoad(&browser()->GetSelectedWebContents()->GetController()); browser()->GoForward(NEW_FOREGROUND_TAB); ASSERT_EQ(4, browser()->active_index()); - ASSERT_EQ(url2, browser()->GetSelectedTabContents()->GetURL()); + ASSERT_EQ(url2, browser()->GetSelectedWebContents()->GetURL()); } // Tests IDC_SEARCH (the Search key on Chrome OS devices). @@ -178,13 +178,13 @@ TEST_F(BrowserCommandsTest, Search) { GURL non_ntp_url("http://foo/"); AddTab(browser(), non_ntp_url); ASSERT_EQ(1, browser()->tab_count()); - EXPECT_EQ(non_ntp_url, browser()->GetSelectedTabContents()->GetURL()); + EXPECT_EQ(non_ntp_url, browser()->GetSelectedWebContents()->GetURL()); // Pressing the Search key should open a new tab containing the NTP. browser()->Search(); ASSERT_EQ(2, browser()->tab_count()); ASSERT_EQ(1, browser()->active_index()); - GURL current_url = browser()->GetSelectedTabContents()->GetURL(); + GURL current_url = browser()->GetSelectedWebContents()->GetURL(); EXPECT_TRUE(current_url.SchemeIs(chrome::kChromeUIScheme)); EXPECT_EQ(chrome::kChromeUINewTabHost, current_url.host()); @@ -192,7 +192,7 @@ TEST_F(BrowserCommandsTest, Search) { browser()->Search(); ASSERT_EQ(2, browser()->tab_count()); ASSERT_EQ(1, browser()->active_index()); - current_url = browser()->GetSelectedTabContents()->GetURL(); + current_url = browser()->GetSelectedWebContents()->GetURL(); EXPECT_TRUE(current_url.SchemeIs(chrome::kChromeUIScheme)); EXPECT_EQ(chrome::kChromeUINewTabHost, current_url.host()); } diff --git a/chrome/browser/browser_focus_uitest.cc b/chrome/browser/browser_focus_uitest.cc index c4f687d..0ecab77 100644 --- a/chrome/browser/browser_focus_uitest.cc +++ b/chrome/browser/browser_focus_uitest.cc @@ -151,7 +151,7 @@ class BrowserFocusTest : public InProcessBrowserTest { class TestInterstitialPage : public InterstitialPage { public: - TestInterstitialPage(TabContents* tab, bool new_navigation, const GURL& url) + TestInterstitialPage(WebContents* tab, bool new_navigation, const GURL& url) : InterstitialPage(tab, new_navigation, url) { FilePath file_path; bool r = PathService::Get(chrome::DIR_TEST_DATA, &file_path); @@ -420,7 +420,7 @@ IN_PROC_BROWSER_TEST_F(BrowserFocusTest, focused_browser->window()->Activate(); ASSERT_TRUE(ui_test_utils::ExecuteJavaScript( - unfocused_browser->GetSelectedTabContents()->GetRenderViewHost(), L"", + unfocused_browser->GetSelectedWebContents()->GetRenderViewHost(), L"", L"stealFocus();")); // Make sure the first browser is still active. @@ -439,7 +439,7 @@ IN_PROC_BROWSER_TEST_F(BrowserFocusTest, LocationBarLockFocus) { browser()->FocusLocationBar(); ASSERT_TRUE(ui_test_utils::ExecuteJavaScript( - browser()->GetSelectedTabContents()->GetRenderViewHost(), L"", + browser()->GetSelectedWebContents()->GetRenderViewHost(), L"", L"stealFocus();")); // Make sure the location bar is still focused. @@ -485,7 +485,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(ui_test_utils::ExecuteJavaScriptAndExtractString( - browser()->GetSelectedTabContents()->GetRenderViewHost(), + browser()->GetSelectedWebContents()->GetRenderViewHost(), L"", L"window.domAutomationController.send(getFocusedElement());", &actual)); @@ -502,7 +502,7 @@ 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>( - browser()->GetSelectedTabContents()->GetRenderViewHost())), + browser()->GetSelectedWebContents()->GetRenderViewHost())), details)); } else { // On the last tab key press, the focus returns to the browser. @@ -545,7 +545,7 @@ 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>( - browser()->GetSelectedTabContents()->GetRenderViewHost())), + browser()->GetSelectedWebContents()->GetRenderViewHost())), details)); } else { // On the last tab key press, the focus returns to the browser. @@ -558,7 +558,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(ui_test_utils::ExecuteJavaScriptAndExtractString( - browser()->GetSelectedTabContents()->GetRenderViewHost(), + browser()->GetSelectedWebContents()->GetRenderViewHost(), L"", L"window.domAutomationController.send(getFocusedElement());", &actual)); @@ -586,7 +586,7 @@ IN_PROC_BROWSER_TEST_F(BrowserFocusTest, MAYBE_FocusTraversalOnInterstitial) { // Let's show an interstitial. TestInterstitialPage* interstitial_page = - new TestInterstitialPage(browser()->GetSelectedTabContents(), + new TestInterstitialPage(browser()->GetSelectedWebContents(), true, GURL("http://interstitial.com")); interstitial_page->Show(); // Give some time for the interstitial to show. @@ -707,12 +707,12 @@ IN_PROC_BROWSER_TEST_F(BrowserFocusTest, InterstitialFocus) { // Page should have focus. ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER_FOCUS_VIEW)); - EXPECT_TRUE(browser()->GetSelectedTabContents()->GetRenderViewHost()->view()-> + EXPECT_TRUE(browser()->GetSelectedWebContents()->GetRenderViewHost()->view()-> HasFocus()); // Let's show an interstitial. TestInterstitialPage* interstitial_page = - new TestInterstitialPage(browser()->GetSelectedTabContents(), + new TestInterstitialPage(browser()->GetSelectedWebContents(), true, GURL("http://interstitial.com")); interstitial_page->Show(); // Give some time for the interstitial to show. @@ -812,26 +812,26 @@ IN_PROC_BROWSER_TEST_F(BrowserFocusTest, FLAKY_TabInitialFocus) { // Open the history tab, focus should be on the tab contents. browser()->ShowHistoryTab(); ASSERT_NO_FATAL_FAILURE(ui_test_utils::WaitForLoadStop( - browser()->GetSelectedTabContents())); + browser()->GetSelectedWebContents())); EXPECT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER_FOCUS_VIEW)); // Open the new tab, focus should be on the location bar. browser()->NewTab(); ASSERT_NO_FATAL_FAILURE(ui_test_utils::WaitForLoadStop( - browser()->GetSelectedTabContents())); + browser()->GetSelectedWebContents())); EXPECT_TRUE(IsViewFocused(location_bar_focus_view_id_)); // Open the download tab, focus should be on the tab contents. browser()->ShowDownloadsTab(); ASSERT_NO_FATAL_FAILURE(ui_test_utils::WaitForLoadStop( - browser()->GetSelectedTabContents())); + browser()->GetSelectedWebContents())); EXPECT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER_FOCUS_VIEW)); // Open about:blank, focus should be on the location bar. browser()->AddSelectedTabWithURL(GURL(chrome::kAboutBlankURL), content::PAGE_TRANSITION_LINK); ASSERT_NO_FATAL_FAILURE(ui_test_utils::WaitForLoadStop( - browser()->GetSelectedTabContents())); + browser()->GetSelectedWebContents())); EXPECT_TRUE(IsViewFocused(location_bar_focus_view_id_)); } @@ -888,7 +888,7 @@ IN_PROC_BROWSER_TEST_F(BrowserFocusTest, DISABLED_FocusOnReloadCrashedTab) { // Open a regular page, crash, reload. ui_test_utils::NavigateToURL(browser(), test_server()->GetURL(kSimplePage)); - ui_test_utils::CrashTab(browser()->GetSelectedTabContents()); + ui_test_utils::CrashTab(browser()->GetSelectedWebContents()); { ui_test_utils::WindowedNotificationObserver observer( content::NOTIFICATION_LOAD_STOP, diff --git a/chrome/browser/chromeos/tab_closeable_state_watcher_browsertest.cc b/chrome/browser/chromeos/tab_closeable_state_watcher_browsertest.cc index bb37933..41603ce 100644 --- a/chrome/browser/chromeos/tab_closeable_state_watcher_browsertest.cc +++ b/chrome/browser/chromeos/tab_closeable_state_watcher_browsertest.cc @@ -15,13 +15,15 @@ #include "chrome/common/url_constants.h" #include "chrome/test/base/in_process_browser_test.h" #include "chrome/test/base/ui_test_utils.h" -#include "content/browser/tab_contents/tab_contents.h" #include "content/public/browser/notification_service.h" #include "content/public/browser/notification_types.h" +#include "content/public/browser/web_contents.h" #include "googleurl/src/gurl.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" +using content::WebContents; + namespace chromeos { class TabCloseableStateWatcherTest : public InProcessBrowserTest { @@ -188,7 +190,7 @@ IN_PROC_BROWSER_TEST_F(TabCloseableStateWatcherTest, CloseCloseableTab) { EXPECT_TRUE(CanCloseTab(browser())); browser()->CloseTab(); EXPECT_EQ(1, browser()->tab_count()); - EXPECT_EQ(ntp_url_, browser()->GetSelectedTabContents()->GetURL()); + EXPECT_EQ(ntp_url_, browser()->GetSelectedWebContents()->GetURL()); } // Tests closing a closeable browser - all tabs in browser should be closed, @@ -200,7 +202,7 @@ IN_PROC_BROWSER_TEST_F(TabCloseableStateWatcherTest, CloseCloseableBrowser) { EXPECT_EQ(1u, BrowserList::size()); EXPECT_EQ(browser(), *(BrowserList::begin())); EXPECT_EQ(1, browser()->tab_count()); - EXPECT_EQ(ntp_url_, browser()->GetSelectedTabContents()->GetURL()); + EXPECT_EQ(ntp_url_, browser()->GetSelectedWebContents()->GetURL()); } // Tests closing a non-closeable tab and hence non-closeable browser - tab and @@ -211,17 +213,17 @@ IN_PROC_BROWSER_TEST_F(TabCloseableStateWatcherTest, EXPECT_EQ(1, browser()->tab_count()); NavigateToURL(ntp_url_); EXPECT_FALSE(CanCloseTab(browser())); - TabContents* tab_contents = browser()->GetSelectedTabContents(); + WebContents* web_contents = browser()->GetSelectedWebContents(); browser()->CloseTab(); EXPECT_EQ(1, browser()->tab_count()); - EXPECT_EQ(tab_contents, browser()->GetSelectedTabContents()); + EXPECT_EQ(web_contents, browser()->GetSelectedWebContents()); // Close browser with non-closeable tab. browser()->CloseWindow(); EXPECT_EQ(1u, BrowserList::size()); EXPECT_EQ(browser(), *(BrowserList::begin())); EXPECT_EQ(1, browser()->tab_count()); - EXPECT_EQ(tab_contents, browser()->GetSelectedTabContents()); + EXPECT_EQ(web_contents, browser()->GetSelectedWebContents()); } // Tests an incognito browsr with a normal browser. @@ -271,7 +273,7 @@ IN_PROC_BROWSER_TEST_F(TabCloseableStateWatcherTest, CloseIncognitoBrowser) { EXPECT_EQ(1u, BrowserList::size()); EXPECT_FALSE(new_browser->profile()->IsOffTheRecord()); EXPECT_EQ(1, new_browser->tab_count()); - EXPECT_EQ(ntp_url_, new_browser->GetSelectedTabContents()->GetURL()); + EXPECT_EQ(ntp_url_, new_browser->GetSelectedWebContents()->GetURL()); } // Tests closing of browser with BeforeUnload handler where user clicks cancel @@ -285,7 +287,7 @@ IN_PROC_BROWSER_TEST_F(TabCloseableStateWatcherTest, EXPECT_TRUE(CanCloseTab(browser())); // Close browser, click Cancel in BeforeUnload confirm dialog. - TabContents* tab_contents = browser()->GetSelectedTabContents(); + WebContents* web_contents = browser()->GetSelectedWebContents(); browser()->CloseWindow(); AppModalDialog* confirm = ui_test_utils::WaitForAppModalDialog(); confirm->native_dialog()->CancelAppModalDialog(); @@ -293,7 +295,7 @@ IN_PROC_BROWSER_TEST_F(TabCloseableStateWatcherTest, EXPECT_EQ(1u, BrowserList::size()); EXPECT_EQ(browser(), *(BrowserList::begin())); EXPECT_EQ(1, browser()->tab_count()); - EXPECT_EQ(tab_contents, browser()->GetSelectedTabContents()); + EXPECT_EQ(web_contents, browser()->GetSelectedWebContents()); // Close the browser. browser()->CloseWindow(); @@ -319,7 +321,7 @@ IN_PROC_BROWSER_TEST_F(TabCloseableStateWatcherTest, EXPECT_EQ(1u, BrowserList::size()); EXPECT_EQ(browser(), *(BrowserList::begin())); EXPECT_EQ(1, browser()->tab_count()); - EXPECT_EQ(ntp_url_, browser()->GetSelectedTabContents()->GetURL()); + EXPECT_EQ(ntp_url_, browser()->GetSelectedWebContents()->GetURL()); } } // namespace chromeos diff --git a/chrome/browser/custom_handlers/protocol_handler_registry_browsertest.cc b/chrome/browser/custom_handlers/protocol_handler_registry_browsertest.cc index bb01f818..7e09693 100644 --- a/chrome/browser/custom_handlers/protocol_handler_registry_browsertest.cc +++ b/chrome/browser/custom_handlers/protocol_handler_registry_browsertest.cc @@ -16,6 +16,8 @@ #include "content/public/browser/navigation_entry.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebContextMenuData.h" +using content::WebContents; + namespace { class TestRenderViewContextMenu : public RenderViewContextMenu { @@ -44,8 +46,8 @@ class RegisterProtocolHandlerBrowserTest : public InProcessBrowserTest { params.media_type = WebKit::WebContextMenuData::MediaTypeNone; params.link_url = url; params.unfiltered_link_url = url; - TabContents* tab_contents = browser()->GetSelectedTabContents(); - params.page_url = tab_contents->GetController().GetActiveEntry()->GetURL(); + WebContents* web_contents = browser()->GetSelectedWebContents(); + params.page_url = web_contents->GetController().GetActiveEntry()->GetURL(); #if defined(OS_MACOSX) params.writing_direction_default = 0; params.writing_direction_left_to_right = 0; diff --git a/chrome/browser/debugger/devtools_window.cc b/chrome/browser/debugger/devtools_window.cc index 22c5037..efa57fe 100644 --- a/chrome/browser/debugger/devtools_window.cc +++ b/chrome/browser/debugger/devtools_window.cc @@ -79,7 +79,7 @@ void DevToolsWindow::RegisterUserPrefs(PrefService* prefs) { // static TabContentsWrapper* DevToolsWindow::GetDevToolsContents( - TabContents* inspected_tab) { + WebContents* inspected_tab) { if (!inspected_tab) return NULL; diff --git a/chrome/browser/debugger/devtools_window.h b/chrome/browser/debugger/devtools_window.h index 7b14051..b8fb5da 100644 --- a/chrome/browser/debugger/devtools_window.h +++ b/chrome/browser/debugger/devtools_window.h @@ -35,6 +35,7 @@ class Value; namespace content { class DevToolsAgentHost; class DevToolsClientHost; +class WebContents; } class DevToolsWindow : private content::NotificationObserver, @@ -43,7 +44,8 @@ class DevToolsWindow : private content::NotificationObserver, public: static const char kDevToolsApp[]; static void RegisterUserPrefs(PrefService* prefs); - static TabContentsWrapper* GetDevToolsContents(TabContents* inspected_tab); + static TabContentsWrapper* GetDevToolsContents( + content::WebContents* inspected_tab); static bool IsDevToolsWindow(RenderViewHost* window_rvh); static DevToolsWindow* OpenDevToolsWindowForWorker( diff --git a/chrome/browser/download/download_browsertest.cc b/chrome/browser/download/download_browsertest.cc index 0f2447d..05e8679 100644 --- a/chrome/browser/download/download_browsertest.cc +++ b/chrome/browser/download/download_browsertest.cc @@ -55,6 +55,7 @@ using content::BrowserThread; using content::DownloadItem; using content::DownloadManager; +using content::WebContents; namespace { @@ -595,7 +596,7 @@ class DownloadTest : public InProcessBrowserTest { return; ActiveDownloadsUI* downloads_ui = static_cast<ActiveDownloadsUI*>( - popup->GetSelectedTabContents()->GetWebUI()); + popup->GetSelectedWebContents()->GetWebUI()); ASSERT_TRUE(downloads_ui); const ActiveDownloadsUI::DownloadList& downloads = @@ -1323,7 +1324,7 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, ChromeURLAfterDownload) { ui_test_utils::NavigateToURL(browser(), flags_url); DownloadAndWait(browser(), download_url, EXPECT_NO_SELECT_DIALOG); ui_test_utils::NavigateToURL(browser(), extensions_url); - TabContents* contents = browser()->GetSelectedTabContents(); + WebContents* contents = browser()->GetSelectedWebContents(); ASSERT_TRUE(contents); bool webui_responded = false; EXPECT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( @@ -1344,7 +1345,7 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, BrowserCloseAfterDownload) { GURL download_url(URLRequestMockHTTPJob::GetMockUrl(file)); ui_test_utils::NavigateToURL(browser(), downloads_url); - TabContents* contents = browser()->GetSelectedTabContents(); + WebContents* contents = browser()->GetSelectedWebContents(); ASSERT_TRUE(contents); bool result = false; EXPECT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( diff --git a/chrome/browser/extensions/app_process_apitest.cc b/chrome/browser/extensions/app_process_apitest.cc index 2750094..c6f7575 100644 --- a/chrome/browser/extensions/app_process_apitest.cc +++ b/chrome/browser/extensions/app_process_apitest.cc @@ -24,6 +24,8 @@ #include "content/test/test_navigation_observer.h" #include "net/base/mock_host_resolver.h" +using content::WebContents; + class AppApiTest : public ExtensionApiTest { protected: // Gets the base URL for files for a specific test, making sure that it uses @@ -55,7 +57,7 @@ static void WindowOpenHelper(Browser* browser, // Now the active tab in last active window should be the new tab. Browser* last_active_browser = BrowserList::GetLastActive(); EXPECT_TRUE(last_active_browser); - TabContents* newtab = last_active_browser->GetSelectedTabContents(); + WebContents* newtab = last_active_browser->GetSelectedWebContents(); EXPECT_TRUE(newtab); observer.Wait(); EXPECT_EQ(url, newtab->GetController().GetLastCommittedEntry()->GetURL()); @@ -505,7 +507,7 @@ IN_PROC_BROWSER_TEST_F(AppApiTest, OpenAppFromIframe) { Browser* last_active_browser = BrowserList::GetLastActive(); EXPECT_TRUE(last_active_browser); ASSERT_NE(browser(), last_active_browser); - TabContents* newtab = last_active_browser->GetSelectedTabContents(); + WebContents* newtab = last_active_browser->GetSelectedWebContents(); EXPECT_TRUE(newtab); if (!newtab->GetController().GetLastCommittedEntry() || newtab->GetController().GetLastCommittedEntry()->GetURL() != app_url) { @@ -560,7 +562,7 @@ IN_PROC_BROWSER_TEST_F(AppApiTest, OpenAppFromExtension) { // App has loaded, and chrome.app.isInstalled should be true. bool is_installed = false; ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( - browser()->GetSelectedTabContents()->GetRenderViewHost(), L"", + browser()->GetSelectedWebContents()->GetRenderViewHost(), L"", L"window.domAutomationController.send(chrome.app.isInstalled)", &is_installed)); ASSERT_TRUE(is_installed); @@ -614,7 +616,7 @@ IN_PROC_BROWSER_TEST_F(AppApiTest, OpenWebPopupFromWebIframe) { Browser* last_active_browser = BrowserList::GetLastActive(); EXPECT_TRUE(last_active_browser); ASSERT_NE(browser(), last_active_browser); - TabContents* newtab = last_active_browser->GetSelectedTabContents(); + WebContents* newtab = last_active_browser->GetSelectedWebContents(); EXPECT_TRUE(newtab); GURL non_app_url = base_url.Resolve("path3/empty.html"); observer.Wait(); @@ -649,7 +651,7 @@ IN_PROC_BROWSER_TEST_F(AppApiTest, ReloadAppAfterCrash) { ASSERT_TRUE(is_installed); // Crash the tab and reload it, chrome.app.isInstalled should still be true. - ui_test_utils::CrashTab(browser()->GetSelectedTabContents()); + ui_test_utils::CrashTab(browser()->GetSelectedWebContents()); ui_test_utils::WindowedNotificationObserver observer( content::NOTIFICATION_LOAD_STOP, content::Source<NavigationController>( diff --git a/chrome/browser/extensions/browser_action_apitest.cc b/chrome/browser/extensions/browser_action_apitest.cc index 9112e5b..7a97005 100644 --- a/chrome/browser/extensions/browser_action_apitest.cc +++ b/chrome/browser/extensions/browser_action_apitest.cc @@ -25,6 +25,8 @@ #include "ui/gfx/rect.h" #include "ui/gfx/size.h" +using content::WebContents; + class BrowserActionApiTest : public ExtensionApiTest { public: BrowserActionApiTest() {} @@ -78,7 +80,7 @@ IN_PROC_BROWSER_TEST_F(BrowserActionApiTest, Basic) { browser()->profile(), action->extension_id(), browser()); // Verify the command worked. - TabContents* tab = browser()->GetSelectedTabContents(); + WebContents* tab = browser()->GetSelectedWebContents(); bool result = false; ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( tab->GetRenderViewHost(), L"", @@ -191,7 +193,7 @@ IN_PROC_BROWSER_TEST_F(BrowserActionApiTest, BrowserActionAddPopup) { const Extension* extension = GetSingleLoadedExtension(); ASSERT_TRUE(extension) << message_; - int tab_id = ExtensionTabUtil::GetTabId(browser()->GetSelectedTabContents()); + int tab_id = ExtensionTabUtil::GetTabId(browser()->GetSelectedWebContents()); ExtensionAction* browser_action = extension->browser_action(); ASSERT_TRUE(browser_action) @@ -246,7 +248,7 @@ IN_PROC_BROWSER_TEST_F(BrowserActionApiTest, BrowserActionRemovePopup) { const Extension* extension = GetSingleLoadedExtension(); ASSERT_TRUE(extension) << message_; - int tab_id = ExtensionTabUtil::GetTabId(browser()->GetSelectedTabContents()); + int tab_id = ExtensionTabUtil::GetTabId(browser()->GetSelectedWebContents()); ExtensionAction* browser_action = extension->browser_action(); ASSERT_TRUE(browser_action) diff --git a/chrome/browser/extensions/chrome_app_api_browsertest.cc b/chrome/browser/extensions/chrome_app_api_browsertest.cc index e34075b..7335306 100644 --- a/chrome/browser/extensions/chrome_app_api_browsertest.cc +++ b/chrome/browser/extensions/chrome_app_api_browsertest.cc @@ -15,7 +15,7 @@ #include "chrome/common/extensions/extension.h" #include "chrome/common/extensions/manifest.h" #include "chrome/test/base/ui_test_utils.h" -#include "content/browser/tab_contents/tab_contents.h" +#include "content/public/browser/web_contents.h" #include "googleurl/src/gurl.h" #include "net/base/mock_host_resolver.h" @@ -27,7 +27,7 @@ class ChromeAppAPITest : public ExtensionBrowserTest { bool result; CHECK( ui_test_utils::ExecuteJavaScriptAndExtractBool( - browser()->GetSelectedTabContents()->GetRenderViewHost(), + browser()->GetSelectedWebContents()->GetRenderViewHost(), L"", get_app_is_installed, &result)); return result; } @@ -81,7 +81,7 @@ IN_PROC_BROWSER_TEST_F(ChromeAppAPITest, IsInstalled) { std::string result; ASSERT_TRUE( ui_test_utils::ExecuteJavaScriptAndExtractString( - browser()->GetSelectedTabContents()->GetRenderViewHost(), + browser()->GetSelectedWebContents()->GetRenderViewHost(), L"", get_app_details, &result)); EXPECT_EQ("null", result); @@ -94,7 +94,7 @@ IN_PROC_BROWSER_TEST_F(ChromeAppAPITest, IsInstalled) { ui_test_utils::NavigateToURL(browser(), app_url); ASSERT_TRUE( ui_test_utils::ExecuteJavaScriptAndExtractString( - browser()->GetSelectedTabContents()->GetRenderViewHost(), + browser()->GetSelectedWebContents()->GetRenderViewHost(), L"", get_app_details, &result)); scoped_ptr<DictionaryValue> app_details( static_cast<DictionaryValue*>( @@ -108,7 +108,7 @@ IN_PROC_BROWSER_TEST_F(ChromeAppAPITest, IsInstalled) { // that isInstalled should have the initial value. ASSERT_TRUE( ui_test_utils::ExecuteJavaScriptAndExtractString( - browser()->GetSelectedTabContents()->GetRenderViewHost(), + browser()->GetSelectedWebContents()->GetRenderViewHost(), L"", L"window.domAutomationController.send(" L" function() {" @@ -159,7 +159,7 @@ IN_PROC_BROWSER_TEST_F(ChromeAppAPITest, GetDetailsForFrame) { bool result = false; ASSERT_TRUE( ui_test_utils::ExecuteJavaScriptAndExtractBool( - browser()->GetSelectedTabContents()->GetRenderViewHost(), + browser()->GetSelectedWebContents()->GetRenderViewHost(), L"", test_unsuccessful_access, &result)); EXPECT_TRUE(result); @@ -172,7 +172,7 @@ IN_PROC_BROWSER_TEST_F(ChromeAppAPITest, GetDetailsForFrame) { std::string json; ASSERT_TRUE( ui_test_utils::ExecuteJavaScriptAndExtractString( - browser()->GetSelectedTabContents()->GetRenderViewHost(), + browser()->GetSelectedWebContents()->GetRenderViewHost(), L"", get_details_for_frame, &json)); scoped_ptr<DictionaryValue> app_details( diff --git a/chrome/browser/extensions/content_script_apitest.cc b/chrome/browser/extensions/content_script_apitest.cc index fe37ec8..cba4f12 100644 --- a/chrome/browser/extensions/content_script_apitest.cc +++ b/chrome/browser/extensions/content_script_apitest.cc @@ -10,7 +10,7 @@ #include "chrome/common/chrome_switches.h" #include "chrome/common/extensions/extension.h" #include "chrome/test/base/ui_test_utils.h" -#include "content/browser/tab_contents/tab_contents.h" +#include "content/public/browser/web_contents.h" #include "googleurl/src/gurl.h" #include "net/base/mock_host_resolver.h" @@ -100,7 +100,7 @@ IN_PROC_BROWSER_TEST_F( // And check that its styles were affected by the styles that just got loaded. bool styles_injected; ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( - browser()->GetSelectedTabContents()->GetRenderViewHost(), L"", + browser()->GetSelectedWebContents()->GetRenderViewHost(), L"", L"window.domAutomationController.send(" L"document.defaultView.getComputedStyle(document.body, null)." L"getPropertyValue('background-color') == 'rgb(255, 0, 0)')", diff --git a/chrome/browser/extensions/extension_browsertests_misc.cc b/chrome/browser/extensions/extension_browsertests_misc.cc index 21ed98f..5450230 100644 --- a/chrome/browser/extensions/extension_browsertests_misc.cc +++ b/chrome/browser/extensions/extension_browsertests_misc.cc @@ -37,6 +37,8 @@ #include "chrome/browser/ui/views/frame/browser_view.h" #endif +using content::WebContents; + const std::string kSubscribePage = "/subscribe.html"; const std::string kFeedPage = "files/feeds/feed.html"; const std::string kFeedPageMultiRel = "files/feeds/feed_multi_rel.html"; @@ -96,7 +98,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, TabContents) { bool result = false; ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( - browser()->GetSelectedTabContents()->GetRenderViewHost(), L"", + browser()->GetSelectedWebContents()->GetRenderViewHost(), L"", L"testTabsAPI()", &result)); EXPECT_TRUE(result); @@ -108,7 +110,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, TabContents) { GURL("chrome-extension://behllobkkfkfnphdnhnkndlbkcpglgmj/page.html")); result = false; ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( - browser()->GetSelectedTabContents()->GetRenderViewHost(), L"", + browser()->GetSelectedWebContents()->GetRenderViewHost(), L"", L"testTabsAPI()", &result)); EXPECT_TRUE(result); } @@ -299,7 +301,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, TitleLocalizationBrowserAction) { extension->description().c_str()); EXPECT_STREQ(WideToUTF8(L"Hreggvi\u00F0ur is my name").c_str(), extension->name().c_str()); - int tab_id = ExtensionTabUtil::GetTabId(browser()->GetSelectedTabContents()); + int tab_id = ExtensionTabUtil::GetTabId(browser()->GetSelectedWebContents()); EXPECT_STREQ(WideToUTF8(L"Hreggvi\u00F0ur").c_str(), extension->browser_action()->GetTitle(tab_id).c_str()); } @@ -328,7 +330,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, TitleLocalizationPageAction) { extension->description().c_str()); EXPECT_STREQ(WideToUTF8(L"Hreggvi\u00F0ur is my name").c_str(), extension->name().c_str()); - int tab_id = ExtensionTabUtil::GetTabId(browser()->GetSelectedTabContents()); + int tab_id = ExtensionTabUtil::GetTabId(browser()->GetSelectedWebContents()); EXPECT_STREQ(WideToUTF8(L"Hreggvi\u00F0ur").c_str(), extension->page_action()->GetTitle(tab_id).c_str()); } @@ -375,7 +377,7 @@ static const wchar_t* jscript_error = L" \"No error\"" L");"; -bool ValidatePageElement(TabContents* tab, +bool ValidatePageElement(WebContents* tab, const std::wstring& frame, const std::wstring& javascript, const std::string& expected_value) { @@ -413,7 +415,7 @@ void NavigateToFeedAndValidate(net::TestServer* server, ui_test_utils::NavigateToURL(browser, GetFeedUrl(server, url, true, extension_id)); - TabContents* tab = browser->GetSelectedTabContents(); + WebContents* tab = browser->GetSelectedWebContents(); ASSERT_TRUE(ValidatePageElement(tab, L"", jscript_feed_title, @@ -685,20 +687,20 @@ IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, LastError) { // Helper function for common code shared by the 3 WindowOpen tests below. static void WindowOpenHelper(Browser* browser, const GURL& start_url, const std::string& newtab_url, - TabContents** newtab_result) { + WebContents** newtab_result) { ui_test_utils::NavigateToURL(browser, start_url); ui_test_utils::WindowedNotificationObserver observer( content::NOTIFICATION_LOAD_STOP, content::NotificationService::AllSources()); ASSERT_TRUE(ui_test_utils::ExecuteJavaScript( - browser->GetSelectedTabContents()->GetRenderViewHost(), L"", + browser->GetSelectedWebContents()->GetRenderViewHost(), L"", L"window.open('" + UTF8ToWide(newtab_url) + L"');")); // Now the active tab in last active window should be the new tab. Browser* last_active_browser = BrowserList::GetLastActive(); EXPECT_TRUE(last_active_browser); - TabContents* newtab = last_active_browser->GetSelectedTabContents(); + WebContents* newtab = last_active_browser->GetSelectedWebContents(); EXPECT_TRUE(newtab); GURL expected_url = start_url.Resolve(newtab_url); observer.Wait(); @@ -714,7 +716,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, WindowOpenExtension) { ASSERT_TRUE(LoadExtension( test_data_dir_.AppendASCII("uitest").AppendASCII("window_open"))); - TabContents* newtab; + WebContents* newtab; ASSERT_NO_FATAL_FAILURE(WindowOpenHelper( browser(), GURL(std::string("chrome-extension://") + last_loaded_extension_id_ + @@ -750,7 +752,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, WindowOpenNoPrivileges) { ASSERT_TRUE(LoadExtension( test_data_dir_.AppendASCII("uitest").AppendASCII("window_open"))); - TabContents* newtab; + WebContents* newtab; ASSERT_NO_FATAL_FAILURE(WindowOpenHelper( browser(), GURL("about:blank"), @@ -788,7 +790,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, MAYBE_PluginLoadUnload) { ui_test_utils::NavigateToURL(browser(), net::FilePathToFileURL(extension_dir.AppendASCII("test.html"))); - TabContents* tab = browser()->GetSelectedTabContents(); + WebContents* tab = browser()->GetSelectedWebContents(); // With no extensions, the plugin should not be loaded. bool result = false; @@ -871,7 +873,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, MAYBE_PluginPrivate) { // Load the test page through the extension URL, and the plugin should work. ui_test_utils::NavigateToURL(browser(), extension->GetResourceURL("test.html")); - TabContents* tab = browser()->GetSelectedTabContents(); + WebContents* tab = browser()->GetSelectedWebContents(); bool result = false; ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( tab->GetRenderViewHost(), L"", L"testPluginWorks()", &result)); @@ -917,7 +919,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, DISABLED_OptionsPage) { chrome::kExtensionsSubPage)); TabStripModel* tab_strip = browser()->tabstrip_model(); ASSERT_TRUE(ui_test_utils::ExecuteJavaScript( - browser()->GetSelectedTabContents()->GetRenderViewHost(), L"", + browser()->GetSelectedWebContents()->GetRenderViewHost(), L"", jscript_click_option_button)); // If the options page hasn't already come up, wait for it. diff --git a/chrome/browser/extensions/extension_context_menu_model.cc b/chrome/browser/extensions/extension_context_menu_model.cc index 0670504..79a9d8f 100644 --- a/chrome/browser/extensions/extension_context_menu_model.cc +++ b/chrome/browser/extensions/extension_context_menu_model.cc @@ -15,13 +15,14 @@ #include "chrome/common/extensions/extension_constants.h" #include "chrome/common/pref_names.h" #include "chrome/common/url_constants.h" -#include "content/browser/tab_contents/tab_contents.h" +#include "content/public/browser/web_contents.h" #include "grit/chromium_strings.h" #include "grit/generated_resources.h" #include "ui/base/l10n/l10n_util.h" using content::OpenURLParams; using content::Referrer; +using content::WebContents; enum MenuEntries { NAME = 0, @@ -93,7 +94,7 @@ bool ExtensionContextMenuModel::IsCommandIdEnabled(int command_id) const { // homepage, we just disable this menu item. return extension->GetHomepageURL().is_valid(); } else if (command_id == INSPECT_POPUP) { - TabContents* contents = browser_->GetSelectedTabContents(); + WebContents* contents = browser_->GetSelectedWebContents(); if (!contents) return false; diff --git a/chrome/browser/extensions/extension_crash_recovery_browsertest.cc b/chrome/browser/extensions/extension_crash_recovery_browsertest.cc index 0003cb5..c9b3b10 100644 --- a/chrome/browser/extensions/extension_crash_recovery_browsertest.cc +++ b/chrome/browser/extensions/extension_crash_recovery_browsertest.cc @@ -18,10 +18,12 @@ #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" #include "chrome/test/base/ui_test_utils.h" #include "content/browser/renderer_host/render_view_host.h" -#include "content/browser/tab_contents/tab_contents.h" #include "content/public/browser/render_process_host.h" +#include "content/public/browser/web_contents.h" #include "content/public/common/result_codes.h" +using content::WebContents; + class ExtensionCrashRecoveryTest : public ExtensionBrowserTest { protected: ExtensionService* GetExtensionService() { @@ -163,7 +165,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionCrashRecoveryTest, ReloadIndependently) { SCOPED_TRACE("after reloading"); CheckExtensionConsistency(first_extension_id_); - TabContents* current_tab = browser()->GetSelectedTabContents(); + WebContents* current_tab = browser()->GetSelectedWebContents(); ASSERT_TRUE(current_tab); // The balloon should automatically hide after the extension is successfully @@ -178,13 +180,13 @@ IN_PROC_BROWSER_TEST_F(ExtensionCrashRecoveryTest, CrashExtension(first_extension_id_); ASSERT_EQ(size_before, GetExtensionService()->extensions()->size()); - TabContents* original_tab = browser()->GetSelectedTabContents(); + WebContents* original_tab = browser()->GetSelectedWebContents(); ASSERT_TRUE(original_tab); ASSERT_EQ(1U, CountBalloons()); // Open a new tab, but the balloon will still be there. browser()->NewTab(); - TabContents* new_current_tab = browser()->GetSelectedTabContents(); + WebContents* new_current_tab = browser()->GetSelectedWebContents(); ASSERT_TRUE(new_current_tab); ASSERT_NE(new_current_tab, original_tab); ASSERT_EQ(1U, CountBalloons()); @@ -206,7 +208,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionCrashRecoveryTest, CrashExtension(first_extension_id_); ASSERT_EQ(size_before, GetExtensionService()->extensions()->size()); - TabContents* current_tab = browser()->GetSelectedTabContents(); + WebContents* current_tab = browser()->GetSelectedWebContents(); ASSERT_TRUE(current_tab); ASSERT_EQ(1U, CountBalloons()); @@ -379,7 +381,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionCrashRecoveryTest, { SCOPED_TRACE("first: reload"); - TabContents* current_tab = browser()->GetSelectedTabContents(); + WebContents* current_tab = browser()->GetSelectedWebContents(); ASSERT_TRUE(current_tab); // At the beginning we should have one balloon displayed for each extension. ASSERT_EQ(2U, CountBalloons()); @@ -472,7 +474,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionCrashRecoveryTest, ui_test_utils::WindowedNotificationObserver observer( content::NOTIFICATION_LOAD_STOP, content::Source<NavigationController>( - &browser()->GetSelectedTabContentsWrapper()->tab_contents()-> + &browser()->GetSelectedTabContentsWrapper()->web_contents()-> GetController())); browser()->Reload(CURRENT_TAB); observer.Wait(); diff --git a/chrome/browser/extensions/extension_dom_clipboard_apitest.cc b/chrome/browser/extensions/extension_dom_clipboard_apitest.cc index 5584592..155207d 100644 --- a/chrome/browser/extensions/extension_dom_clipboard_apitest.cc +++ b/chrome/browser/extensions/extension_dom_clipboard_apitest.cc @@ -6,7 +6,7 @@ #include "chrome/browser/extensions/extension_apitest.h" #include "chrome/browser/ui/browser.h" #include "chrome/test/base/ui_test_utils.h" -#include "content/browser/tab_contents/tab_contents.h" +#include "content/public/browser/web_contents.h" #include "googleurl/src/gurl.h" #include "net/base/mock_host_resolver.h" @@ -66,7 +66,7 @@ bool ClipboardApiTest::ExecutePasteInSelectedTab(bool* result) { bool ClipboardApiTest::ExecuteScriptInSelectedTab(const std::wstring& script, bool* result) { if (!ui_test_utils::ExecuteJavaScriptAndExtractBool( - browser()->GetSelectedTabContents()->GetRenderViewHost(), + browser()->GetSelectedWebContents()->GetRenderViewHost(), L"", script, result)) { diff --git a/chrome/browser/extensions/extension_file_browser_private_api.cc b/chrome/browser/extensions/extension_file_browser_private_api.cc index d10ff88..2c8b0b1 100644 --- a/chrome/browser/extensions/extension_file_browser_private_api.cc +++ b/chrome/browser/extensions/extension_file_browser_private_api.cc @@ -34,9 +34,10 @@ #include "chrome/common/pref_names.h" #include "content/browser/child_process_security_policy.h" #include "content/browser/renderer_host/render_view_host.h" -#include "content/browser/tab_contents/tab_contents.h" +#include "content/browser/site_instance.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/render_process_host.h" +#include "content/public/browser/web_contents.h" #include "googleurl/src/gurl.h" #include "grit/generated_resources.h" #include "grit/platform_locale_settings.h" @@ -948,7 +949,7 @@ void ExecuteTasksFileBrowserFunction::ExecuteFileActionsOnUIThread( // Get tab id. Browser* browser = GetCurrentBrowser(); if (browser) { - TabContents* contents = browser->GetSelectedTabContents(); + WebContents* contents = browser->GetSelectedWebContents(); if (contents) details->SetInteger("tab_id", ExtensionTabUtil::GetTabId(contents)); } diff --git a/chrome/browser/extensions/extension_icon_source_apitest.cc b/chrome/browser/extensions/extension_icon_source_apitest.cc index 610bc5b..8af5737 100644 --- a/chrome/browser/extensions/extension_icon_source_apitest.cc +++ b/chrome/browser/extensions/extension_icon_source_apitest.cc @@ -10,7 +10,7 @@ #include "chrome/browser/ui/browser_list.h" #include "chrome/common/chrome_switches.h" #include "chrome/test/base/ui_test_utils.h" -#include "content/browser/tab_contents/tab_contents.h" +#include "content/public/browser/web_contents.h" #include "googleurl/src/gurl.h" #include "net/base/mock_host_resolver.h" @@ -34,7 +34,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionIconSourceTest, IconsLoaded) { browser(), GURL("chrome-extension://gbmgkahjioeacddebbnengilkgbkhodg/index.html")); ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractString( - browser()->GetSelectedTabContents()->GetRenderViewHost(), L"", + browser()->GetSelectedWebContents()->GetRenderViewHost(), L"", L"window.domAutomationController.send(document.title)", &result)); EXPECT_EQ(result, "Loaded"); @@ -45,7 +45,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionIconSourceTest, IconsLoaded) { browser(), GURL("chrome-extension://apocjbpjpkghdepdngjlknfpmabcmlao/index.html")); ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractString( - browser()->GetSelectedTabContents()->GetRenderViewHost(), L"", + browser()->GetSelectedWebContents()->GetRenderViewHost(), L"", L"window.domAutomationController.send(document.title)", &result)); EXPECT_EQ(result, "Not Loaded"); @@ -67,7 +67,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionIconSourceTest, IconsLoadedIncognito) { Browser* otr_browser = BrowserList::FindTabbedBrowser( browser()->profile()->GetOffTheRecordProfile(), false); ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractString( - otr_browser->GetSelectedTabContents()->GetRenderViewHost(), L"", + otr_browser->GetSelectedWebContents()->GetRenderViewHost(), L"", L"window.domAutomationController.send(document.title)", &result)); EXPECT_EQ(result, "Loaded"); @@ -78,7 +78,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionIconSourceTest, IconsLoadedIncognito) { browser()->profile(), GURL("chrome-extension://apocjbpjpkghdepdngjlknfpmabcmlao/index.html")); ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractString( - otr_browser->GetSelectedTabContents()->GetRenderViewHost(), L"", + otr_browser->GetSelectedWebContents()->GetRenderViewHost(), L"", L"window.domAutomationController.send(document.title)", &result)); EXPECT_EQ(result, "Not Loaded"); diff --git a/chrome/browser/extensions/extension_incognito_apitest.cc b/chrome/browser/extensions/extension_incognito_apitest.cc index 507db06..cdeb029 100644 --- a/chrome/browser/extensions/extension_incognito_apitest.cc +++ b/chrome/browser/extensions/extension_incognito_apitest.cc @@ -13,9 +13,11 @@ #include "chrome/browser/ui/browser_window.h" #include "chrome/common/url_constants.h" #include "chrome/test/base/ui_test_utils.h" -#include "content/browser/tab_contents/tab_contents.h" +#include "content/public/browser/web_contents.h" #include "net/base/mock_host_resolver.h" +using content::WebContents; + IN_PROC_BROWSER_TEST_F(ExtensionApiTest, IncognitoNoScript) { ASSERT_TRUE(StartTestServer()); @@ -31,7 +33,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionApiTest, IncognitoNoScript) { Browser* otr_browser = BrowserList::FindTabbedBrowser( browser()->profile()->GetOffTheRecordProfile(), false); - TabContents* tab = otr_browser->GetSelectedTabContents(); + WebContents* tab = otr_browser->GetSelectedWebContents(); // Verify the script didn't run. bool result = false; @@ -68,7 +70,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionApiTest, IncognitoYesScript) { Browser* otr_browser = BrowserList::FindTabbedBrowser( browser()->profile()->GetOffTheRecordProfile(), false); - TabContents* tab = otr_browser->GetSelectedTabContents(); + WebContents* tab = otr_browser->GetSelectedWebContents(); // Verify the script ran. bool result = false; diff --git a/chrome/browser/extensions/extension_install_ui_browsertest.cc b/chrome/browser/extensions/extension_install_ui_browsertest.cc index 1ac2196..f1412d3 100644 --- a/chrome/browser/extensions/extension_install_ui_browsertest.cc +++ b/chrome/browser/extensions/extension_install_ui_browsertest.cc @@ -12,7 +12,9 @@ #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" #include "chrome/browser/themes/theme_service_factory.h" #include "chrome/test/base/ui_test_utils.h" -#include "content/browser/tab_contents/tab_contents.h" +#include "content/public/browser/web_contents.h" + +using content::WebContents; class ExtensionInstallUIBrowserTest : public ExtensionBrowserTest { public: @@ -108,9 +110,9 @@ IN_PROC_BROWSER_TEST_F(ExtensionInstallUIBrowserTest, browser()->profile())); EXPECT_EQ(num_tabs + 1, browser()->tab_count()); - TabContents* tab_contents = browser()->GetSelectedTabContents(); - ASSERT_TRUE(tab_contents); - EXPECT_TRUE(StartsWithASCII(tab_contents->GetURL().spec(), + WebContents* web_contents = browser()->GetSelectedWebContents(); + ASSERT_TRUE(web_contents); + EXPECT_TRUE(StartsWithASCII(web_contents->GetURL().spec(), "chrome://newtab/", false)); } @@ -129,8 +131,8 @@ IN_PROC_BROWSER_TEST_F(ExtensionInstallUIBrowserTest, EXPECT_EQ(num_incognito_tabs, incognito_browser->tab_count()); EXPECT_EQ(num_normal_tabs + 1, browser()->tab_count()); - TabContents* tab_contents = browser()->GetSelectedTabContents(); - ASSERT_TRUE(tab_contents); - EXPECT_TRUE(StartsWithASCII(tab_contents->GetURL().spec(), + WebContents* web_contents = browser()->GetSelectedWebContents(); + ASSERT_TRUE(web_contents); + EXPECT_TRUE(StartsWithASCII(web_contents->GetURL().spec(), "chrome://newtab/", false)); } diff --git a/chrome/browser/extensions/extension_nacl_browsertest.cc b/chrome/browser/extensions/extension_nacl_browsertest.cc index 7c76cec..8565d8d 100644 --- a/chrome/browser/extensions/extension_nacl_browsertest.cc +++ b/chrome/browser/extensions/extension_nacl_browsertest.cc @@ -16,11 +16,12 @@ #include "chrome/common/chrome_switches.h" #include "chrome/common/pref_names.h" #include "chrome/test/base/ui_test_utils.h" -#include "content/browser/tab_contents/tab_contents.h" #include "content/public/browser/plugin_service.h" +#include "content/public/browser/web_contents.h" #include "webkit/plugins/webplugininfo.h" using content::PluginService; +using content::WebContents; namespace { @@ -97,13 +98,13 @@ class NaClExtensionTest : public ExtensionBrowserTest { bool embedded_plugin_created = false; bool content_handler_plugin_created = false; - TabContents* tab_contents = browser()->GetSelectedTabContents(); + WebContents* web_contents = browser()->GetSelectedWebContents(); ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( - tab_contents->GetRenderViewHost(), L"", + web_contents->GetRenderViewHost(), L"", L"window.domAutomationController.send(EmbeddedPluginCreated());", &embedded_plugin_created)); ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( - tab_contents->GetRenderViewHost(), L"", + web_contents->GetRenderViewHost(), L"", L"window.domAutomationController.send(ContentHandlerPluginCreated());", &content_handler_plugin_created)); diff --git a/chrome/browser/extensions/extension_override_apitest.cc b/chrome/browser/extensions/extension_override_apitest.cc index a55d57f..00b6b0c 100644 --- a/chrome/browser/extensions/extension_override_apitest.cc +++ b/chrome/browser/extensions/extension_override_apitest.cc @@ -14,6 +14,9 @@ #include "chrome/test/base/ui_test_utils.h" #include "content/browser/tab_contents/tab_contents.h" #include "content/public/browser/navigation_entry.h" +#include "content/public/browser/web_contents.h" + +using content::WebContents; class ExtensionOverrideTest : public ExtensionApiTest { protected: @@ -47,7 +50,7 @@ class ExtensionOverrideTest : public ExtensionApiTest { // extension URL. void NavigateToKeyboard() { ui_test_utils::NavigateToURL(browser(), GURL("chrome://keyboard/")); - TabContents* tab = browser()->GetSelectedTabContents(); + WebContents* tab = browser()->GetSelectedWebContents(); ASSERT_TRUE(tab->GetController().GetActiveEntry()); EXPECT_TRUE(tab->GetController().GetActiveEntry()->url(). SchemeIs(chrome::kExtensionScheme)); @@ -62,7 +65,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionOverrideTest, OverrideNewtab) { // Navigate to the new tab page. The overridden new tab page // will call chrome.test.notifyPass() . ui_test_utils::NavigateToURL(browser(), GURL("chrome://newtab/")); - TabContents* tab = browser()->GetSelectedTabContents(); + WebContents* tab = browser()->GetSelectedWebContents(); ASSERT_TRUE(tab->GetController().GetActiveEntry()); EXPECT_TRUE(tab->GetController().GetActiveEntry()->GetURL(). SchemeIs(chrome::kExtensionScheme)); @@ -89,7 +92,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionOverrideTest, MAYBE_OverrideNewtabIncognito) { GURL("chrome://newtab/")); Browser* otr_browser = BrowserList::FindTabbedBrowser( browser()->profile()->GetOffTheRecordProfile(), false); - TabContents* tab = otr_browser->GetSelectedTabContents(); + WebContents* tab = otr_browser->GetSelectedWebContents(); ASSERT_TRUE(tab->GetController().GetActiveEntry()); EXPECT_FALSE(tab->GetController().GetActiveEntry()->GetURL(). SchemeIs(chrome::kExtensionScheme)); diff --git a/chrome/browser/extensions/extension_process_manager.cc b/chrome/browser/extensions/extension_process_manager.cc index 8e355c0..5d3ffb8 100644 --- a/chrome/browser/extensions/extension_process_manager.cc +++ b/chrome/browser/extensions/extension_process_manager.cc @@ -23,10 +23,11 @@ #include "chrome/common/extensions/extension.h" #include "chrome/common/url_constants.h" #include "content/browser/renderer_host/render_view_host.h" +#include "content/browser/renderer_host/render_view_host_delegate.h" #include "content/browser/site_instance.h" -#include "content/browser/tab_contents/tab_contents.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/notification_service.h" +#include "content/public/browser/web_contents.h" using content::BrowserThread; using content::OpenURLParams; @@ -219,7 +220,7 @@ void ExtensionProcessManager::OpenOptionsPage(const Extension* extension, content::PAGE_TRANSITION_LINK, false); browser->OpenURL(params); browser->window()->Show(); - static_cast<RenderViewHostDelegate*>(browser->GetSelectedTabContents())-> + browser->GetSelectedWebContents()->GetRenderViewHost()->delegate()-> Activate(); } diff --git a/chrome/browser/extensions/extension_resource_request_policy_apitest.cc b/chrome/browser/extensions/extension_resource_request_policy_apitest.cc index c4f623d..1a1d8db 100644 --- a/chrome/browser/extensions/extension_resource_request_policy_apitest.cc +++ b/chrome/browser/extensions/extension_resource_request_policy_apitest.cc @@ -7,7 +7,7 @@ #include "chrome/browser/ui/browser.h" #include "chrome/common/chrome_switches.h" #include "chrome/test/base/ui_test_utils.h" -#include "content/browser/tab_contents/tab_contents.h" +#include "content/public/browser/web_contents.h" #include "googleurl/src/gurl.h" #include "net/base/mock_host_resolver.h" @@ -47,7 +47,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionResourceRequestPolicyTest, OriginPrivileges) { browser(), web_resource.ReplaceComponents(make_host_a_com)); std::string result; ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractString( - browser()->GetSelectedTabContents()->GetRenderViewHost(), L"", + browser()->GetSelectedWebContents()->GetRenderViewHost(), L"", L"window.domAutomationController.send(document.title)", &result)); EXPECT_EQ(result, "Loaded"); @@ -59,7 +59,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionResourceRequestPolicyTest, OriginPrivileges) { "non_existent_extension.html")); ui_test_utils::NavigateToURL(browser(), non_existent_extension); ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractString( - browser()->GetSelectedTabContents()->GetRenderViewHost(), L"", + browser()->GetSelectedWebContents()->GetRenderViewHost(), L"", L"window.domAutomationController.send(document.title)", &result)); EXPECT_EQ(result, "Image failed to load"); @@ -73,7 +73,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(ui_test_utils::ExecuteJavaScriptAndExtractString( - browser()->GetSelectedTabContents()->GetRenderViewHost(), L"", + browser()->GetSelectedWebContents()->GetRenderViewHost(), L"", L"window.domAutomationController.send(document.title)", &result)); EXPECT_EQ(result, "Loaded"); @@ -87,7 +87,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionResourceRequestPolicyTest, OriginPrivileges) { browser(), GURL("chrome-extension://pbkkcbgdkliohhfaeefcijaghglkahja/index.html")); ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractString( - browser()->GetSelectedTabContents()->GetRenderViewHost(), L"", + browser()->GetSelectedWebContents()->GetRenderViewHost(), L"", L"window.domAutomationController.send(document.title)", &result)); EXPECT_EQ(result, "Loaded"); @@ -137,7 +137,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionResourceRequestPolicyTest, "web_accessible/accessible_resource.html")); ui_test_utils::NavigateToURL(browser(), accessible_resource); ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractString( - browser()->GetSelectedTabContents()->GetRenderViewHost(), L"", + browser()->GetSelectedWebContents()->GetRenderViewHost(), L"", L"window.domAutomationController.send(document.title)", &result)); EXPECT_EQ("Loaded", result); @@ -148,7 +148,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionResourceRequestPolicyTest, "web_accessible/nonaccessible_resource.html")); ui_test_utils::NavigateToURL(browser(), nonaccessible_resource); ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractString( - browser()->GetSelectedTabContents()->GetRenderViewHost(), L"", + browser()->GetSelectedWebContents()->GetRenderViewHost(), L"", L"window.domAutomationController.send(document.title)", &result)); EXPECT_EQ("Image failed to load", result); @@ -159,7 +159,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionResourceRequestPolicyTest, "web_accessible/nonexistent_resource.html")); ui_test_utils::NavigateToURL(browser(), nonexistent_resource); ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractString( - browser()->GetSelectedTabContents()->GetRenderViewHost(), L"", + browser()->GetSelectedWebContents()->GetRenderViewHost(), L"", L"window.domAutomationController.send(document.title)", &result)); EXPECT_EQ("Image failed to load", result); diff --git a/chrome/browser/extensions/extension_startup_browsertest.cc b/chrome/browser/extensions/extension_startup_browsertest.cc index 092066d..4a67911 100644 --- a/chrome/browser/extensions/extension_startup_browsertest.cc +++ b/chrome/browser/extensions/extension_startup_browsertest.cc @@ -18,9 +18,9 @@ #include "chrome/common/chrome_switches.h" #include "chrome/test/base/in_process_browser_test.h" #include "chrome/test/base/ui_test_utils.h" -#include "content/browser/tab_contents/tab_contents.h" #include "content/public/browser/notification_details.h" #include "content/public/browser/notification_service.h" +#include "content/public/browser/web_contents.h" #include "net/base/net_util.h" // This file contains high-level startup tests for the extensions system. We've @@ -115,7 +115,7 @@ class ExtensionStartupTestBase : public InProcessBrowserTest { bool result = false; ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( - browser()->GetSelectedTabContents()->GetRenderViewHost(), L"", + browser()->GetSelectedWebContents()->GetRenderViewHost(), L"", L"window.domAutomationController.send(" L"document.defaultView.getComputedStyle(document.body, null)." L"getPropertyValue('background-color') == 'rgb(245, 245, 220)')", @@ -124,7 +124,7 @@ class ExtensionStartupTestBase : public InProcessBrowserTest { result = false; ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( - browser()->GetSelectedTabContents()->GetRenderViewHost(), L"", + browser()->GetSelectedWebContents()->GetRenderViewHost(), L"", L"window.domAutomationController.send(document.title == 'Modified')", &result)); EXPECT_EQ(expect_script, result); diff --git a/chrome/browser/extensions/extension_tabs_module.cc b/chrome/browser/extensions/extension_tabs_module.cc index 0d88559..822f53a 100644 --- a/chrome/browser/extensions/extension_tabs_module.cc +++ b/chrome/browser/extensions/extension_tabs_module.cc @@ -46,11 +46,12 @@ #include "content/browser/renderer_host/backing_store.h" #include "content/browser/renderer_host/render_view_host.h" #include "content/browser/renderer_host/render_view_host_delegate.h" -#include "content/browser/tab_contents/tab_contents.h" +#include "content/browser/tab_contents/navigation_controller.h" #include "content/browser/tab_contents/tab_contents_view.h" #include "content/public/browser/navigation_entry.h" #include "content/public/browser/notification_details.h" #include "content/public/browser/notification_source.h" +#include "content/public/browser/web_contents.h" #include "skia/ext/image_operations.h" #include "skia/ext/platform_canvas.h" #include "third_party/skia/include/core/SkBitmap.h" @@ -723,7 +724,7 @@ bool GetSelectedTabFunction::RunImpl() { error_ = keys::kNoSelectedTabError; return false; } - result_.reset(ExtensionTabUtil::CreateTabValue(contents->tab_contents(), + result_.reset(ExtensionTabUtil::CreateTabValue(contents->web_contents(), tab_strip, tab_strip->active_index())); return true; @@ -808,8 +809,8 @@ bool QueryTabsFunction::RunImpl() { TabStripModel* tab_strip = (*browser)->tabstrip_model(); for (int i = 0; i < tab_strip->count(); ++i) { - const TabContents* tab_contents = - tab_strip->GetTabContentsAt(i)->tab_contents(); + const WebContents* web_contents = + tab_strip->GetTabContentsAt(i)->web_contents(); if (!MatchesQueryArg(selected, tab_strip->IsTabSelected(i))) continue; @@ -820,18 +821,18 @@ bool QueryTabsFunction::RunImpl() { if (!MatchesQueryArg(pinned, tab_strip->IsTabPinned(i))) continue; - if (!title.empty() && !MatchPattern(tab_contents->GetTitle(), + if (!title.empty() && !MatchPattern(web_contents->GetTitle(), UTF8ToUTF16(title))) continue; - if (!url_pattern.MatchesURL(tab_contents->GetURL())) + if (!url_pattern.MatchesURL(web_contents->GetURL())) continue; - if (!MatchesQueryArg(loading, tab_contents->IsLoading())) + if (!MatchesQueryArg(loading, web_contents->IsLoading())) continue; result->Append(ExtensionTabUtil::CreateTabValue( - tab_contents, tab_strip, i)); + web_contents, tab_strip, i)); } } @@ -936,12 +937,12 @@ bool CreateTabFunction::RunImpl() { browser::Navigate(¶ms); if (active) - params.target_contents->tab_contents()->GetView()->SetInitialFocus(); + params.target_contents->web_contents()->GetView()->SetInitialFocus(); // Return data about the newly created tab. if (has_callback()) { result_.reset(ExtensionTabUtil::CreateTabValue( - params.target_contents->tab_contents(), + params.target_contents->web_contents(), params.browser->tabstrip_model(), params.browser->tabstrip_model()->GetIndexOfTabContents( params.target_contents))); @@ -961,7 +962,7 @@ bool GetTabFunction::RunImpl() { NULL, &tab_strip, &contents, &tab_index, &error_)) return false; - result_.reset(ExtensionTabUtil::CreateTabValue(contents->tab_contents(), + result_.reset(ExtensionTabUtil::CreateTabValue(contents->web_contents(), tab_strip, tab_index)); return true; @@ -1060,7 +1061,7 @@ bool UpdateTabFunction::RunImpl() { error_ = keys::kNoSelectedTabError; return false; } - tab_id = ExtensionTabUtil::GetTabId(contents->tab_contents()); + tab_id = ExtensionTabUtil::GetTabId(contents->web_contents()); } else { EXTENSION_FUNCTION_VALIDATE(tab_value->GetAsInteger(&tab_id)); } @@ -1071,7 +1072,7 @@ bool UpdateTabFunction::RunImpl() { NULL, &tab_strip, &contents, &tab_index, &error_)) { return false; } - NavigationController& controller = contents->tab_contents()->GetController(); + NavigationController& controller = contents->web_contents()->GetController(); // TODO(rafaelw): handle setting remaining tab properties: // -title @@ -1100,7 +1101,7 @@ bool UpdateTabFunction::RunImpl() { // we need to check host permissions before allowing them. if (url.SchemeIs(chrome::kJavaScriptScheme)) { if (!GetExtension()->CanExecuteScriptOnPage( - contents->tab_contents()->GetURL(), NULL, &error_)) { + contents->web_contents()->GetURL(), NULL, &error_)) { return false; } @@ -1113,12 +1114,12 @@ bool UpdateTabFunction::RunImpl() { params.in_main_world = true; RenderViewHost* render_view_host = - contents->tab_contents()->GetRenderViewHost(); + contents->web_contents()->GetRenderViewHost(); render_view_host->Send( new ExtensionMsg_ExecuteCode(render_view_host->routing_id(), params)); - Observe(contents->tab_contents()); + Observe(contents->web_contents()); AddRef(); // balanced in Observe() return true; @@ -1130,7 +1131,7 @@ bool UpdateTabFunction::RunImpl() { // The URL of a tab contents never actually changes to a JavaScript URL, so // this check only makes sense in other cases. if (!url.SchemeIs(chrome::kJavaScriptScheme)) - DCHECK_EQ(url.spec(), contents->tab_contents()->GetURL().spec()); + DCHECK_EQ(url.spec(), contents->web_contents()->GetURL().spec()); } bool active = false; @@ -1150,7 +1151,7 @@ bool UpdateTabFunction::RunImpl() { tab_strip->ActivateTabAt(tab_index, false); DCHECK_EQ(contents, tab_strip->GetActiveTabContents()); } - contents->tab_contents()->Focus(); + contents->web_contents()->Focus(); } bool highlighted = false; @@ -1173,7 +1174,7 @@ bool UpdateTabFunction::RunImpl() { if (has_callback()) { if (GetExtension()->HasAPIPermission(ExtensionAPIPermission::kTab)) { - result_.reset(ExtensionTabUtil::CreateTabValue(contents->tab_contents(), + result_.reset(ExtensionTabUtil::CreateTabValue(contents->web_contents(), tab_strip, tab_index)); } else { @@ -1301,7 +1302,7 @@ bool MoveTabsFunction::RunImpl() { if (has_callback()) tab_values.Append(ExtensionTabUtil::CreateTabValue( - contents->tab_contents(), target_tab_strip, new_index)); + contents->web_contents(), target_tab_strip, new_index)); continue; } @@ -1318,7 +1319,7 @@ bool MoveTabsFunction::RunImpl() { if (has_callback()) tab_values.Append(ExtensionTabUtil::CreateTabValue( - contents->tab_contents(), source_tab_strip, new_index)); + contents->web_contents(), source_tab_strip, new_index)); } if (!has_callback()) @@ -1375,17 +1376,17 @@ bool ReloadTabFunction::RunImpl() { return false; } - TabContents* tab_contents = contents->tab_contents(); - if (tab_contents->ShowingInterstitialPage()) { + WebContents* web_contents = contents->web_contents(); + if (web_contents->ShowingInterstitialPage()) { // This does as same as Browser::ReloadInternal. - NavigationEntry* entry = tab_contents->GetController().GetActiveEntry(); + NavigationEntry* entry = web_contents->GetController().GetActiveEntry(); OpenURLParams params(entry->GetURL(), Referrer(), CURRENT_TAB, content::PAGE_TRANSITION_RELOAD, false); GetCurrentBrowser()->OpenURL(params); } else if (bypass_cache) { - tab_contents->GetController().ReloadIgnoringCache(true); + web_contents->GetController().ReloadIgnoringCache(true); } else { - tab_contents->GetController().Reload(true); + web_contents->GetController().Reload(true); } return true; @@ -1416,7 +1417,7 @@ bool RemoveTabsFunction::RunImpl() { // path should ensure that the tab is safely closed under such // circumstances, whereas |Browser::CloseTabContents()| does not. RenderViewHost* render_view_host = - contents->tab_contents()->GetRenderViewHost(); + contents->web_contents()->GetRenderViewHost(); render_view_host->delegate()->Close(render_view_host); } return true; @@ -1468,8 +1469,8 @@ bool CaptureVisibleTabFunction::RunImpl() { } } - TabContents* tab_contents = browser->GetSelectedTabContents(); - if (!tab_contents) { + WebContents* web_contents = browser->GetSelectedWebContents(); + if (!web_contents) { error_ = keys::kInternalVisibleTabCaptureError; return false; } @@ -1477,10 +1478,10 @@ bool CaptureVisibleTabFunction::RunImpl() { // captureVisibleTab() can return an image containing sensitive information // that the browser would otherwise protect. Ensure the extension has // permission to do this. - if (!GetExtension()->CanCaptureVisiblePage(tab_contents->GetURL(), &error_)) + if (!GetExtension()->CanCaptureVisiblePage(web_contents->GetURL(), &error_)) return false; - RenderViewHost* render_view_host = tab_contents->GetRenderViewHost(); + RenderViewHost* render_view_host = web_contents->GetRenderViewHost(); // If a backing store is cached for the tab we want to capture, // and it can be copied into a bitmap, then use it to generate the image. @@ -1614,7 +1615,7 @@ bool DetectTabLanguageFunction::RunImpl() { return false; } - if (contents->tab_contents()->GetController().NeedsReload()) { + if (contents->web_contents()->GetController().NeedsReload()) { // If the tab hasn't been loaded, don't wait for the tab to load. error_ = keys::kCannotDetermineLanguageOfUnloadedTab; return false; @@ -1634,15 +1635,15 @@ bool DetectTabLanguageFunction::RunImpl() { // The tab contents does not know its language yet. Let's wait until it // receives it, or until the tab is closed/navigates to some other page. registrar_.Add(this, chrome::NOTIFICATION_TAB_LANGUAGE_DETERMINED, - content::Source<WebContents>(contents->tab_contents())); + content::Source<WebContents>(contents->web_contents())); registrar_.Add( this, content::NOTIFICATION_TAB_CLOSING, content::Source<NavigationController>( - &(contents->tab_contents()->GetController()))); + &(contents->web_contents()->GetController()))); registrar_.Add( this, content::NOTIFICATION_NAV_ENTRY_COMMITTED, content::Source<NavigationController>( - &(contents->tab_contents()->GetController()))); + &(contents->web_contents()->GetController()))); return true; } diff --git a/chrome/browser/extensions/extension_url_rewrite_browsertest.cc b/chrome/browser/extensions/extension_url_rewrite_browsertest.cc index d23e57c..333fa3a 100644 --- a/chrome/browser/extensions/extension_url_rewrite_browsertest.cc +++ b/chrome/browser/extensions/extension_url_rewrite_browsertest.cc @@ -15,8 +15,8 @@ #include "chrome/test/base/testing_profile.h" #include "chrome/test/base/ui_test_utils.h" #include "content/browser/tab_contents/navigation_controller.h" -#include "content/browser/tab_contents/tab_contents.h" #include "content/public/browser/navigation_entry.h" +#include "content/public/browser/web_contents.h" #include "googleurl/src/gurl.h" using content::NavigationEntry; @@ -33,7 +33,7 @@ class ExtensionURLRewriteBrowserTest : public ExtensionBrowserTest { } NavigationController* GetNavigationController() const { - return &browser()->GetSelectedTabContents()->GetController(); + return &browser()->GetSelectedWebContents()->GetController(); } NavigationEntry* GetNavigationEntry() const { diff --git a/chrome/browser/extensions/extension_webnavigation_apitest.cc b/chrome/browser/extensions/extension_webnavigation_apitest.cc index 39528da..6e083d4b 100644 --- a/chrome/browser/extensions/extension_webnavigation_apitest.cc +++ b/chrome/browser/extensions/extension_webnavigation_apitest.cc @@ -19,6 +19,8 @@ #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" #include "webkit/glue/context_menu.h" +using content::WebContents; + namespace { class TestRenderViewContextMenu : public RenderViewContextMenu { @@ -195,7 +197,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionApiTest, WebNavigationRequestOpenTab) { ASSERT_TRUE(RunExtensionSubtest("webnavigation", "test_requestOpenTab.html")) << message_; - TabContents* tab = browser()->GetSelectedTabContents(); + WebContents* tab = browser()->GetSelectedWebContents(); ui_test_utils::WaitForLoadStop(tab); ResultCatcher catcher; diff --git a/chrome/browser/extensions/extension_webrequest_apitest.cc b/chrome/browser/extensions/extension_webrequest_apitest.cc index 5246ce6..814347e0 100644 --- a/chrome/browser/extensions/extension_webrequest_apitest.cc +++ b/chrome/browser/extensions/extension_webrequest_apitest.cc @@ -13,12 +13,14 @@ #include "chrome/common/chrome_switches.h" #include "chrome/test/base/ui_test_utils.h" #include "content/browser/renderer_host/render_view_host.h" -#include "content/browser/tab_contents/tab_contents.h" #include "content/public/browser/notification_registrar.h" #include "content/public/browser/notification_service.h" +#include "content/public/browser/web_contents.h" #include "net/base/mock_host_resolver.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" +using content::WebContents; + namespace { class CancelLoginDialog : public content::NotificationObserver { @@ -88,7 +90,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionWebRequestApiTest, WebRequestNewTab) { ASSERT_TRUE(RunExtensionSubtest("webrequest", "test_newTab.html")) << message_; - TabContents* tab = browser()->GetSelectedTabContents(); + WebContents* tab = browser()->GetSelectedWebContents(); ui_test_utils::WaitForLoadStop(tab); ResultCatcher catcher; diff --git a/chrome/browser/extensions/lazy_background_page_apitest.cc b/chrome/browser/extensions/lazy_background_page_apitest.cc index e9c044c..df48df0 100644 --- a/chrome/browser/extensions/lazy_background_page_apitest.cc +++ b/chrome/browser/extensions/lazy_background_page_apitest.cc @@ -14,9 +14,8 @@ #include "chrome/common/chrome_switches.h" #include "chrome/common/extensions/extension.h" #include "chrome/test/base/ui_test_utils.h" -#include "content/browser/tab_contents/tab_contents.h" #include "content/public/browser/notification_service.h" - +#include "content/public/browser/web_contents.h" #include "googleurl/src/gurl.h" class LazyBackgroundPageApiTest : public ExtensionApiTest { @@ -57,7 +56,7 @@ IN_PROC_BROWSER_TEST_F(LazyBackgroundPageApiTest, BrowserActionCreateTab) { EXPECT_FALSE(pm->GetBackgroundHostForExtension(last_loaded_extension_id_)); EXPECT_EQ(num_tabs_before + 1, browser()->tab_count()); EXPECT_EQ("chrome://extensions/", - browser()->GetSelectedTabContents()->GetURL().spec()); + browser()->GetSelectedWebContents()->GetURL().spec()); } IN_PROC_BROWSER_TEST_F(LazyBackgroundPageApiTest, diff --git a/chrome/browser/extensions/page_action_apitest.cc b/chrome/browser/extensions/page_action_apitest.cc index 3cb8f09..46da8ff 100644 --- a/chrome/browser/extensions/page_action_apitest.cc +++ b/chrome/browser/extensions/page_action_apitest.cc @@ -15,7 +15,7 @@ #include "chrome/common/extensions/extension.h" #include "chrome/common/extensions/extension_action.h" #include "chrome/test/base/ui_test_utils.h" -#include "content/browser/tab_contents/tab_contents.h" +#include "content/public/browser/web_contents.h" IN_PROC_BROWSER_TEST_F(ExtensionApiTest, PageAction) { ASSERT_TRUE(test_server()->Start()); @@ -41,7 +41,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionApiTest, PageAction) { // Simulate the page action being clicked. ResultCatcher catcher; int tab_id = - ExtensionTabUtil::GetTabId(browser()->GetSelectedTabContents()); + ExtensionTabUtil::GetTabId(browser()->GetSelectedWebContents()); ExtensionService* service = browser()->profile()->GetExtensionService(); service->browser_event_router()->PageActionExecuted( browser()->profile(), extension->id(), "", tab_id, "", 0); @@ -69,7 +69,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionApiTest, PageActionAddPopup) { const Extension* extension = GetSingleLoadedExtension(); ASSERT_TRUE(extension) << message_; - int tab_id = ExtensionTabUtil::GetTabId(browser()->GetSelectedTabContents()); + int tab_id = ExtensionTabUtil::GetTabId(browser()->GetSelectedWebContents()); ExtensionAction* page_action = extension->page_action(); ASSERT_TRUE(page_action) @@ -115,7 +115,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionApiTest, PageActionRemovePopup) { const Extension* extension = GetSingleLoadedExtension(); ASSERT_TRUE(extension) << message_; - int tab_id = ExtensionTabUtil::GetTabId(browser()->GetSelectedTabContents()); + int tab_id = ExtensionTabUtil::GetTabId(browser()->GetSelectedWebContents()); ExtensionAction* page_action = extension->page_action(); ASSERT_TRUE(page_action) @@ -156,7 +156,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionApiTest, OldPageActions) { { ResultCatcher catcher; int tab_id = - ExtensionTabUtil::GetTabId(browser()->GetSelectedTabContents()); + ExtensionTabUtil::GetTabId(browser()->GetSelectedWebContents()); ExtensionService* service = browser()->profile()->GetExtensionService(); service->browser_event_router()->PageActionExecuted( browser()->profile(), extension->id(), "action", tab_id, "", 1); diff --git a/chrome/browser/extensions/webstore_inline_install_browsertest.cc b/chrome/browser/extensions/webstore_inline_install_browsertest.cc index 3b51825..664751d 100644 --- a/chrome/browser/extensions/webstore_inline_install_browsertest.cc +++ b/chrome/browser/extensions/webstore_inline_install_browsertest.cc @@ -16,12 +16,14 @@ #include "chrome/common/chrome_switches.h" #include "chrome/test/base/in_process_browser_test.h" #include "chrome/test/base/ui_test_utils.h" -#include "content/browser/tab_contents/tab_contents.h" #include "content/public/browser/notification_types.h" +#include "content/public/browser/web_contents.h" #include "googleurl/src/gurl.h" #include "net/base/host_port_pair.h" #include "net/base/mock_host_resolver.h" +using content::WebContents; + const char kWebstoreDomain[] = "cws.com"; const char kAppDomain[] = "app.com"; const char kNonAppDomain[] = "nonapp.com"; @@ -71,7 +73,7 @@ class WebstoreInlineInstallTest : public InProcessBrowserTest { std::string script = StringPrintf("%s('%s')", test_function_name.c_str(), test_gallery_url_.c_str()); ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( - browser()->GetSelectedTabContents()->GetRenderViewHost(), L"", + browser()->GetSelectedWebContents()->GetRenderViewHost(), L"", UTF8ToWide(script), &result)); EXPECT_TRUE(result); } @@ -131,8 +133,8 @@ IN_PROC_BROWSER_TEST_F(WebstoreInlineInstallTest, InstallNotSupported) { if (browser()->tabstrip_model()->count() == 1) { ui_test_utils::WaitForNewTab(browser()); } - TabContents* tab_contents = browser()->GetSelectedTabContents(); - EXPECT_EQ(GURL("http://cws.com/show-me-the-money"), tab_contents->GetURL()); + WebContents* web_contents = browser()->GetSelectedWebContents(); + EXPECT_EQ(GURL("http://cws.com/show-me-the-money"), web_contents->GetURL()); } // The unpack failure test needs to use a different install .crx, which is diff --git a/chrome/browser/external_tab_container_win.cc b/chrome/browser/external_tab_container_win.cc index 9ad3040..019919d 100644 --- a/chrome/browser/external_tab_container_win.cc +++ b/chrome/browser/external_tab_container_win.cc @@ -1177,7 +1177,7 @@ void ExternalTabContainer::SetupExternalTabView() { layout->AddView(tab_contents_container_); GetWidget()->SetContentsView(external_tab_view_); // Note that SetTabContents must be called after AddChildView is called - tab_contents_container_->ChangeTabContents(tab_contents()); + tab_contents_container_->ChangeWebContents(web_contents()); } TemporaryPopupExternalTabContainer::TemporaryPopupExternalTabContainer( diff --git a/chrome/browser/geolocation/geolocation_browsertest.cc b/chrome/browser/geolocation/geolocation_browsertest.cc index 3a41d99..1202c92 100644 --- a/chrome/browser/geolocation/geolocation_browsertest.cc +++ b/chrome/browser/geolocation/geolocation_browsertest.cc @@ -28,12 +28,14 @@ #include "content/browser/geolocation/location_arbitrator.h" #include "content/browser/geolocation/mock_location_provider.h" #include "content/browser/renderer_host/render_view_host.h" -#include "content/browser/tab_contents/tab_contents.h" #include "content/public/browser/notification_service.h" #include "content/public/browser/notification_details.h" +#include "content/public/browser/web_contents.h" #include "net/base/net_util.h" #include "net/test/test_server.h" +using content::WebContents; + namespace { // Used to block until an iframe is loaded via a javascript call. @@ -46,7 +48,7 @@ class IFrameLoader : public content::NotificationObserver { : navigation_completed_(false), javascript_completed_(false) { NavigationController* controller = - &browser->GetSelectedTabContents()->GetController(); + &browser->GetSelectedWebContents()->GetController(); registrar_.Add(this, content::NOTIFICATION_LOAD_STOP, content::Source<NavigationController>(controller)); registrar_.Add(this, chrome::NOTIFICATION_DOM_OPERATION_RESPONSE, @@ -56,7 +58,7 @@ class IFrameLoader : public content::NotificationObserver { "window.domAutomationController.send(addIFrame(%d, \"%s\"));", iframe_id, url.spec().c_str()); - browser->GetSelectedTabContents()->GetRenderViewHost()-> + browser->GetSelectedWebContents()->GetRenderViewHost()-> ExecuteJavascriptInWebFrame(string16(), UTF8ToUTF16(script)); ui_test_utils::RunMessageLoop(); @@ -67,7 +69,7 @@ class IFrameLoader : public content::NotificationObserver { "window.domAutomationController.send(getIFrameSrc(%d))", iframe_id); std::string iframe_src; EXPECT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractString( - browser->GetSelectedTabContents()->GetRenderViewHost(), + browser->GetSelectedWebContents()->GetRenderViewHost(), L"", UTF8ToWide(script), &iframe_src)); iframe_url_ = GURL(iframe_src); } @@ -280,7 +282,7 @@ class GeolocationBrowserTest : public InProcessBrowserTest { void AddGeolocationWatch(bool wait_for_infobar) { GeolocationNotificationObserver notification_observer(wait_for_infobar); notification_observer.AddWatchAndWaitForNotification( - current_browser_->GetSelectedTabContents()->GetRenderViewHost(), + current_browser_->GetSelectedWebContents()->GetRenderViewHost(), iframe_xpath_); if (wait_for_infobar) { EXPECT_TRUE(notification_observer.infobar_); @@ -324,7 +326,7 @@ class GeolocationBrowserTest : public InProcessBrowserTest { ui_test_utils::WindowedNotificationObserver observer( content::NOTIFICATION_LOAD_STOP, content::Source<NavigationController>( - &tab_contents_wrapper->tab_contents()->GetController())); + &tab_contents_wrapper->web_contents()->GetController())); if (allowed) infobar_->AsConfirmInfoBarDelegate()->Accept(); else @@ -346,12 +348,12 @@ class GeolocationBrowserTest : public InProcessBrowserTest { void CheckStringValueFromJavascriptForTab( const std::string& expected, const std::string& function, - TabContents* tab_contents) { + WebContents* web_contents) { std::string script = base::StringPrintf( "window.domAutomationController.send(%s)", function.c_str()); std::string result; ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractString( - tab_contents->GetRenderViewHost(), + web_contents->GetRenderViewHost(), iframe_xpath_, UTF8ToWide(script), &result)); EXPECT_EQ(expected, result); } @@ -359,7 +361,7 @@ class GeolocationBrowserTest : public InProcessBrowserTest { void CheckStringValueFromJavascript( const std::string& expected, const std::string& function) { CheckStringValueFromJavascriptForTab( - expected, function, current_browser_->GetSelectedTabContents()); + expected, function, current_browser_->GetSelectedWebContents()); } InfoBarDelegate* infobar_; @@ -507,7 +509,7 @@ IN_PROC_BROWSER_TEST_F(GeolocationBrowserTest, ui_test_utils::WindowedNotificationObserver observer( content::NOTIFICATION_LOAD_STOP, content::Source<NavigationController>( - ¤t_browser_->GetSelectedTabContents()->GetController())); + ¤t_browser_->GetSelectedWebContents()->GetController())); NotifyGeoposition(fresh_position); observer.Wait(); CheckGeoposition(fresh_position); @@ -544,7 +546,7 @@ IN_PROC_BROWSER_TEST_F(GeolocationBrowserTest, ui_test_utils::WindowedNotificationObserver observer( content::NOTIFICATION_LOAD_STOP, content::Source<NavigationController>( - ¤t_browser_->GetSelectedTabContents()->GetController())); + ¤t_browser_->GetSelectedWebContents()->GetController())); NotifyGeoposition(cached_position); observer.Wait(); CheckGeoposition(cached_position); @@ -598,7 +600,7 @@ IN_PROC_BROWSER_TEST_F(GeolocationBrowserTest, DISABLED_InvalidUrlRequest) { // correctly. Also acts as a regression test for http://crbug.com/40478 html_for_tests_ = "files/geolocation/invalid_request_url.html"; ASSERT_TRUE(Initialize(INITIALIZATION_NONE)); - TabContents* original_tab = current_browser_->GetSelectedTabContents(); + WebContents* original_tab = current_browser_->GetSelectedWebContents(); CheckStringValueFromJavascript("1", "requestGeolocationFromInvalidUrl()"); CheckStringValueFromJavascriptForTab("1", "isAlive()", original_tab); } @@ -638,7 +640,7 @@ IN_PROC_BROWSER_TEST_F(GeolocationBrowserTest, TwoWatchesInOneFrame) { final_position.latitude, final_position.longitude); std::string js_result; EXPECT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractString( - current_browser_->GetSelectedTabContents()->GetRenderViewHost(), + current_browser_->GetSelectedWebContents()->GetRenderViewHost(), L"", UTF8ToWide(script), &js_result)); EXPECT_EQ(js_result, "ok"); @@ -652,7 +654,7 @@ IN_PROC_BROWSER_TEST_F(GeolocationBrowserTest, TwoWatchesInOneFrame) { ui_test_utils::WindowedNotificationObserver observer( content::NOTIFICATION_LOAD_STOP, content::Source<NavigationController>( - ¤t_browser_->GetSelectedTabContents()->GetController())); + ¤t_browser_->GetSelectedWebContents()->GetController())); NotifyGeoposition(final_position); observer.Wait(); CheckGeoposition(final_position); @@ -678,7 +680,7 @@ IN_PROC_BROWSER_TEST_F(GeolocationBrowserTest, DISABLED_TabDestroyed) { "window.domAutomationController.send(window.close());"; bool result = ui_test_utils::ExecuteJavaScript( - current_browser_->GetSelectedTabContents()->GetRenderViewHost(), + current_browser_->GetSelectedWebContents()->GetRenderViewHost(), L"", UTF8ToWide(script)); EXPECT_EQ(result, true); } diff --git a/chrome/browser/gpu_pixel_browsertest.cc b/chrome/browser/gpu_pixel_browsertest.cc index 228d137..6b39fd0 100644 --- a/chrome/browser/gpu_pixel_browsertest.cc +++ b/chrome/browser/gpu_pixel_browsertest.cc @@ -17,7 +17,7 @@ #include "chrome/test/base/test_launcher_utils.h" #include "chrome/test/base/ui_test_utils.h" #include "content/browser/renderer_host/render_view_host.h" -#include "content/browser/tab_contents/tab_contents.h" +#include "content/public/browser/web_contents.h" #include "googleurl/src/gurl.h" #include "net/base/net_util.h" #include "testing/gtest/include/gtest/gtest.h" @@ -70,7 +70,7 @@ bool WritePNGFile(const SkBitmap& bitmap, const FilePath& file_path) { // Resizes the browser window so that the tab's contents are at a given size. void ResizeTabContainer(Browser* browser, const gfx::Size& desired_size) { gfx::Rect container_rect; - browser->GetSelectedTabContents()->GetContainerBounds(&container_rect); + browser->GetSelectedWebContents()->GetContainerBounds(&container_rect); // Size cannot be negative, so use a point. gfx::Point correction(desired_size.width() - container_rect.size().width(), desired_size.height() - container_rect.size().height()); @@ -325,7 +325,7 @@ IN_PROC_BROWSER_TEST_F(GpuPixelBrowserTest, MAYBE_WebGLTeapot) { gfx::Rect root_bounds = browser()->window()->GetBounds(); gfx::Rect tab_contents_bounds; - browser()->GetSelectedTabContents()->GetContainerBounds(&tab_contents_bounds); + browser()->GetSelectedWebContents()->GetContainerBounds(&tab_contents_bounds); gfx::Rect snapshot_bounds(tab_contents_bounds.x() - root_bounds.x(), tab_contents_bounds.y() - root_bounds.y(), diff --git a/chrome/browser/instant/instant_browsertest.cc b/chrome/browser/instant/instant_browsertest.cc index 2a10222..7d52259 100644 --- a/chrome/browser/instant/instant_browsertest.cc +++ b/chrome/browser/instant/instant_browsertest.cc @@ -30,11 +30,14 @@ #include "chrome/test/base/ui_test_utils.h" #include "content/browser/renderer_host/render_view_host.h" #include "content/browser/renderer_host/render_widget_host_view.h" -#include "content/browser/tab_contents/tab_contents.h" +#include "content/browser/tab_contents/navigation_controller.h" #include "content/public/browser/notification_service.h" +#include "content/public/browser/web_contents.h" #include "grit/generated_resources.h" #include "ui/base/l10n/l10n_util.h" +using content::WebContents; + // Tests are flaky on Linux because of http://crbug.com/80118. #if defined(OS_LINUX) #define MAYBE(TestName) DISABLED_ ## TestName @@ -106,7 +109,7 @@ class InstantTest : public InProcessBrowserTest { // the browser. Returns true on success. bool WaitForMessageToBeProcessedByRenderer() { bool result = false; - return GetBoolFromJavascript(preview()->tab_contents(), "true", &result) && + return GetBoolFromJavascript(preview()->web_contents(), "true", &result) && result; } @@ -138,7 +141,7 @@ class InstantTest : public InProcessBrowserTest { bool SetSuggestionsJavascriptArgument(const std::string& argument) { std::wstring script = UTF8ToWide(base::StringPrintf( "window.setSuggestionsArgument = %s;", argument.c_str())); - RenderViewHost* rvh = preview()->tab_contents()->GetRenderViewHost(); + RenderViewHost* rvh = preview()->web_contents()->GetRenderViewHost(); return ui_test_utils::ExecuteJavaScript(rvh, std::wstring(), script); } @@ -147,28 +150,28 @@ class InstantTest : public InProcessBrowserTest { "window.domAutomationController.send(%s)", script.c_str())); } - bool GetStringFromJavascript(TabContents* tab, + bool GetStringFromJavascript(WebContents* tab, const std::string& script, std::string* result) { return ui_test_utils::ExecuteJavaScriptAndExtractString( tab->GetRenderViewHost(), std::wstring(), WrapScript(script), result); } - bool GetIntFromJavascript(TabContents* tab, + bool GetIntFromJavascript(WebContents* tab, const std::string& script, int* result) { return ui_test_utils::ExecuteJavaScriptAndExtractInt( tab->GetRenderViewHost(), std::wstring(), WrapScript(script), result); } - bool GetBoolFromJavascript(TabContents* tab, + bool GetBoolFromJavascript(WebContents* tab, const std::string& script, bool* result) { return ui_test_utils::ExecuteJavaScriptAndExtractBool( tab->GetRenderViewHost(), std::wstring(), WrapScript(script), result); } - bool CheckVisibilityIs(TabContents* tab, bool visible) { + bool CheckVisibilityIs(WebContents* tab, bool visible) { bool hidden = visible; return GetBoolFromJavascript(tab, "document.webkitHidden", &hidden) && hidden != visible; @@ -191,7 +194,7 @@ class InstantTest : public InProcessBrowserTest { // // If |use_last| is true, then the last searchBox values are used instead of // the current. Set |use_last| to true when testing OnSubmit/OnCancel. - std::string GetSearchStateAsString(TabContents* tab, bool use_last) { + std::string GetSearchStateAsString(WebContents* tab, bool use_last) { bool sv = false; int onsubmitcalls = 0; int oncancelcalls = 0; @@ -285,7 +288,7 @@ IN_PROC_BROWSER_TEST_F(InstantTest, MAYBE(OnChangeEvent)) { // Check that the value is reflected and onchange is called. EXPECT_EQ("true 0 0 1 true d false def false 3 3", - GetSearchStateAsString(preview()->tab_contents(), false)); + GetSearchStateAsString(preview()->web_contents(), false)); } // Verify that the onsubmit event is dispatched upon pressing <Enter>. @@ -301,7 +304,7 @@ IN_PROC_BROWSER_TEST_F(InstantTest, MAYBE(OnSubmitEvent)) { EXPECT_TRUE(instant()->IsCurrent()); EXPECT_EQ("defghi", UTF16ToUTF8(omnibox()->GetText())); - TabContents* preview_tab = preview()->tab_contents(); + WebContents* preview_tab = preview()->web_contents(); EXPECT_TRUE(preview_tab); ASSERT_TRUE(PressEnter()); @@ -310,7 +313,7 @@ IN_PROC_BROWSER_TEST_F(InstantTest, MAYBE(OnSubmitEvent)) { EXPECT_FALSE(preview()); EXPECT_FALSE(instant()->is_displayable()); EXPECT_FALSE(instant()->IsCurrent()); - EXPECT_EQ(preview_tab, browser()->GetSelectedTabContents()); + EXPECT_EQ(preview_tab, browser()->GetSelectedWebContents()); // We should have two entries. One corresponding to the page the user was // first on, and one for the search page. @@ -338,7 +341,7 @@ IN_PROC_BROWSER_TEST_F(InstantTest, MAYBE(OnCancelEvent)) { EXPECT_TRUE(instant()->IsCurrent()); EXPECT_EQ("defghi", UTF16ToUTF8(omnibox()->GetText())); - TabContents* preview_tab = preview()->tab_contents(); + WebContents* preview_tab = preview()->web_contents(); EXPECT_TRUE(preview_tab); ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); @@ -348,7 +351,7 @@ IN_PROC_BROWSER_TEST_F(InstantTest, MAYBE(OnCancelEvent)) { EXPECT_FALSE(preview()); EXPECT_FALSE(instant()->is_displayable()); EXPECT_FALSE(instant()->IsCurrent()); - EXPECT_EQ(preview_tab, browser()->GetSelectedTabContents()); + EXPECT_EQ(preview_tab, browser()->GetSelectedWebContents()); // Check that the value is reflected and oncancel is called. EXPECT_EQ("true 0 1 1 true d false def false 3 3", @@ -566,7 +569,7 @@ IN_PROC_BROWSER_TEST_F(InstantTest, MAYBE(NonSearchToSearch)) { EXPECT_TRUE(instant()->IsCurrent()); RenderWidgetHostView* rwhv = - preview()->tab_contents()->GetRenderWidgetHostView(); + preview()->web_contents()->GetRenderWidgetHostView(); EXPECT_TRUE(rwhv); EXPECT_TRUE(rwhv->IsShowing()); } @@ -601,7 +604,7 @@ IN_PROC_BROWSER_TEST_F(InstantTest, MAYBE(SearchToNonSearch)) { // Send onchange so that the page sends up suggestions. See the comments in // NonSearchToSearch for why this is needed. ASSERT_TRUE(ui_test_utils::ExecuteJavaScript( - preview()->tab_contents()->GetRenderViewHost(), std::wstring(), + preview()->web_contents()->GetRenderViewHost(), std::wstring(), L"window.chrome.searchBox.onchange();")); ASSERT_TRUE(WaitForMessageToBeProcessedByRenderer()); @@ -670,12 +673,12 @@ IN_PROC_BROWSER_TEST_F(InstantTest, MAYBE(ValidHeight)) { int height = -1; // searchBox height is not yet set during initial load. - ASSERT_TRUE(GetIntFromJavascript(preview()->tab_contents(), + ASSERT_TRUE(GetIntFromJavascript(preview()->web_contents(), "window.beforeLoadSearchBox.height", &height)); EXPECT_EQ(0, height); // searchBox height is available by the time the page loads. - ASSERT_TRUE(GetIntFromJavascript(preview()->tab_contents(), + ASSERT_TRUE(GetIntFromJavascript(preview()->web_contents(), "window.chrome.searchBox.height", &height)); EXPECT_GT(height, 0); } @@ -702,7 +705,7 @@ IN_PROC_BROWSER_TEST_F(InstantTest, MAYBE(DontPersistSearchbox)) { SearchAndWaitForPreviewToShow(); std::string value; - ASSERT_TRUE(GetStringFromJavascript(preview()->tab_contents(), + ASSERT_TRUE(GetStringFromJavascript(preview()->web_contents(), "window.chrome.searchBox.value", &value)); EXPECT_EQ("def", value); @@ -711,7 +714,7 @@ IN_PROC_BROWSER_TEST_F(InstantTest, MAYBE(DontPersistSearchbox)) { EXPECT_FALSE(preview()); // The searchBox actually gets cleared on commit. - ASSERT_TRUE(GetStringFromJavascript(browser()->GetSelectedTabContents(), + ASSERT_TRUE(GetStringFromJavascript(browser()->GetSelectedWebContents(), "window.chrome.searchBox.value", &value)); EXPECT_EQ("", value); @@ -719,7 +722,7 @@ IN_PROC_BROWSER_TEST_F(InstantTest, MAYBE(DontPersistSearchbox)) { ui_test_utils::NavigateToURL( browser(), test_server()->GetURL("files/empty.html")); - ASSERT_TRUE(GetStringFromJavascript(browser()->GetSelectedTabContents(), + ASSERT_TRUE(GetStringFromJavascript(browser()->GetSelectedWebContents(), "window.chrome.searchBox.value", &value)); EXPECT_EQ("", value); } @@ -753,7 +756,7 @@ IN_PROC_BROWSER_TEST_F(InstantTest, MAYBE(PreloadsInstant)) { EXPECT_TRUE(preview()); EXPECT_FALSE(instant()->is_displayable()); EXPECT_FALSE(instant()->IsCurrent()); - ASSERT_TRUE(CheckVisibilityIs(preview()->tab_contents(), false)); + ASSERT_TRUE(CheckVisibilityIs(preview()->web_contents(), false)); // Adding a new tab shouldn't delete (or recreate) the TabContentsWrapper. TabContentsWrapper* preview_tab = preview(); @@ -767,7 +770,7 @@ IN_PROC_BROWSER_TEST_F(InstantTest, MAYBE(PreloadsInstant)) { // Verify that the preview is in fact showing instant search. EXPECT_TRUE(instant()->is_displayable()); EXPECT_TRUE(instant()->IsCurrent()); - ASSERT_TRUE(CheckVisibilityIs(preview()->tab_contents(), true)); + ASSERT_TRUE(CheckVisibilityIs(preview()->web_contents(), true)); } // Tests that the instant search page's visibility is set correctly. @@ -778,7 +781,7 @@ IN_PROC_BROWSER_TEST_F(InstantTest, MAYBE(PageVisibilityTest)) { // Initially navigate to the empty page which should be visible. ui_test_utils::NavigateToURL(browser(), test_server()->GetURL("")); - TabContents* initial_contents = browser()->GetSelectedTabContents(); + WebContents* initial_contents = browser()->GetSelectedWebContents(); ASSERT_TRUE(CheckVisibilityIs(initial_contents, true)); @@ -786,7 +789,7 @@ IN_PROC_BROWSER_TEST_F(InstantTest, MAYBE(PageVisibilityTest)) { browser()->window()->GetLocationBar()->FocusLocation(false); DetermineInstantSupport(); SearchAndWaitForPreviewToShow(); - TabContents* preview_contents = preview()->tab_contents(); + WebContents* preview_contents = preview()->web_contents(); ASSERT_TRUE(CheckVisibilityIs(preview_contents, true)); ASSERT_TRUE(CheckVisibilityIs(initial_contents, false)); @@ -803,7 +806,7 @@ IN_PROC_BROWSER_TEST_F(InstantTest, MAYBE(PageVisibilityTest)) { // Commit the preview. ASSERT_TRUE(PressEnter()); - EXPECT_EQ(preview_contents, browser()->GetSelectedTabContents()); + EXPECT_EQ(preview_contents, browser()->GetSelectedWebContents()); ASSERT_TRUE(CheckVisibilityIs(preview_contents, true)); } @@ -861,14 +864,14 @@ IN_PROC_BROWSER_TEST_F(InstantFieldTrialInstantTest, MAYBE(ExperimentEnabled)) { EXPECT_EQ("defghi", UTF16ToUTF8(omnibox()->GetText())); // Press <Enter> in the omnibox, causing the preview to be committed. - TabContents* preview_tab = preview()->tab_contents(); + WebContents* preview_tab = preview()->web_contents(); ASSERT_TRUE(PressEnter()); // The preview contents should now be the active tab contents. EXPECT_FALSE(preview()); EXPECT_FALSE(instant()->is_displayable()); EXPECT_FALSE(instant()->IsCurrent()); - EXPECT_EQ(preview_tab, browser()->GetSelectedTabContents()); + EXPECT_EQ(preview_tab, browser()->GetSelectedWebContents()); } // Tests the HIDDEN experiment of the field trial. @@ -906,14 +909,14 @@ IN_PROC_BROWSER_TEST_F(InstantFieldTrialHiddenTest, MAYBE(ExperimentEnabled)) { EXPECT_EQ("def", UTF16ToUTF8(omnibox()->GetText())); // Press <Enter> in the omnibox, causing the preview to be committed. - TabContents* preview_tab = preview()->tab_contents(); + WebContents* preview_tab = preview()->web_contents(); ASSERT_TRUE(PressEnter()); // The preview contents should now be the active tab contents. EXPECT_FALSE(preview()); EXPECT_FALSE(instant()->is_displayable()); EXPECT_FALSE(instant()->IsCurrent()); - EXPECT_EQ(preview_tab, browser()->GetSelectedTabContents()); + EXPECT_EQ(preview_tab, browser()->GetSelectedWebContents()); } // Tests the SILENT experiment of the field trial. @@ -951,14 +954,14 @@ IN_PROC_BROWSER_TEST_F(InstantFieldTrialSilentTest, MAYBE(ExperimentEnabled)) { EXPECT_EQ("def", UTF16ToUTF8(omnibox()->GetText())); // Press <Enter> in the omnibox, causing the preview to be committed. - TabContents* preview_tab = preview()->tab_contents(); + WebContents* preview_tab = preview()->web_contents(); ASSERT_TRUE(PressEnter()); // The preview contents should now be the active tab contents. EXPECT_FALSE(preview()); EXPECT_FALSE(instant()->is_displayable()); EXPECT_FALSE(instant()->IsCurrent()); - EXPECT_EQ(preview_tab, browser()->GetSelectedTabContents()); + EXPECT_EQ(preview_tab, browser()->GetSelectedWebContents()); } // Tests the SUGGEST experiment of the field trial. @@ -996,12 +999,12 @@ IN_PROC_BROWSER_TEST_F(InstantFieldTrialSuggestTest, MAYBE(ExperimentEnabled)) { EXPECT_EQ("defghi", UTF16ToUTF8(omnibox()->GetText())); // Press <Enter> in the omnibox, causing the preview to be committed. - TabContents* preview_tab = preview()->tab_contents(); + WebContents* preview_tab = preview()->web_contents(); ASSERT_TRUE(PressEnter()); // The preview contents should now be the active tab contents. EXPECT_FALSE(preview()); EXPECT_FALSE(instant()->is_displayable()); EXPECT_FALSE(instant()->IsCurrent()); - EXPECT_EQ(preview_tab, browser()->GetSelectedTabContents()); + EXPECT_EQ(preview_tab, browser()->GetSelectedWebContents()); } diff --git a/chrome/browser/magic_iframe_browsertest.cc b/chrome/browser/magic_iframe_browsertest.cc index ed54a64..206e025 100644 --- a/chrome/browser/magic_iframe_browsertest.cc +++ b/chrome/browser/magic_iframe_browsertest.cc @@ -13,7 +13,7 @@ #include "chrome/test/base/in_process_browser_test.h" #include "chrome/test/base/testing_profile.h" #include "chrome/test/base/ui_test_utils.h" -#include "content/browser/tab_contents/tab_contents.h" +#include "content/public/browser/web_contents.h" #include "content/public/common/content_switches.h" class MagicIframeBrowserTest : public InProcessBrowserTest { @@ -43,7 +43,7 @@ IN_PROC_BROWSER_TEST_F(MagicIframeBrowserTest, TransferIframeCloseWindow) { ui_test_utils::NavigateToURLBlockUntilNavigationsComplete(browser(), url, 3); std::string result; ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractString( - browser()->GetSelectedTabContents()->GetRenderViewHost(), L"", + browser()->GetSelectedWebContents()->GetRenderViewHost(), L"", L"window.domAutomationController.send(getLog())", &result)); ASSERT_NE(result.find("DONE"), std::string::npos) << result; } diff --git a/chrome/browser/popup_blocker_browsertest.cc b/chrome/browser/popup_blocker_browsertest.cc index 6bb8114..e794f77 100644 --- a/chrome/browser/popup_blocker_browsertest.cc +++ b/chrome/browser/popup_blocker_browsertest.cc @@ -14,9 +14,11 @@ #include "chrome/common/chrome_paths.h" #include "chrome/test/base/in_process_browser_test.h" #include "chrome/test/base/ui_test_utils.h" -#include "content/browser/tab_contents/tab_contents.h" +#include "content/public/browser/web_contents.h" #include "testing/gtest/include/gtest/gtest.h" +using content::WebContents; + namespace { static const FilePath::CharType* kTestDir = FILE_PATH_LITERAL("popup_blocker"); @@ -34,7 +36,7 @@ IN_PROC_BROWSER_TEST_F(PopupBlockerBrowserTest, PopupBlockedPostBlank) { // to the original URL. EXPECT_EQ(1u, BrowserList::GetBrowserCount(browser()->profile())); EXPECT_EQ(1, browser()->tab_count()); - TabContents* cur_tab = browser()->GetSelectedTabContents(); + WebContents* cur_tab = browser()->GetSelectedWebContents(); ASSERT_TRUE(cur_tab); EXPECT_EQ(url, cur_tab->GetURL()); } diff --git a/chrome/browser/prerender/prerender_browsertest.cc b/chrome/browser/prerender/prerender_browsertest.cc index 85b2b79..063effd 100644 --- a/chrome/browser/prerender/prerender_browsertest.cc +++ b/chrome/browser/prerender/prerender_browsertest.cc @@ -540,7 +540,7 @@ class PrerenderBrowserTest : public InProcessBrowserTest { content::NOTIFICATION_NAV_ENTRY_COMMITTED, content::NotificationService::AllSources()); RenderViewHost* render_view_host = - browser->GetSelectedTabContents()->GetRenderViewHost(); + browser->GetSelectedWebContents()->GetRenderViewHost(); render_view_host->ExecuteJavascriptInWebFrame( string16(), ASCIIToUTF16("ClickOpenLink()")); @@ -572,7 +572,7 @@ class PrerenderBrowserTest : public InProcessBrowserTest { back_nav_observer.Wait(); bool original_prerender_page = false; ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( - browser->GetSelectedTabContents()->GetRenderViewHost(), L"", + browser->GetSelectedWebContents()->GetRenderViewHost(), L"", L"window.domAutomationController.send(IsOriginalPrerenderPage())", &original_prerender_page)); EXPECT_TRUE(original_prerender_page); @@ -582,7 +582,7 @@ class PrerenderBrowserTest : public InProcessBrowserTest { // in. This must be called when the prerendered page is the current page // in the active tab. void GoBackToPageBeforePrerender(Browser* browser) { - TabContents* tab = browser->GetSelectedTabContents(); + WebContents* tab = browser->GetSelectedWebContents(); ASSERT_TRUE(tab); EXPECT_FALSE(tab->IsLoading()); ui_test_utils::WindowedNotificationObserver back_nav_observer( @@ -807,7 +807,7 @@ class PrerenderBrowserTest : public InProcessBrowserTest { ASSERT_TRUE(prerender_contents != NULL); RenderViewHost* render_view_host = - browser()->GetSelectedTabContents()->GetRenderViewHost(); + browser()->GetSelectedWebContents()->GetRenderViewHost(); render_view_host->ExecuteJavascriptInWebFrame( string16(), ASCIIToUTF16(javascript_function_name)); @@ -1883,9 +1883,9 @@ IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderClickNewBackgroundTab) { IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, NavigateToPrerenderedPageWhenDevToolsAttached) { DisableJavascriptCalls(); - TabContents* tab_contents = browser()->GetSelectedTabContents(); + WebContents* web_contents = browser()->GetSelectedWebContents(); DevToolsAgentHost* agent = DevToolsAgentHostRegistry::GetDevToolsAgentHost( - tab_contents->GetRenderViewHost()); + web_contents->GetRenderViewHost()); DevToolsManager* manager = DevToolsManager::GetInstance(); FakeDevToolsClientHost client_host; manager->RegisterDevToolsClientHostFor(agent, &client_host); diff --git a/chrome/browser/printing/print_dialog_cloud.cc b/chrome/browser/printing/print_dialog_cloud.cc index af3d099..d0c5b92 100644 --- a/chrome/browser/printing/print_dialog_cloud.cc +++ b/chrome/browser/printing/print_dialog_cloud.cc @@ -604,8 +604,7 @@ void CreateDialogImpl(const FilePath& path_to_file, Profile* profile = NULL; if (modal) { if (job_title.empty()) { - WebContents* web_contents = - browser->GetSelectedTabContentsWrapper()->web_contents(); + WebContents* web_contents = browser->GetSelectedWebContents(); if (web_contents) job_title = web_contents->GetTitle(); } diff --git a/chrome/browser/printing/print_dialog_cloud_uitest.cc b/chrome/browser/printing/print_dialog_cloud_uitest.cc index 9332346..b8e9750 100644 --- a/chrome/browser/printing/print_dialog_cloud_uitest.cc +++ b/chrome/browser/printing/print_dialog_cloud_uitest.cc @@ -23,9 +23,9 @@ #include "chrome/test/base/in_process_browser_test.h" #include "chrome/test/base/ui_test_utils.h" #include "content/browser/renderer_host/render_view_host.h" -#include "content/browser/tab_contents/tab_contents.h" #include "content/public/browser/notification_service.h" #include "content/public/browser/notification_types.h" +#include "content/public/browser/web_contents.h" #include "content/test/test_browser_thread.h" #include "net/url_request/url_request_filter.h" #include "net/url_request/url_request_test_job.h" @@ -266,11 +266,11 @@ IN_PROC_BROWSER_TEST_F(PrintDialogCloudTest, DISABLED_DialogGrabbed) { // This goes back one step further for the Chrome OS case, to making // sure 'window.print()' gets to the right place. - ASSERT_TRUE(browser()->GetSelectedTabContents()); - ASSERT_TRUE(browser()->GetSelectedTabContents()->GetRenderViewHost()); + ASSERT_TRUE(browser()->GetSelectedWebContents()); + ASSERT_TRUE(browser()->GetSelectedWebContents()->GetRenderViewHost()); string16 window_print = ASCIIToUTF16("window.print()"); - browser()->GetSelectedTabContents()->GetRenderViewHost()-> + browser()->GetSelectedWebContents()->GetRenderViewHost()-> ExecuteJavascriptInWebFrame(string16(), window_print); ui_test_utils::RunMessageLoop(); diff --git a/chrome/browser/safe_browsing/safe_browsing_service_browsertest.cc b/chrome/browser/safe_browsing/safe_browsing_service_browsertest.cc index 29b3ee5..6d4ca56 100644 --- a/chrome/browser/safe_browsing/safe_browsing_service_browsertest.cc +++ b/chrome/browser/safe_browsing/safe_browsing_service_browsertest.cc @@ -35,7 +35,7 @@ using base::Histogram; using base::StatisticsRecorder; using content::BrowserThread; - +using content::WebContents; using ::testing::_; using ::testing::Mock; using ::testing::StrictMock; @@ -381,7 +381,7 @@ class SafeBrowsingServiceTest : public InProcessBrowserTest { } bool ShowingInterstitialPage() { - TabContents* contents = browser()->GetSelectedTabContents(); + WebContents* contents = browser()->GetSelectedWebContents(); InterstitialPage* interstitial_page = contents->GetInterstitialPage(); return interstitial_page != NULL; } diff --git a/chrome/browser/sessions/session_restore.cc b/chrome/browser/sessions/session_restore.cc index 65af702..652288c 100644 --- a/chrome/browser/sessions/session_restore.cc +++ b/chrome/browser/sessions/session_restore.cc @@ -470,7 +470,7 @@ class SessionRestoreImpl : public content::NotificationObserver { RestoreTabsToBrowser(*(*i), browser, selected_tab_index); ShowBrowser(browser, initial_tab_count, selected_tab_index); tab_loader_->TabIsLoading( - &browser->GetSelectedTabContents()->GetController()); + &browser->GetSelectedWebContents()->GetController()); NotifySessionServiceOfRestoredTabs(browser, initial_tab_count); } @@ -651,7 +651,7 @@ class SessionRestoreImpl : public content::NotificationObserver { } if ((*i)->type == Browser::TYPE_TABBED) last_browser = browser; - TabContents* active_tab = browser->GetSelectedTabContents(); + WebContents* active_tab = browser->GetSelectedWebContents(); int initial_tab_count = browser->tab_count(); int selected_tab_index = (*i)->selected_tab_index; RestoreTabsToBrowser(*(*i), browser, selected_tab_index); @@ -663,7 +663,7 @@ class SessionRestoreImpl : public content::NotificationObserver { active_tab = NULL; } tab_loader_->TabIsLoading( - &browser->GetSelectedTabContents()->GetController()); + &browser->GetSelectedWebContents()->GetController()); NotifySessionServiceOfRestoredTabs(browser, initial_tab_count); } @@ -722,7 +722,7 @@ class SessionRestoreImpl : public content::NotificationObserver { extension_misc::APP_LAUNCH_BUCKET_BOUNDARY); } - TabContents* tab_contents = + WebContents* web_contents = browser->AddRestoredTab(tab.navigations, tab_index, selected_index, @@ -732,7 +732,7 @@ class SessionRestoreImpl : public content::NotificationObserver { true, NULL); if (schedule_load) - tab_loader_->ScheduleLoad(&tab_contents->GetController()); + tab_loader_->ScheduleLoad(&web_contents->GetController()); } Browser* CreateRestoredBrowser(Browser::Type type, @@ -763,7 +763,7 @@ class SessionRestoreImpl : public content::NotificationObserver { // TODO(jcampan): http://crbug.com/8123 we should not need to set the // initial focus explicitly. - browser->GetSelectedTabContents()->GetView()->SetInitialFocus(); + browser->GetSelectedWebContents()->GetView()->SetInitialFocus(); if (!browser_shown_) { browser_shown_ = true; diff --git a/chrome/browser/sessions/tab_restore_service.cc b/chrome/browser/sessions/tab_restore_service.cc index 78c2ecd..4f59a28 100644 --- a/chrome/browser/sessions/tab_restore_service.cc +++ b/chrome/browser/sessions/tab_restore_service.cc @@ -33,6 +33,7 @@ using base::Time; using content::NavigationEntry; +using content::WebContents; // TimeFactory----------------------------------------------------------------- @@ -403,7 +404,7 @@ void TabRestoreService::RestoreEntryById(TabRestoreServiceDelegate* delegate, delegate->ShowBrowserWindow(); if (disposition == CURRENT_TAB && current_delegate && - current_delegate->GetSelectedTabContents()) { + current_delegate->GetSelectedWebContents()) { current_delegate->CloseTab(); } } else { diff --git a/chrome/browser/sessions/tab_restore_service_delegate.h b/chrome/browser/sessions/tab_restore_service_delegate.h index 23beff0..29ce140 100644 --- a/chrome/browser/sessions/tab_restore_service_delegate.h +++ b/chrome/browser/sessions/tab_restore_service_delegate.h @@ -16,6 +16,10 @@ class SessionStorageNamespace; class TabContents; class TabNavigation; +namespace content { +class WebContents; +} + // Objects implement this interface to provide necessary functionality for // TabRestoreService to operate. These methods are mostly copies of existing // Browser methods. @@ -35,7 +39,7 @@ class TabRestoreServiceDelegate { // see Browser methods with the same names virtual TabContents* GetTabContentsAt(int index) const = 0; - virtual TabContents* GetSelectedTabContents() const = 0; + virtual content::WebContents* GetSelectedWebContents() const = 0; virtual bool IsTabPinned(int index) const = 0; virtual TabContents* AddRestoredTab( const std::vector<TabNavigation>& navigations, diff --git a/chrome/browser/speech/speech_input_bubble_browsertest.cc b/chrome/browser/speech/speech_input_bubble_browsertest.cc index 6abd94a..72fbf3a 100644 --- a/chrome/browser/speech/speech_input_bubble_browsertest.cc +++ b/chrome/browser/speech/speech_input_bubble_browsertest.cc @@ -23,16 +23,14 @@ class SpeechInputBubbleTest : public SpeechInputBubbleDelegate, IN_PROC_BROWSER_TEST_F(SpeechInputBubbleTest, CreateAndDestroy) { gfx::Rect element_rect(100, 100, 100, 100); scoped_ptr<SpeechInputBubble> bubble(SpeechInputBubble::Create( - browser()->GetSelectedTabContentsWrapper()->web_contents(), this, - element_rect)); + browser()->GetSelectedWebContents(), this, element_rect)); EXPECT_TRUE(bubble.get()); } IN_PROC_BROWSER_TEST_F(SpeechInputBubbleTest, ShowAndDestroy) { gfx::Rect element_rect(100, 100, 100, 100); scoped_ptr<SpeechInputBubble> bubble(SpeechInputBubble::Create( - browser()->GetSelectedTabContentsWrapper()->web_contents(), this, - element_rect)); + browser()->GetSelectedWebContents(), this, element_rect)); EXPECT_TRUE(bubble.get()); bubble->Show(); } @@ -40,8 +38,7 @@ IN_PROC_BROWSER_TEST_F(SpeechInputBubbleTest, ShowAndDestroy) { IN_PROC_BROWSER_TEST_F(SpeechInputBubbleTest, ShowAndHide) { gfx::Rect element_rect(100, 100, 100, 100); scoped_ptr<SpeechInputBubble> bubble(SpeechInputBubble::Create( - browser()->GetSelectedTabContentsWrapper()->web_contents(), this, - element_rect)); + browser()->GetSelectedWebContents(), this, element_rect)); EXPECT_TRUE(bubble.get()); bubble->Show(); bubble->Hide(); @@ -50,8 +47,7 @@ IN_PROC_BROWSER_TEST_F(SpeechInputBubbleTest, ShowAndHide) { IN_PROC_BROWSER_TEST_F(SpeechInputBubbleTest, ShowAndHideTwice) { gfx::Rect element_rect(100, 100, 100, 100); scoped_ptr<SpeechInputBubble> bubble(SpeechInputBubble::Create( - browser()->GetSelectedTabContentsWrapper()->web_contents(), this, - element_rect)); + browser()->GetSelectedWebContents(), this, element_rect)); EXPECT_TRUE(bubble.get()); bubble->Show(); bubble->Hide(); diff --git a/chrome/browser/ssl/ssl_browser_tests.cc b/chrome/browser/ssl/ssl_browser_tests.cc index 02327e1..24d1e25 100644 --- a/chrome/browser/ssl/ssl_browser_tests.cc +++ b/chrome/browser/ssl/ssl_browser_tests.cc @@ -16,16 +16,18 @@ #include "chrome/test/base/ui_test_utils.h" #include "content/browser/renderer_host/render_view_host.h" #include "content/browser/tab_contents/interstitial_page.h" -#include "content/browser/tab_contents/tab_contents.h" +#include "content/browser/tab_contents/navigation_controller.h" #include "content/public/browser/navigation_entry.h" #include "content/public/browser/notification_service.h" #include "content/public/browser/ssl_status.h" +#include "content/public/browser/web_contents.h" #include "content/public/common/security_style.h" #include "net/base/cert_status_flags.h" #include "net/test/test_server.h" using content::NavigationEntry; using content::SSLStatus; +using content::WebContents; const FilePath::CharType kDocRoot[] = FILE_PATH_LITERAL("chrome/test/data"); @@ -49,7 +51,7 @@ class SSLUITest : public InProcessBrowserTest { command_line->AppendSwitch(switches::kAllowRunningInsecureContent); } - void CheckAuthenticatedState(TabContents* tab, + void CheckAuthenticatedState(WebContents* tab, bool displayed_insecure_content) { ASSERT_FALSE(tab->IsCrashed()); NavigationEntry* entry = tab->GetController().GetActiveEntry(); @@ -65,7 +67,7 @@ class SSLUITest : public InProcessBrowserTest { !!(entry->GetSSL().content_status & SSLStatus::RAN_INSECURE_CONTENT)); } - void CheckUnauthenticatedState(TabContents* tab) { + void CheckUnauthenticatedState(WebContents* tab) { ASSERT_FALSE(tab->IsCrashed()); NavigationEntry* entry = tab->GetController().GetActiveEntry(); ASSERT_TRUE(entry); @@ -79,7 +81,7 @@ class SSLUITest : public InProcessBrowserTest { !!(entry->GetSSL().content_status & SSLStatus::RAN_INSECURE_CONTENT)); } - void CheckAuthenticationBrokenState(TabContents* tab, + void CheckAuthenticationBrokenState(WebContents* tab, net::CertStatus error, bool ran_insecure_content, bool interstitial) { @@ -102,7 +104,7 @@ class SSLUITest : public InProcessBrowserTest { !!(entry->GetSSL().content_status & SSLStatus::RAN_INSECURE_CONTENT)); } - void CheckWorkerLoadResult(TabContents* tab, bool expectLoaded) { + void CheckWorkerLoadResult(WebContents* tab, bool expectLoaded) { // Workers are async and we don't have notifications for them passing // messages since they do it between renderer and worker processes. // So have a polling loop, check every 200ms, timeout at 30s. @@ -134,7 +136,7 @@ class SSLUITest : public InProcessBrowserTest { EXPECT_EQ(expectLoaded, actuallyLoadedContent); } - void ProceedThroughInterstitial(TabContents* tab) { + void ProceedThroughInterstitial(content::WebContents* tab) { InterstitialPage* interstitial_page = tab->GetInterstitialPage(); ASSERT_TRUE(interstitial_page); ui_test_utils::WindowedNotificationObserver observer( @@ -251,7 +253,7 @@ IN_PROC_BROWSER_TEST_F(SSLUITest, TestHTTP) { ui_test_utils::NavigateToURL(browser(), test_server()->GetURL("files/ssl/google.html")); - CheckUnauthenticatedState(browser()->GetSelectedTabContents()); + CheckUnauthenticatedState(browser()->GetSelectedWebContents()); } // Visits a page over http which includes broken https resources (status should @@ -271,7 +273,7 @@ IN_PROC_BROWSER_TEST_F(SSLUITest, TestHTTPWithBrokenHTTPSResource) { ui_test_utils::NavigateToURL( browser(), test_server()->GetURL(replacement_path)); - CheckUnauthenticatedState(browser()->GetSelectedTabContents()); + CheckUnauthenticatedState(browser()->GetSelectedWebContents()); } // http://crbug.com/91745 @@ -288,7 +290,7 @@ IN_PROC_BROWSER_TEST_F(SSLUITest, MAYBE_TestOKHTTPS) { ui_test_utils::NavigateToURL(browser(), https_server_.GetURL("files/ssl/google.html")); - CheckAuthenticatedState(browser()->GetSelectedTabContents(), false); + CheckAuthenticatedState(browser()->GetSelectedWebContents(), false); } // Visits a page with https error and proceed: @@ -298,7 +300,7 @@ IN_PROC_BROWSER_TEST_F(SSLUITest, TestHTTPSExpiredCertAndProceed) { ui_test_utils::NavigateToURL(browser(), https_server_expired_.GetURL("files/ssl/google.html")); - TabContents* tab = browser()->GetSelectedTabContents(); + WebContents* tab = browser()->GetSelectedWebContents(); CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, true); // Interstitial showing @@ -328,7 +330,7 @@ IN_PROC_BROWSER_TEST_F(SSLUITest, MAYBE_TestHTTPSExpiredCertAndDontProceed) { ui_test_utils::NavigateToURL(browser(), https_server_.GetURL("files/ssl/google.html")); - TabContents* tab = browser()->GetSelectedTabContents(); + WebContents* tab = browser()->GetSelectedWebContents(); NavigationEntry* entry = tab->GetController().GetActiveEntry(); ASSERT_TRUE(entry); @@ -373,7 +375,7 @@ IN_PROC_BROWSER_TEST_F(SSLUITest, // First navigate to an HTTP page. ui_test_utils::NavigateToURL(browser(), test_server()->GetURL("files/ssl/google.html")); - TabContents* tab = browser()->GetSelectedTabContents(); + WebContents* tab = browser()->GetSelectedWebContents(); NavigationEntry* entry = tab->GetController().GetActiveEntry(); ASSERT_TRUE(entry); @@ -396,7 +398,7 @@ IN_PROC_BROWSER_TEST_F(SSLUITest, EXPECT_FALSE(tab->GetRenderViewHost()->is_swapped_out()); // We should be back at the original good page. - EXPECT_FALSE(browser()->GetSelectedTabContents()->GetInterstitialPage()); + EXPECT_FALSE(browser()->GetSelectedWebContents()->GetInterstitialPage()); CheckUnauthenticatedState(tab); } @@ -409,7 +411,7 @@ IN_PROC_BROWSER_TEST_F(SSLUITest, FLAKY_TestHTTPSExpiredCertAndGoBackViaMenu) { // First navigate to an HTTP page. ui_test_utils::NavigateToURL(browser(), test_server()->GetURL("files/ssl/google.html")); - TabContents* tab = browser()->GetSelectedTabContents(); + WebContents* tab = browser()->GetSelectedWebContents(); NavigationEntry* entry = tab->GetController().GetActiveEntry(); ASSERT_TRUE(entry); @@ -423,7 +425,7 @@ IN_PROC_BROWSER_TEST_F(SSLUITest, FLAKY_TestHTTPSExpiredCertAndGoBackViaMenu) { tab->GetController().GoToOffset(-1); // We should be back at the original good page. - EXPECT_FALSE(browser()->GetSelectedTabContents()->GetInterstitialPage()); + EXPECT_FALSE(browser()->GetSelectedWebContents()->GetInterstitialPage()); CheckUnauthenticatedState(tab); } @@ -436,7 +438,7 @@ IN_PROC_BROWSER_TEST_F(SSLUITest, FLAKY_TestHTTPSExpiredCertAndGoForward) { // First navigate to two HTTP pages. ui_test_utils::NavigateToURL(browser(), test_server()->GetURL("files/ssl/google.html")); - TabContents* tab = browser()->GetSelectedTabContents(); + WebContents* tab = browser()->GetSelectedWebContents(); NavigationEntry* entry1 = tab->GetController().GetActiveEntry(); ASSERT_TRUE(entry1); ui_test_utils::NavigateToURL(browser(), @@ -472,7 +474,7 @@ IN_PROC_BROWSER_TEST_F(SSLUITest, FLAKY_TestHTTPSExpiredCertAndGoForward) { } // We should be showing the second good page. - EXPECT_FALSE(browser()->GetSelectedTabContents()->GetInterstitialPage()); + EXPECT_FALSE(browser()->GetSelectedWebContents()->GetInterstitialPage()); CheckUnauthenticatedState(tab); EXPECT_FALSE(tab->GetController().CanGoForward()); NavigationEntry* entry4 = tab->GetController().GetActiveEntry(); @@ -497,13 +499,13 @@ IN_PROC_BROWSER_TEST_F(SSLUITest, MAYBE_TestHTTPSErrorWithNoNavEntry) { GURL url = https_server_expired_.GetURL("files/ssl/google.htm"); TabContentsWrapper* tab2 = browser()->AddSelectedTabWithURL(url, content::PAGE_TRANSITION_TYPED); - ui_test_utils::WaitForLoadStop(tab2->tab_contents()); + ui_test_utils::WaitForLoadStop(tab2->web_contents()); // Verify our assumption that there was no prior navigation. EXPECT_FALSE(browser()->command_updater()->IsCommandEnabled(IDC_BACK)); // We should have an interstitial page showing. - ASSERT_TRUE(tab2->tab_contents()->GetInterstitialPage()); + ASSERT_TRUE(tab2->web_contents()->GetInterstitialPage()); } // Disabled due to crash in downloads code that this triggers. @@ -531,7 +533,7 @@ IN_PROC_BROWSER_TEST_F(SSLUITest, DISABLED_TestBadHTTPSDownload) { // Proceed through the SSL interstitial. This doesn't use // |ProceedThroughInterstitial| since no page load will commit. - TabContents* tab = browser()->GetSelectedTabContents(); + WebContents* tab = browser()->GetSelectedWebContents(); ASSERT_TRUE(tab != NULL); ASSERT_TRUE(tab->GetInterstitialPage() != NULL); { @@ -570,7 +572,7 @@ IN_PROC_BROWSER_TEST_F(SSLUITest, TestDisplaysInsecureContent) { ui_test_utils::NavigateToURL(browser(), https_server_.GetURL(replacement_path)); - CheckAuthenticatedState(browser()->GetSelectedTabContents(), true); + CheckAuthenticatedState(browser()->GetSelectedWebContents(), true); } // Visits a page that runs insecure content and tries to suppress the insecure @@ -584,7 +586,7 @@ IN_PROC_BROWSER_TEST_F(SSLUITest, ui_test_utils::NavigateToURL(browser(), https_server_.GetURL( "files/ssl/page_runs_insecure_content.html")); - CheckAuthenticationBrokenState(browser()->GetSelectedTabContents(), 0, true, + CheckAuthenticationBrokenState(browser()->GetSelectedWebContents(), 0, true, false); } @@ -604,7 +606,7 @@ IN_PROC_BROWSER_TEST_F(SSLUITest, FLAKY_TestUnsafeContents) { ui_test_utils::NavigateToURL(browser(), https_server_.GetURL(replacement_path)); - TabContents* tab = browser()->GetSelectedTabContents(); + WebContents* tab = browser()->GetSelectedWebContents(); // When the bad content is filtered, the state is expected to be // authenticated. CheckAuthenticatedState(tab, false); @@ -646,7 +648,7 @@ IN_PROC_BROWSER_TEST_F(SSLUITest, TestDisplaysInsecureContentLoadedFromJS) { ui_test_utils::NavigateToURL(browser(), https_server_.GetURL( replacement_path)); - TabContents* tab = browser()->GetSelectedTabContents(); + WebContents* tab = browser()->GetSelectedWebContents(); CheckAuthenticatedState(tab, false); // Load the insecure image. @@ -673,7 +675,7 @@ IN_PROC_BROWSER_TEST_F(SSLUITest, TestDisplaysInsecureContentTwoTabs) { TabContentsWrapper* tab1 = browser()->GetSelectedTabContentsWrapper(); // This tab should be fine. - CheckAuthenticatedState(tab1->tab_contents(), false); + CheckAuthenticatedState(tab1->web_contents(), false); // Create a new tab. std::string replacement_path; @@ -696,10 +698,10 @@ IN_PROC_BROWSER_TEST_F(SSLUITest, TestDisplaysInsecureContentTwoTabs) { observer.Wait(); // The new tab has insecure content. - CheckAuthenticatedState(tab2->tab_contents(), true); + CheckAuthenticatedState(tab2->web_contents(), true); // The original tab should not be contaminated. - CheckAuthenticatedState(tab1->tab_contents(), false); + CheckAuthenticatedState(tab1->web_contents(), false); } // Visits two pages from the same origin: one that runs insecure content and one @@ -715,7 +717,7 @@ IN_PROC_BROWSER_TEST_F(SSLUITest, TestRunsInsecureContentTwoTabs) { TabContentsWrapper* tab1 = browser()->GetSelectedTabContentsWrapper(); // This tab should be fine. - CheckAuthenticatedState(tab1->tab_contents(), false); + CheckAuthenticatedState(tab1->web_contents(), false); std::string replacement_path; ASSERT_TRUE(GetFilePathWithHostAndPortReplacement( @@ -737,11 +739,11 @@ IN_PROC_BROWSER_TEST_F(SSLUITest, TestRunsInsecureContentTwoTabs) { observer.Wait(); // The new tab has insecure content. - CheckAuthenticationBrokenState(tab2->tab_contents(), 0, true, false); + CheckAuthenticationBrokenState(tab2->web_contents(), 0, true, false); // Which means the origin for the first tab has also been contaminated with // insecure content. - CheckAuthenticationBrokenState(tab1->tab_contents(), 0, true, false); + CheckAuthenticationBrokenState(tab1->web_contents(), 0, true, false); } // Visits a page with an image over http. Visits another page over https @@ -760,7 +762,7 @@ IN_PROC_BROWSER_TEST_F(SSLUITest, TestDisplaysCachedInsecureContent) { // Load original page over HTTP. const GURL url_http = test_server()->GetURL(replacement_path); ui_test_utils::NavigateToURL(browser(), url_http); - TabContents* tab = browser()->GetSelectedTabContents(); + WebContents* tab = browser()->GetSelectedWebContents(); CheckUnauthenticatedState(tab); // Load again but over SSL. It should be marked as displaying insecure @@ -794,7 +796,7 @@ IN_PROC_BROWSER_TEST_F(SSLUITest, MAYBE_TestRunsCachedInsecureContent) { // Load original page over HTTP. const GURL url_http = test_server()->GetURL(replacement_path); ui_test_utils::NavigateToURL(browser(), url_http); - TabContents* tab = browser()->GetSelectedTabContents(); + WebContents* tab = browser()->GetSelectedWebContents(); CheckUnauthenticatedState(tab); // Load again but over SSL. It should be marked as displaying insecure @@ -816,7 +818,7 @@ IN_PROC_BROWSER_TEST_F(SSLUITest, TestCNInvalidStickiness) { https_server_mismatched_.GetURL("files/ssl/google.html")); // We get an interstitial page as a result. - TabContents* tab = browser()->GetSelectedTabContents(); + WebContents* tab = browser()->GetSelectedWebContents(); CheckAuthenticationBrokenState(tab, net::CERT_STATUS_COMMON_NAME_INVALID, false, true); // Interstitial showing. ProceedThroughInterstitial(tab); @@ -854,7 +856,7 @@ IN_PROC_BROWSER_TEST_F(SSLUITest, TestRefNavigation) { ui_test_utils::NavigateToURL(browser(), https_server_expired_.GetURL("files/ssl/page_with_refs.html")); - TabContents* tab = browser()->GetSelectedTabContents(); + WebContents* tab = browser()->GetSelectedWebContents(); CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, true); // Interstitial showing. @@ -889,7 +891,7 @@ IN_PROC_BROWSER_TEST_F(SSLUITest, DISABLED_TestCloseTabWithUnsafePopup) { ui_test_utils::NavigateToURL(browser(), test_server()->GetURL(replacement_path)); - TabContents* tab1 = browser()->GetSelectedTabContents(); + WebContents* tab1 = browser()->GetSelectedWebContents(); // It is probably overkill to add a notification for a popup-opening, let's // just poll. for (int i = 0; i < 10; i++) { @@ -924,7 +926,7 @@ IN_PROC_BROWSER_TEST_F(SSLUITest, TestRedirectBadToGoodHTTPS) { ui_test_utils::NavigateToURL(browser(), GURL(url1.spec() + url2.spec())); - TabContents* tab = browser()->GetSelectedTabContents(); + WebContents* tab = browser()->GetSelectedWebContents(); CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, true); // Interstitial showing. @@ -945,7 +947,7 @@ IN_PROC_BROWSER_TEST_F(SSLUITest, FLAKY_TestRedirectGoodToBadHTTPS) { GURL url2 = https_server_expired_.GetURL("files/ssl/google.html"); ui_test_utils::NavigateToURL(browser(), GURL(url1.spec() + url2.spec())); - TabContents* tab = browser()->GetSelectedTabContents(); + WebContents* tab = browser()->GetSelectedWebContents(); CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, true); // Interstitial showing. @@ -960,7 +962,7 @@ IN_PROC_BROWSER_TEST_F(SSLUITest, TestRedirectHTTPToGoodHTTPS) { ASSERT_TRUE(test_server()->Start()); ASSERT_TRUE(https_server_.Start()); - TabContents* tab = browser()->GetSelectedTabContents(); + WebContents* tab = browser()->GetSelectedWebContents(); // HTTP redirects to good HTTPS. GURL http_url = test_server()->GetURL("server-redirect?"); @@ -977,7 +979,7 @@ IN_PROC_BROWSER_TEST_F(SSLUITest, FLAKY_TestRedirectHTTPToBadHTTPS) { ASSERT_TRUE(test_server()->Start()); ASSERT_TRUE(https_server_expired_.Start()); - TabContents* tab = browser()->GetSelectedTabContents(); + WebContents* tab = browser()->GetSelectedWebContents(); GURL http_url = test_server()->GetURL("server-redirect?"); GURL bad_https_url = @@ -1005,18 +1007,18 @@ IN_PROC_BROWSER_TEST_F(SSLUITest, FLAKY_TestRedirectHTTPSToHTTP) { ui_test_utils::NavigateToURL(browser(), GURL(https_url.spec() + http_url.spec())); - CheckUnauthenticatedState(browser()->GetSelectedTabContents()); + CheckUnauthenticatedState(browser()->GetSelectedWebContents()); } // Visits a page to which we could not connect (bad port) over http and https // and make sure the security style is correct. IN_PROC_BROWSER_TEST_F(SSLUITest, TestConnectToBadPort) { ui_test_utils::NavigateToURL(browser(), GURL("http://localhost:17")); - CheckUnauthenticatedState(browser()->GetSelectedTabContents()); + CheckUnauthenticatedState(browser()->GetSelectedWebContents()); // Same thing over HTTPS. ui_test_utils::NavigateToURL(browser(), GURL("https://localhost:17")); - CheckUnauthenticatedState(browser()->GetSelectedTabContents()); + CheckUnauthenticatedState(browser()->GetSelectedWebContents()); } // @@ -1039,7 +1041,7 @@ IN_PROC_BROWSER_TEST_F(SSLUITest, TestGoodFrameNavigation) { https_server_expired_, &top_frame_path)); - TabContents* tab = browser()->GetSelectedTabContents(); + WebContents* tab = browser()->GetSelectedWebContents(); ui_test_utils::NavigateToURL(browser(), https_server_.GetURL(top_frame_path)); @@ -1138,7 +1140,7 @@ IN_PROC_BROWSER_TEST_F(SSLUITest, FLAKY_TestBadFrameNavigation) { https_server_expired_, &top_frame_path)); - TabContents* tab = browser()->GetSelectedTabContents(); + WebContents* tab = browser()->GetSelectedWebContents(); ui_test_utils::NavigateToURL(browser(), https_server_expired_.GetURL(top_frame_path)); CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, @@ -1177,7 +1179,7 @@ IN_PROC_BROWSER_TEST_F(SSLUITest, DISABLED_TestUnauthenticatedFrameNavigation) { https_server_expired_, &top_frame_path)); - TabContents* tab = browser()->GetSelectedTabContents(); + WebContents* tab = browser()->GetSelectedWebContents(); ui_test_utils::NavigateToURL(browser(), test_server()->GetURL(top_frame_path)); CheckUnauthenticatedState(tab); @@ -1239,7 +1241,7 @@ IN_PROC_BROWSER_TEST_F(SSLUITest, FLAKY_TestUnsafeContentsInWorkerFiltered) { &page_with_unsafe_worker_path)); ui_test_utils::NavigateToURL(browser(), https_server_.GetURL( page_with_unsafe_worker_path)); - TabContents* tab = browser()->GetSelectedTabContents(); + WebContents* tab = browser()->GetSelectedWebContents(); // Expect Worker not to load insecure content. CheckWorkerLoadResult(tab, false); // The bad content is filtered, expect the state to be authenticated. @@ -1255,7 +1257,7 @@ IN_PROC_BROWSER_TEST_F(SSLUITest, FLAKY_TestUnsafeContentsInWorker) { // the user approves the bad certificate. ui_test_utils::NavigateToURL(browser(), https_server_expired_.GetURL("files/ssl/blank_page.html")); - TabContents* tab = browser()->GetSelectedTabContents(); + WebContents* tab = browser()->GetSelectedWebContents(); CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, false, true); // Interstitial showing ProceedThroughInterstitial(tab); @@ -1290,7 +1292,7 @@ IN_PROC_BROWSER_TEST_F(SSLUITestBlock, TestBlockDisplayingInsecureImage) { ui_test_utils::NavigateToURL(browser(), https_server_.GetURL(replacement_path)); - CheckAuthenticatedState(browser()->GetSelectedTabContents(), false); + CheckAuthenticatedState(browser()->GetSelectedWebContents(), false); } // Test that when the browser blocks displaying insecure content (iframes), the @@ -1309,7 +1311,7 @@ IN_PROC_BROWSER_TEST_F(SSLUITestBlock, TestBlockDisplayingInsecureIframe) { ui_test_utils::NavigateToURL(browser(), https_server_.GetURL(replacement_path)); - CheckAuthenticatedState(browser()->GetSelectedTabContents(), false); + CheckAuthenticatedState(browser()->GetSelectedWebContents(), false); } @@ -1329,7 +1331,7 @@ IN_PROC_BROWSER_TEST_F(SSLUITestBlock, TestBlockRunningInsecureContent) { ui_test_utils::NavigateToURL(browser(), https_server_.GetURL(replacement_path)); - CheckAuthenticatedState(browser()->GetSelectedTabContents(), false); + CheckAuthenticatedState(browser()->GetSelectedWebContents(), false); } diff --git a/chrome/browser/sync/test/integration/sync_test.cc b/chrome/browser/sync/test/integration/sync_test.cc index e7a6e53..e290836 100644 --- a/chrome/browser/sync/test/integration/sync_test.cc +++ b/chrome/browser/sync/test/integration/sync_test.cc @@ -34,7 +34,7 @@ #include "chrome/common/net/gaia/gaia_urls.h" #include "chrome/test/base/testing_browser_process.h" #include "chrome/test/base/ui_test_utils.h" -#include "content/browser/tab_contents/tab_contents.h" +#include "content/public/browser/web_contents.h" #include "content/public/common/url_fetcher.h" #include "content/public/common/url_fetcher_delegate.h" #include "content/test/test_browser_thread.h" @@ -554,7 +554,7 @@ void SyncTest::DisableNotifications() { std::string path = "chromiumsync/disablenotifications"; ui_test_utils::NavigateToURL(browser(), sync_server_.GetURL(path)); ASSERT_EQ("Notifications disabled", - UTF16ToASCII(browser()->GetSelectedTabContents()->GetTitle())); + UTF16ToASCII(browser()->GetSelectedWebContents()->GetTitle())); } void SyncTest::EnableNotifications() { @@ -562,7 +562,7 @@ void SyncTest::EnableNotifications() { std::string path = "chromiumsync/enablenotifications"; ui_test_utils::NavigateToURL(browser(), sync_server_.GetURL(path)); ASSERT_EQ("Notifications enabled", - UTF16ToASCII(browser()->GetSelectedTabContents()->GetTitle())); + UTF16ToASCII(browser()->GetSelectedWebContents()->GetTitle())); } void SyncTest::TriggerNotification( @@ -577,7 +577,7 @@ void SyncTest::TriggerNotification( sync_notifier::kSyncP2PNotificationChannel + "&data=" + data; ui_test_utils::NavigateToURL(browser(), sync_server_.GetURL(path)); ASSERT_EQ("Notification sent", - UTF16ToASCII(browser()->GetSelectedTabContents()->GetTitle())); + UTF16ToASCII(browser()->GetSelectedWebContents()->GetTitle())); } bool SyncTest::ServerSupportsErrorTriggering() const { @@ -602,7 +602,7 @@ void SyncTest::TriggerMigrationDoneError( } ui_test_utils::NavigateToURL(browser(), sync_server_.GetURL(path)); ASSERT_EQ("Migration: 200", - UTF16ToASCII(browser()->GetSelectedTabContents()->GetTitle())); + UTF16ToASCII(browser()->GetSelectedWebContents()->GetTitle())); } void SyncTest::TriggerBirthdayError() { @@ -610,7 +610,7 @@ void SyncTest::TriggerBirthdayError() { std::string path = "chromiumsync/birthdayerror"; ui_test_utils::NavigateToURL(browser(), sync_server_.GetURL(path)); ASSERT_EQ("Birthday error", - UTF16ToASCII(browser()->GetSelectedTabContents()->GetTitle())); + UTF16ToASCII(browser()->GetSelectedWebContents()->GetTitle())); } void SyncTest::TriggerTransientError() { @@ -618,7 +618,7 @@ void SyncTest::TriggerTransientError() { std::string path = "chromiumsync/transienterror"; ui_test_utils::NavigateToURL(browser(), sync_server_.GetURL(path)); ASSERT_EQ("Transient error", - UTF16ToASCII(browser()->GetSelectedTabContents()->GetTitle())); + UTF16ToASCII(browser()->GetSelectedWebContents()->GetTitle())); } void SyncTest::TriggerAuthError() { @@ -694,7 +694,7 @@ void SyncTest::TriggerSyncError(const browser_sync::SyncProtocolError& error) { ui_test_utils::NavigateToURL(browser(), sync_server_.GetURL(path)); std::string output = UTF16ToASCII( - browser()->GetSelectedTabContents()->GetTitle()); + browser()->GetSelectedWebContents()->GetTitle()); ASSERT_TRUE(output.find("SetError: 200") != string16::npos); } @@ -703,7 +703,7 @@ void SyncTest::TriggerSetSyncTabs() { std::string path = "chromiumsync/synctabs"; ui_test_utils::NavigateToURL(browser(), sync_server_.GetURL(path)); ASSERT_EQ("Sync Tabs", - UTF16ToASCII(browser()->GetSelectedTabContents()->GetTitle())); + UTF16ToASCII(browser()->GetSelectedWebContents()->GetTitle())); } int SyncTest::NumberOfDefaultSyncItems() const { diff --git a/chrome/browser/tab_contents/render_view_context_menu_browsertest.cc b/chrome/browser/tab_contents/render_view_context_menu_browsertest.cc index 3c241b1..bd3aaac 100644 --- a/chrome/browser/tab_contents/render_view_context_menu_browsertest.cc +++ b/chrome/browser/tab_contents/render_view_context_menu_browsertest.cc @@ -16,6 +16,8 @@ #include "content/public/browser/navigation_entry.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebContextMenuData.h" +using content::WebContents; + namespace { class TestRenderViewContextMenu : public RenderViewContextMenu { @@ -44,8 +46,8 @@ class ContextMenuBrowserTest : public InProcessBrowserTest { params.media_type = WebKit::WebContextMenuData::MediaTypeNone; params.unfiltered_link_url = unfiltered_url; params.link_url = url; - TabContents* tab_contents = browser()->GetSelectedTabContents(); - params.page_url = tab_contents->GetController().GetActiveEntry()->GetURL(); + WebContents* web_contents = browser()->GetSelectedWebContents(); + params.page_url = web_contents->GetController().GetActiveEntry()->GetURL(); #if defined(OS_MACOSX) params.writing_direction_default = 0; params.writing_direction_left_to_right = 0; diff --git a/chrome/browser/tab_contents/web_drag_source_win.cc b/chrome/browser/tab_contents/web_drag_source_win.cc index 5140096..eaf3846 100644 --- a/chrome/browser/tab_contents/web_drag_source_win.cc +++ b/chrome/browser/tab_contents/web_drag_source_win.cc @@ -38,8 +38,8 @@ WebDragSource::WebDragSource(gfx::NativeWindow source_wnd, source_wnd_(source_wnd), render_view_host_(tab_contents->GetRenderViewHost()), effect_(DROPEFFECT_NONE) { - registrar_.Add(this, content::NOTIFICATION_TAB_CONTENTS_SWAPPED, - content::Source<TabContents>(tab_contents)); + registrar_.Add(this, content::NOTIFICATION_WEB_CONTENTS_SWAPPED, + content::Source<WebContents>(tab_contents)); registrar_.Add(this, content::NOTIFICATION_WEB_CONTENTS_DISCONNECTED, content::Source<WebContents>(tab_contents)); } @@ -112,7 +112,7 @@ void WebDragSource::OnDragSourceMove() { void WebDragSource::Observe(int type, const content::NotificationSource& source, const content::NotificationDetails& details) { - if (content::NOTIFICATION_TAB_CONTENTS_SWAPPED == type) { + if (content::NOTIFICATION_WEB_CONTENTS_SWAPPED == type) { // When the tab contents get swapped, our render view host goes away. // That's OK, we can continue the drag, we just can't send messages back to // our drag source. diff --git a/chrome/browser/tabs/tab_finder.cc b/chrome/browser/tabs/tab_finder.cc index 43d66f7..1c24513 100644 --- a/chrome/browser/tabs/tab_finder.cc +++ b/chrome/browser/tabs/tab_finder.cc @@ -81,7 +81,7 @@ bool TabFinder::IsEnabled() { switches::kFocusExistingTabOnOpen); } -TabContents* TabFinder::FindTab(Browser* browser, +WebContents* TabFinder::FindTab(Browser* browser, const GURL& url, Browser** existing_browser) { if (browser->profile()->IsOffTheRecord()) @@ -89,12 +89,12 @@ TabContents* TabFinder::FindTab(Browser* browser, // If the current tab matches the url, ignore it and let the user reload the // existing tab. - TabContents* selected_tab = browser->GetSelectedTabContents(); + WebContents* selected_tab = browser->GetSelectedWebContents(); if (TabMatchesURL(selected_tab, url)) return NULL; // See if the current browser has a tab matching the specified url. - TabContents* tab_in_browser = FindTabInBrowser(browser, url); + WebContents* tab_in_browser = FindTabInBrowser(browser, url); if (tab_in_browser) { *existing_browser = browser; return tab_in_browser; @@ -159,7 +159,7 @@ bool TabFinder::TabMatchesURL(WebContents* tab_contents, const GURL& url) { return i != web_contents_to_url_.end() && i->second == url; } -TabContents* TabFinder::FindTabInBrowser(Browser* browser, const GURL& url) { +WebContents* TabFinder::FindTabInBrowser(Browser* browser, const GURL& url) { if (!browser->is_type_tabbed()) return NULL; diff --git a/chrome/browser/tabs/tab_finder.h b/chrome/browser/tabs/tab_finder.h index 5e4cebb..8824b6b 100644 --- a/chrome/browser/tabs/tab_finder.h +++ b/chrome/browser/tabs/tab_finder.h @@ -18,7 +18,6 @@ class Browser; class GURL; -class TabContents; namespace content { class WebContents; @@ -42,9 +41,9 @@ class TabFinder : public content::NotificationObserver { // Returns the tab that matches the specified url. If a tab is found the // browser containing the tab is set in |existing_browser|. This searches // in |browser| first before checking any other browsers. - TabContents* FindTab(Browser* browser, - const GURL& url, - Browser** existing_browser); + content::WebContents* FindTab(Browser* browser, + const GURL& url, + Browser** existing_browser); // content::NotificationObserver overrides: virtual void Observe(int type, @@ -64,7 +63,7 @@ class TabFinder : public content::NotificationObserver { // Forwarded from WebContentsObserverImpl. void DidNavigateAnyFrame( - content::WebContents* source, + content::WebContents* source, const content::LoadCommittedDetails& details, const content::FrameNavigateParams& params); @@ -74,13 +73,13 @@ class TabFinder : public content::NotificationObserver { // Returns the first tab in the specified browser that matches the specified // url. Returns NULL if there are no tabs matching the specified url. - TabContents* FindTabInBrowser(Browser* browser, const GURL& url); + content::WebContents* FindTabInBrowser(Browser* browser, const GURL& url); // If we're not currently tracking |tab| this creates a // WebContentsObserverImpl to listen for navigations. void TrackTab(content::WebContents* tab); - // Invoked when a TabContents is being destroyed. + // Invoked when a WebContents is being destroyed. void TabDestroyed(WebContentsObserverImpl* observer); // Cancels any pending requests for the specified tabs redirect chain. diff --git a/chrome/browser/task_manager/task_manager_resource_providers.cc b/chrome/browser/task_manager/task_manager_resource_providers.cc index d38ad1b..50ac984 100644 --- a/chrome/browser/task_manager/task_manager_resource_providers.cc +++ b/chrome/browser/task_manager/task_manager_resource_providers.cc @@ -388,7 +388,7 @@ void TaskManagerTabContentsResourceProvider::StartUpdating() { // Then we register for notifications to get new tabs. registrar_.Add(this, content::NOTIFICATION_TAB_CONTENTS_CONNECTED, content::NotificationService::AllBrowserContextsAndSources()); - registrar_.Add(this, content::NOTIFICATION_TAB_CONTENTS_SWAPPED, + registrar_.Add(this, content::NOTIFICATION_WEB_CONTENTS_SWAPPED, content::NotificationService::AllBrowserContextsAndSources()); registrar_.Add(this, content::NOTIFICATION_WEB_CONTENTS_DISCONNECTED, content::NotificationService::AllBrowserContextsAndSources()); @@ -411,7 +411,7 @@ void TaskManagerTabContentsResourceProvider::StopUpdating() { this, content::NOTIFICATION_TAB_CONTENTS_CONNECTED, content::NotificationService::AllBrowserContextsAndSources()); registrar_.Remove( - this, content::NOTIFICATION_TAB_CONTENTS_SWAPPED, + this, content::NOTIFICATION_WEB_CONTENTS_SWAPPED, content::NotificationService::AllBrowserContextsAndSources()); registrar_.Remove( this, content::NOTIFICATION_WEB_CONTENTS_DISCONNECTED, @@ -500,7 +500,8 @@ void TaskManagerTabContentsResourceProvider::Observe(int type, TabContentsWrapper* tab_contents; if (type == chrome::NOTIFICATION_INSTANT_COMMITTED) { tab_contents = content::Source<TabContentsWrapper>(source).ptr(); - } else if (type == content::NOTIFICATION_WEB_CONTENTS_DESTROYED) { + } else if (type == content::NOTIFICATION_WEB_CONTENTS_DESTROYED || + type == content::NOTIFICATION_WEB_CONTENTS_SWAPPED) { WebContents* web_contents = content::Source<WebContents>(source).ptr(); tab_contents = TabContentsWrapper::GetCurrentWrapperForContents( web_contents); @@ -515,7 +516,7 @@ void TaskManagerTabContentsResourceProvider::Observe(int type, case content::NOTIFICATION_TAB_CONTENTS_CONNECTED: Add(tab_contents); break; - case content::NOTIFICATION_TAB_CONTENTS_SWAPPED: + case content::NOTIFICATION_WEB_CONTENTS_SWAPPED: Remove(tab_contents); Add(tab_contents); break; diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc index 1a867ba..796f469 100644 --- a/chrome/browser/ui/browser.cc +++ b/chrome/browser/ui/browser.cc @@ -973,7 +973,7 @@ SkBitmap Browser::GetCurrentPageIcon() const { } string16 Browser::GetWindowTitleForCurrentTab() const { - TabContents* contents = GetSelectedTabContents(); + WebContents* contents = GetSelectedWebContents(); string16 title; // |contents| can be NULL because GetWindowTitleForCurrentTab is called by the @@ -1080,7 +1080,7 @@ void Browser::OnWindowClosing() { void Browser::OnWindowActivated() { // On some platforms we want to automatically reload tabs that are // killed when the user selects them. - TabContents* contents = GetSelectedTabContents(); + WebContents* contents = GetSelectedWebContents(); if (contents && contents->GetCrashedStatus() == base::TERMINATION_STATUS_PROCESS_WAS_KILLED) { if (CommandLine::ForCurrentProcess()->HasSwitch( @@ -1187,6 +1187,11 @@ TabContentsWrapper* Browser::GetSelectedTabContentsWrapper() const { return tabstrip_model()->GetActiveTabContents(); } +WebContents* Browser::GetSelectedWebContents() const { + TabContentsWrapper* wrapper = GetSelectedTabContentsWrapper(); + return wrapper ? wrapper->web_contents() : NULL; +} + TabContentsWrapper* Browser::GetTabContentsWrapperAt(int index) const { return tabstrip_model()->GetTabContentsAt(index); } @@ -1407,7 +1412,7 @@ void Browser::ShowSingletonTabRespectRef(const GURL& url) { void Browser::ShowSingletonTabOverwritingNTP( const browser::NavigateParams& params) { browser::NavigateParams local_params(params); - TabContents* contents = GetSelectedTabContents(); + WebContents* contents = GetSelectedWebContents(); if (contents) { const GURL& contents_url = contents->GetURL(); if ((contents_url == GURL(chrome::kChromeUINewTabURL) || @@ -1547,7 +1552,7 @@ void Browser::ReloadIgnoringCache(WindowOpenDisposition disposition) { void Browser::ReloadInternal(WindowOpenDisposition disposition, bool ignore_cache) { // If we are showing an interstitial, treat this as an OpenURL. - TabContents* current_tab = GetSelectedTabContents(); + WebContents* current_tab = GetSelectedWebContents(); if (current_tab && current_tab->ShowingInterstitialPage()) { NavigationEntry* entry = current_tab->GetController().GetActiveEntry(); DCHECK(entry); // Should exist if interstitial is showing. @@ -1592,7 +1597,7 @@ void Browser::OpenCurrentURL() { if (open_disposition == CURRENT_TAB && TabFinder::IsEnabled()) { Browser* existing_browser = NULL; - TabContents* existing_tab = TabFinder::GetInstance()->FindTab( + WebContents* existing_tab = TabFinder::GetInstance()->FindTab( this, url, &existing_browser); if (existing_tab) { existing_browser->ActivateContents(existing_tab); @@ -1747,7 +1752,7 @@ void Browser::WriteCurrentURLToClipboard() { // We don't appear to track the action when it comes from the // RenderContextViewMenu. - TabContents* contents = GetSelectedTabContents(); + WebContents* contents = GetSelectedWebContents(); if (!toolbar_model_.ShouldDisplayURL()) return; @@ -1791,7 +1796,7 @@ void Browser::Search() { return; } - const GURL& url = GetSelectedTabContents()->GetURL(); + const GURL& url = GetSelectedWebContents()->GetURL(); if (url.SchemeIs(chrome::kChromeUIScheme) && url.host() == chrome::kChromeUINewTabHost) { // If the NTP is showing, focus the omnibox. @@ -1841,10 +1846,10 @@ void Browser::BookmarkCurrentPage() { void Browser::SavePage() { content::RecordAction(UserMetricsAction("SavePage")); - TabContents* current_tab = GetSelectedTabContents(); + WebContents* current_tab = GetSelectedWebContents(); if (current_tab && current_tab->GetContentsMimeType() == "application/pdf") content::RecordAction(UserMetricsAction("PDF.SavePage")); - GetSelectedTabContents()->OnSavePage(); + GetSelectedWebContents()->OnSavePage(); } void Browser::ViewSelectedSource() { @@ -1865,12 +1870,12 @@ bool Browser::CanSupportWindowFeature(WindowFeature feature) const { void Browser::EmailPageLocation() { content::RecordAction(UserMetricsAction("EmailPageLocation")); - TabContents* tc = GetSelectedTabContents(); - DCHECK(tc); + WebContents* wc = GetSelectedWebContents(); + DCHECK(wc); std::string title = net::EscapeQueryParamValue( - UTF16ToUTF8(tc->GetTitle()), false); - std::string page_url = net::EscapeQueryParamValue(tc->GetURL().spec(), false); + UTF16ToUTF8(wc->GetTitle()), false); + std::string page_url = net::EscapeQueryParamValue(wc->GetURL().spec(), false); std::string mailto = std::string("mailto:?subject=Fwd:%20") + title + "&body=%0A%0A" + page_url; platform_util::OpenExternal(GURL(mailto)); @@ -1895,7 +1900,7 @@ void Browser::ToggleEncodingAutoDetect() { // OTOH, if "auto detect" is turned off, we don't change the currently // active encoding. if (encoding_auto_detect_.GetValue()) { - TabContents* contents = GetSelectedTabContents(); + WebContents* contents = GetSelectedWebContents(); if (contents) contents->ResetOverrideEncoding(); } @@ -1905,7 +1910,7 @@ void Browser::OverrideEncoding(int encoding_id) { content::RecordAction(UserMetricsAction("OverrideEncoding")); const std::string selected_encoding = CharacterEncoding::GetCanonicalEncodingNameByCommandId(encoding_id); - TabContents* contents = GetSelectedTabContents(); + WebContents* contents = GetSelectedWebContents(); if (!selected_encoding.empty() && contents) contents->SetOverrideEncoding(selected_encoding); // Update the list of recently selected encodings. @@ -1961,7 +1966,7 @@ void Browser::Zoom(content::PageZoom zoom) { return; } - double current_zoom_level = GetSelectedTabContents()->GetZoomLevel(); + double current_zoom_level = GetSelectedWebContents()->GetZoomLevel(); double default_zoom_level = profile_->GetPrefs()->GetDouble(prefs::kDefaultZoomLevel); @@ -2056,7 +2061,7 @@ void Browser::OpenFile() { select_file_dialog_->SelectFile(SelectFileDialog::SELECT_OPEN_FILE, string16(), directory, NULL, 0, FILE_PATH_LITERAL(""), - GetSelectedTabContents(), + GetSelectedWebContents(), parent_window, NULL); } @@ -3535,7 +3540,7 @@ void Browser::LoadingStateChanged(WebContents* source) { tab_handler_->GetTabStripModel()->TabsAreLoading()); window_->UpdateTitleBar(); - WebContents* selected_contents = GetSelectedTabContents(); + WebContents* selected_contents = GetSelectedWebContents(); if (source == selected_contents) { bool is_loading = source->IsLoading(); UpdateReloadStopState(is_loading, false); @@ -3604,7 +3609,7 @@ void Browser::ContentsMouseEvent( if (!GetStatusBubble()) return; - if (source == GetSelectedTabContents()) { + if (source == GetSelectedWebContents()) { GetStatusBubble()->MouseMoved(location, !motion); if (!motion) GetStatusBubble()->SetURL(GURL(), std::string()); @@ -3618,7 +3623,7 @@ void Browser::UpdateTargetURL(WebContents* source, int32 page_id, if (!GetStatusBubble()) return; - if (source == GetSelectedTabContents()) { + if (source == GetSelectedWebContents()) { PrefService* prefs = profile_->GetPrefs(); GetStatusBubble()->SetURL(url, prefs->GetString(prefs::kAcceptLanguages)); } @@ -3882,12 +3887,12 @@ void Browser::WorkerCrashed(WebContents* source) { } void Browser::DidNavigateMainFramePostCommit(WebContents* tab) { - if (tab == GetSelectedTabContents()) + if (tab == GetSelectedWebContents()) UpdateBookmarkBarState(BOOKMARK_BAR_STATE_CHANGE_TAB_STATE); } void Browser::DidNavigateToPendingEntry(WebContents* tab) { - if (tab == GetSelectedTabContents()) + if (tab == GetSelectedWebContents()) UpdateBookmarkBarState(BOOKMARK_BAR_STATE_CHANGE_TAB_STATE); } @@ -4109,8 +4114,8 @@ void Browser::Observe(int type, // (NavigationControllers) for convenience, so the notification could // actually be for a different window while we're doing asynchronous // closing of this one. - if (GetSelectedTabContents() && - &GetSelectedTabContents()->GetController() == + if (GetSelectedWebContents() && + &GetSelectedWebContents()->GetController() == content::Source<NavigationController>(source).ptr()) UpdateToolbar(false); break; @@ -4222,7 +4227,7 @@ void Browser::Observe(int type, case chrome::NOTIFICATION_WEB_CONTENT_SETTINGS_CHANGED: { WebContents* web_contents = content::Source<WebContents>(source).ptr(); - if (web_contents == GetSelectedTabContents()) { + if (web_contents == GetSelectedWebContents()) { LocationBar* location_bar = window()->GetLocationBar(); if (location_bar) location_bar->UpdateContentSettingsIcons(); @@ -4263,16 +4268,16 @@ void Browser::ShowInstant(TabContentsWrapper* preview_contents) { DCHECK(instant_->tab_contents() == GetSelectedTabContentsWrapper()); window_->ShowInstant(preview_contents); - GetSelectedTabContents()->HideContents(); - preview_contents->tab_contents()->ShowContents(); + GetSelectedWebContents()->HideContents(); + preview_contents->web_contents()->ShowContents(); } void Browser::HideInstant() { window_->HideInstant(); - if (GetSelectedTabContents()) - GetSelectedTabContents()->ShowContents(); + if (GetSelectedWebContents()) + GetSelectedWebContents()->ShowContents(); if (instant_->GetPreviewContents()) - instant_->GetPreviewContents()->tab_contents()->HideContents(); + instant_->GetPreviewContents()->web_contents()->HideContents(); } void Browser::CommitInstant(TabContentsWrapper* preview_contents) { @@ -4592,7 +4597,7 @@ void Browser::UpdateCommandsForFullscreenMode(bool is_fullscreen) { } void Browser::UpdateCommandsForTabState() { - TabContents* current_tab = GetSelectedTabContents(); + WebContents* current_tab = GetSelectedWebContents(); TabContentsWrapper* current_tab_wrapper = GetSelectedTabContentsWrapper(); if (!current_tab || !current_tab_wrapper) // May be NULL during tab restore. return; @@ -4756,7 +4761,7 @@ void Browser::ScheduleUIUpdate(const WebContents* source, // Do some synchronous updates. if (changed_flags & TabContents::INVALIDATE_URL && - source == GetSelectedTabContents()) { + source == GetSelectedWebContents()) { // Only update the URL for the current tab. Note that we do not update // the navigation commands since those would have already been updated // synchronously by NavigationStateChanged. @@ -4830,7 +4835,7 @@ void Browser::ProcessPendingUIUpdates() { const WebContents* contents = i->first; unsigned flags = i->second; - if (contents == GetSelectedTabContents()) { + if (contents == GetSelectedWebContents()) { // Updates that only matter when the tab is selected go here. if (flags & TabContents::INVALIDATE_PAGE_ACTIONS) { @@ -5290,7 +5295,7 @@ void Browser::ViewSource(TabContentsWrapper* contents, int Browser::GetContentRestrictionsForSelectedTab() { int content_restrictions = 0; - TabContents* current_tab = GetSelectedTabContents(); + WebContents* current_tab = GetSelectedWebContents(); if (current_tab) { content_restrictions = current_tab->GetContentRestrictions(); NavigationEntry* active_entry = @@ -5366,7 +5371,7 @@ void Browser::OnWindowDidShow() { return; // Suppress the first run bubble if we're showing the sync promo. - TabContents* contents = GetSelectedTabContents(); + WebContents* contents = GetSelectedWebContents(); bool is_showing_promo = contents && contents->GetURL().SchemeIs(chrome::kChromeUIScheme) && contents->GetURL().host() == chrome::kChromeUISyncPromoHost; diff --git a/chrome/browser/ui/browser.h b/chrome/browser/ui/browser.h index 92494e0..62a8f14 100644 --- a/chrome/browser/ui/browser.h +++ b/chrome/browser/ui/browser.h @@ -387,6 +387,8 @@ class Browser : public TabHandlerDelegate, // TODO(dpapad): Rename to GetActiveTabContentsWrapper(). TabContentsWrapper* GetSelectedTabContentsWrapper() const; + // A convenient version of the above which returns the TCW's WebContents. + content::WebContents* GetSelectedWebContents() const; TabContentsWrapper* GetTabContentsWrapperAt(int index) const; // Same as above but correctly handles if GetSelectedTabContents() is NULL // in the model before dereferencing to get the raw TabContents. diff --git a/chrome/browser/ui/browser_browsertest.cc b/chrome/browser/ui/browser_browsertest.cc index 99fbfa5..50b2350 100644 --- a/chrome/browser/ui/browser_browsertest.cc +++ b/chrome/browser/ui/browser_browsertest.cc @@ -152,7 +152,7 @@ void RunCloseWithAppMenuCallback(Browser* browser) { // to visually tell if it is showing or not.) class TestInterstitialPage : public InterstitialPage { public: - TestInterstitialPage(TabContents* tab, bool new_navigation, const GURL& url) + TestInterstitialPage(WebContents* tab, bool new_navigation, const GURL& url) : InterstitialPage(tab, new_navigation, url) { } virtual ~TestInterstitialPage() { } @@ -288,10 +288,10 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, ReloadThenCancelBeforeUnload) { browser()->Reload(CURRENT_TAB); AppModalDialog* alert = ui_test_utils::WaitForAppModalDialog(); alert->CloseModalDialog(); - EXPECT_FALSE(browser()->GetSelectedTabContents()->IsLoading()); + EXPECT_FALSE(browser()->GetSelectedWebContents()->IsLoading()); // Clear the beforeunload handler so the test can easily exit. - browser()->GetSelectedTabContents()->GetRenderViewHost()-> + browser()->GetSelectedWebContents()->GetRenderViewHost()-> ExecuteJavascriptInWebFrame(string16(), ASCIIToUTF16("onbeforeunload=null;")); } @@ -316,7 +316,7 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, CancelBeforeUnloadResetsURL) { // Cancel the dialog. AppModalDialog* alert = ui_test_utils::WaitForAppModalDialog(); alert->CloseModalDialog(); - EXPECT_FALSE(browser()->GetSelectedTabContents()->IsLoading()); + EXPECT_FALSE(browser()->GetSelectedWebContents()->IsLoading()); // Wait for the ShouldClose_ACK to arrive. We can detect it by waiting for // the pending RVH to be destroyed. @@ -324,7 +324,7 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, CancelBeforeUnloadResetsURL) { EXPECT_EQ(url.spec(), UTF16ToUTF8(browser()->toolbar_model()->GetText())); // Clear the beforeunload handler so the test can easily exit. - browser()->GetSelectedTabContents()->GetRenderViewHost()-> + browser()->GetSelectedWebContents()->GetRenderViewHost()-> ExecuteJavascriptInWebFrame(string16(), ASCIIToUTF16("onbeforeunload=null;")); } @@ -341,7 +341,7 @@ 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) { - browser()->GetSelectedTabContents()->GetRenderViewHost()-> + browser()->GetSelectedWebContents()->GetRenderViewHost()-> ExecuteJavascriptInWebFrame(string16(), ASCIIToUTF16(kOpenNewBeforeUnloadPage)); @@ -379,7 +379,7 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, NullOpenerRedirectForksProcess) { // Start with an http URL. ui_test_utils::NavigateToURL(browser(), http_url); - TabContents* oldtab = browser()->GetSelectedTabContents(); + WebContents* oldtab = browser()->GetSelectedWebContents(); content::RenderProcessHost* process = oldtab->GetRenderProcessHost(); // Now open a tab to a blank page, set its opener to null, and redirect it @@ -402,7 +402,7 @@ 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()); - TabContents* newtab = browser()->GetSelectedTabContents(); + WebContents* newtab = browser()->GetSelectedWebContents(); EXPECT_TRUE(newtab); EXPECT_NE(oldtab, newtab); nav_observer.Wait(); @@ -436,7 +436,7 @@ 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()); - TabContents* newtab2 = browser()->GetSelectedTabContents(); + WebContents* newtab2 = browser()->GetSelectedWebContents(); EXPECT_TRUE(newtab2); EXPECT_NE(oldtab, newtab2); nav_observer2.Wait(); @@ -467,7 +467,7 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, OtherRedirectsDontForkProcess) { // Start with an http URL. ui_test_utils::NavigateToURL(browser(), http_url); - TabContents* oldtab = browser()->GetSelectedTabContents(); + WebContents* oldtab = browser()->GetSelectedWebContents(); content::RenderProcessHost* process = oldtab->GetRenderProcessHost(); // Now open a tab to a blank page, set its opener to null, and redirect it @@ -489,7 +489,7 @@ 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()); - TabContents* newtab = browser()->GetSelectedTabContents(); + WebContents* newtab = browser()->GetSelectedWebContents(); EXPECT_TRUE(newtab); EXPECT_NE(oldtab, newtab); nav_observer.Wait(); @@ -669,7 +669,7 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, ui_test_utils::NavigateToURL(browser(), url); - NavigationEntry* entry = browser()->GetSelectedTabContents()-> + NavigationEntry* entry = browser()->GetSelectedWebContents()-> GetController().GetActiveEntry(); EXPECT_EQ(expected_favicon_url.spec(), entry->GetFavicon().url.spec()); } @@ -689,7 +689,7 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, MAYBE_FaviconChange) { ASSERT_TRUE(file_url.SchemeIs(chrome::kFileScheme)); ui_test_utils::NavigateToURL(browser(), file_url); - NavigationEntry* entry = browser()->GetSelectedTabContents()-> + NavigationEntry* entry = browser()->GetSelectedWebContents()-> GetController().GetActiveEntry(); static const FilePath::CharType* kIcon = FILE_PATH_LITERAL("test1.png"); @@ -793,7 +793,7 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, MAYBE_PageLanguageDetection) { AddTabAtIndex(0, GURL(test_server()->GetURL("files/english_page.html")), content::PAGE_TRANSITION_TYPED); - TabContents* current_tab = browser()->GetSelectedTabContents(); + WebContents* current_tab = browser()->GetSelectedWebContents(); TabContentsWrapper* wrapper = browser()->GetSelectedTabContentsWrapper(); TranslateTabHelper* helper = wrapper->translate_tab_helper(); content::Source<WebContents> source(current_tab); @@ -835,7 +835,7 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, MAYBE_TestNewTabExitsFullscreen) { AddTabAtIndex( 0, GURL(chrome::kAboutBlankURL), content::PAGE_TRANSITION_TYPED); - TabContents* fullscreen_tab = browser()->GetSelectedTabContents(); + WebContents* fullscreen_tab = browser()->GetSelectedWebContents(); { ui_test_utils::WindowedNotificationObserver fullscreen_observer( @@ -871,7 +871,7 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, MAYBE_TestTabExitsItselfFromFullscreen) { AddTabAtIndex( 0, GURL(chrome::kAboutBlankURL), content::PAGE_TRANSITION_TYPED); - TabContents* fullscreen_tab = browser()->GetSelectedTabContents(); + WebContents* fullscreen_tab = browser()->GetSelectedWebContents(); { ui_test_utils::WindowedNotificationObserver fullscreen_observer( @@ -900,7 +900,7 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, TestFullscreenBubbleMouseLockState) { AddTabAtIndex(1, GURL(chrome::kAboutBlankURL), content::PAGE_TRANSITION_TYPED); - TabContents* fullscreen_tab = browser()->GetSelectedTabContents(); + WebContents* fullscreen_tab = browser()->GetSelectedWebContents(); { ui_test_utils::WindowedNotificationObserver fullscreen_observer( @@ -932,7 +932,7 @@ IN_PROC_BROWSER_TEST_F( AddTabAtIndex( 0, GURL(chrome::kAboutBlankURL), content::PAGE_TRANSITION_TYPED); - TabContents* fullscreen_tab = browser()->GetSelectedTabContents(); + WebContents* fullscreen_tab = browser()->GetSelectedWebContents(); { ui_test_utils::WindowedNotificationObserver fullscreen_observer( @@ -1159,7 +1159,7 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, ForwardDisabledOnForward) { ui_test_utils::WindowedNotificationObserver back_nav_load_observer( content::NOTIFICATION_LOAD_STOP, content::Source<NavigationController>( - &browser()->GetSelectedTabContents()->GetController())); + &browser()->GetSelectedWebContents()->GetController())); browser()->GoBack(CURRENT_TAB); back_nav_load_observer.Wait(); EXPECT_TRUE(browser()->command_updater()->IsCommandEnabled(IDC_FORWARD)); @@ -1167,7 +1167,7 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, ForwardDisabledOnForward) { ui_test_utils::WindowedNotificationObserver forward_nav_load_observer( content::NOTIFICATION_LOAD_STOP, content::Source<NavigationController>( - &browser()->GetSelectedTabContents()->GetController())); + &browser()->GetSelectedWebContents()->GetController())); browser()->GoForward(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. @@ -1305,7 +1305,7 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, } IN_PROC_BROWSER_TEST_F(BrowserTest, PageZoom) { - TabContents* contents = browser()->GetSelectedTabContents(); + WebContents* contents = browser()->GetSelectedWebContents(); bool enable_plus, enable_minus; ui_test_utils::WindowedNotificationObserver zoom_in_observer( @@ -1350,7 +1350,7 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, InterstitialCommandDisable) { EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_SAVE_PAGE)); EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_ENCODING_MENU)); - TabContents* contents = browser()->GetSelectedTabContents(); + WebContents* contents = browser()->GetSelectedWebContents(); TestInterstitialPage* interstitial = new TestInterstitialPage( contents, false, GURL()); diff --git a/chrome/browser/ui/browser_close_browsertest.cc b/chrome/browser/ui/browser_close_browsertest.cc index e06103c..ad9f4a6 100644 --- a/chrome/browser/ui/browser_close_browsertest.cc +++ b/chrome/browser/ui/browser_close_browsertest.cc @@ -173,7 +173,7 @@ class BrowserCloseTest : public InProcessBrowserTest { new_browser->AddSelectedTabWithURL(GURL(chrome::kAboutBlankURL), content::PAGE_TRANSITION_START_PAGE); ui_test_utils::WaitForLoadStop( - new_browser->GetSelectedTabContents()); + new_browser->GetSelectedWebContents()); new_browser->window()->Show(); return new_browser; } diff --git a/chrome/browser/ui/browser_init.cc b/chrome/browser/ui/browser_init.cc index d88a63a..13607ef 100644 --- a/chrome/browser/ui/browser_init.cc +++ b/chrome/browser/ui/browser_init.cc @@ -1210,7 +1210,7 @@ Browser* BrowserInit::LaunchWithProfile::OpenTabsInBrowser( browser->window()->Show(); // TODO(jcampan): http://crbug.com/8123 we should not need to set the initial // focus explicitly. - browser->GetSelectedTabContents()->GetView()->SetInitialFocus(); + browser->GetSelectedWebContents()->GetView()->SetInitialFocus(); return browser; } diff --git a/chrome/browser/ui/browser_navigator_browsertest.cc b/chrome/browser/ui/browser_navigator_browsertest.cc index ba003835..ea8a2d3 100644 --- a/chrome/browser/ui/browser_navigator_browsertest.cc +++ b/chrome/browser/ui/browser_navigator_browsertest.cc @@ -26,6 +26,8 @@ #include "content/public/browser/notification_service.h" #include "content/public/browser/notification_types.h" +using content::WebContents; + namespace { GURL GetGoogleURL() { @@ -91,7 +93,7 @@ TabContentsWrapper* BrowserNavigatorTest::CreateTabContents() { } void BrowserNavigatorTest::RunSuppressTest(WindowOpenDisposition disposition) { - GURL old_url = browser()->GetSelectedTabContents()->GetURL(); + GURL old_url = browser()->GetSelectedWebContents()->GetURL(); browser::NavigateParams p(MakeNavigateParams()); p.disposition = disposition; browser::Navigate(&p); @@ -99,7 +101,7 @@ void BrowserNavigatorTest::RunSuppressTest(WindowOpenDisposition disposition) { // Nothing should have happened as a result of Navigate(); EXPECT_EQ(1, browser()->tab_count()); EXPECT_EQ(1u, BrowserList::size()); - EXPECT_EQ(old_url, browser()->GetSelectedTabContents()->GetURL()); + EXPECT_EQ(old_url, browser()->GetSelectedWebContents()->GetURL()); } void BrowserNavigatorTest::RunUseNonIncognitoWindowTest(const GURL& url) { @@ -120,7 +122,7 @@ void BrowserNavigatorTest::RunUseNonIncognitoWindowTest(const GURL& url) { EXPECT_NE(incognito_browser, p.browser); EXPECT_EQ(browser(), p.browser); EXPECT_EQ(2, browser()->tab_count()); - EXPECT_EQ(url, browser()->GetSelectedTabContents()->GetURL()); + EXPECT_EQ(url, browser()->GetSelectedWebContents()->GetURL()); } void BrowserNavigatorTest::RunDoNothingIfIncognitoIsForcedTest( @@ -146,7 +148,7 @@ void BrowserNavigatorTest::RunDoNothingIfIncognitoIsForcedTest( EXPECT_EQ(browser, p.browser); EXPECT_EQ(1, browser->tab_count()); EXPECT_EQ(GURL(chrome::kAboutBlankURL), - browser->GetSelectedTabContents()->GetURL()); + browser->GetSelectedWebContents()->GetURL()); } void BrowserNavigatorTest::Observe( @@ -170,7 +172,7 @@ 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(), browser()->GetSelectedTabContents()->GetURL()); + EXPECT_EQ(GetGoogleURL(), browser()->GetSelectedWebContents()->GetURL()); // We should have one window with one tab. EXPECT_EQ(1u, BrowserList::size()); EXPECT_EQ(1, browser()->tab_count()); @@ -291,11 +293,11 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, // tab count of the Browser increases and the selected tab shifts to the new // foreground tab. IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, Disposition_NewForegroundTab) { - TabContents* old_contents = browser()->GetSelectedTabContents(); + WebContents* old_contents = browser()->GetSelectedWebContents(); browser::NavigateParams p(MakeNavigateParams()); p.disposition = NEW_FOREGROUND_TAB; browser::Navigate(&p); - EXPECT_NE(old_contents, browser()->GetSelectedTabContents()); + EXPECT_NE(old_contents, browser()->GetSelectedWebContents()); EXPECT_EQ(browser()->GetSelectedTabContentsWrapper(), p.target_contents); EXPECT_EQ(2, browser()->tab_count()); } @@ -303,11 +305,11 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, Disposition_NewForegroundTab) { // 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) { - TabContents* old_contents = browser()->GetSelectedTabContents(); + WebContents* old_contents = browser()->GetSelectedWebContents(); browser::NavigateParams p(MakeNavigateParams()); p.disposition = NEW_BACKGROUND_TAB; browser::Navigate(&p); - TabContents* new_contents = browser()->GetSelectedTabContents(); + WebContents* new_contents = browser()->GetSelectedWebContents(); // The selected tab should have remained unchanged, since the new tab was // opened in the background. EXPECT_EQ(old_contents, new_contents); @@ -698,7 +700,7 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, Tabstrip_InsertAtIndex) { // the same result as navigating to a new foreground tab in the (only) // active browser. Tests are the same as for Disposition_NewForegroundTab. IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, NullBrowser_NewForegroundTab) { - TabContents* old_contents = browser()->GetSelectedTabContents(); + WebContents* old_contents = browser()->GetSelectedWebContents(); // Navigate with a NULL browser. browser::NavigateParams p(MakeNavigateParams(NULL)); p.disposition = NEW_FOREGROUND_TAB; @@ -707,7 +709,7 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, NullBrowser_NewForegroundTab) { // Navigate() should have found browser() and create a new tab. EXPECT_EQ(browser(), p.browser); - EXPECT_NE(old_contents, browser()->GetSelectedTabContents()); + EXPECT_NE(old_contents, browser()->GetSelectedWebContents()); EXPECT_EQ(browser()->GetSelectedTabContentsWrapper(), p.target_contents); EXPECT_EQ(2, browser()->tab_count()); } @@ -777,7 +779,7 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, EXPECT_EQ(3, browser()->tab_count()); EXPECT_EQ(2, browser()->active_index()); EXPECT_EQ(GetSettingsAdvancedURL(), - browser()->GetSelectedTabContents()->GetURL()); + browser()->GetSelectedWebContents()->GetURL()); } // This test verifies that constructing params with disposition = SINGLETON_TAB @@ -810,7 +812,7 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, EXPECT_EQ(3, browser()->tab_count()); EXPECT_EQ(1, browser()->active_index()); EXPECT_EQ(GetSettingsAdvancedURL(), - browser()->GetSelectedTabContents()->GetURL()); + browser()->GetSelectedWebContents()->GetURL()); } // This test verifies that constructing params with disposition = SINGLETON_TAB @@ -843,7 +845,7 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, EXPECT_EQ(3, browser()->tab_count()); EXPECT_EQ(1, browser()->active_index()); EXPECT_EQ(GetSettingsPersonalURL(), - browser()->GetSelectedTabContents()->GetURL()); + browser()->GetSelectedWebContents()->GetURL()); } // This test verifies that constructing params with disposition = SINGLETON_TAB @@ -875,7 +877,7 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, EXPECT_EQ(3, browser()->tab_count()); EXPECT_EQ(1, browser()->active_index()); EXPECT_EQ(singleton_url1, - browser()->GetSelectedTabContents()->GetURL()); + browser()->GetSelectedWebContents()->GetURL()); } // This test verifies that constructing params with disposition = SINGLETON_TAB @@ -906,7 +908,7 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, EXPECT_EQ(2, browser()->tab_count()); EXPECT_EQ(1, browser()->active_index()); EXPECT_EQ(singleton_url_target, - browser()->GetSelectedTabContents()->GetURL()); + browser()->GetSelectedWebContents()->GetURL()); } // This test verifies that constructing params with disposition = SINGLETON_TAB @@ -963,7 +965,7 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, EXPECT_EQ(1u, BrowserList::size()); EXPECT_EQ(GURL("chrome://settings"), - browser()->GetSelectedTabContents()->GetURL().GetOrigin()); + browser()->GetSelectedWebContents()->GetURL().GetOrigin()); } // Settings page is expected to always open in normal mode regardless @@ -1046,7 +1048,7 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, } EXPECT_EQ(1, browser()->tab_count()); EXPECT_EQ(GetSettingsURL(), - browser()->GetSelectedTabContents()->GetURL().GetOrigin()); + browser()->GetSelectedWebContents()->GetURL().GetOrigin()); } IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, @@ -1064,7 +1066,7 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, } EXPECT_EQ(1, browser()->tab_count()); EXPECT_EQ(GetSettingsURL(), - browser()->GetSelectedTabContents()->GetURL().GetOrigin()); + browser()->GetSelectedWebContents()->GetURL().GetOrigin()); } IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, @@ -1074,7 +1076,7 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, ui_test_utils::NavigateToURL(&p); EXPECT_EQ(1, browser()->tab_count()); EXPECT_EQ(GURL(chrome::kChromeUINewTabURL), - browser()->GetSelectedTabContents()->GetURL()); + browser()->GetSelectedWebContents()->GetURL()); { ui_test_utils::WindowedNotificationObserver observer( @@ -1085,14 +1087,14 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, } EXPECT_EQ(1, browser()->tab_count()); EXPECT_EQ(GetSettingsURL(), - browser()->GetSelectedTabContents()->GetURL().GetOrigin()); + browser()->GetSelectedWebContents()->GetURL().GetOrigin()); } IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, NavigateFromPageToOptionsInNewTab) { browser::NavigateParams p(MakeNavigateParams()); ui_test_utils::NavigateToURL(&p); - EXPECT_EQ(GetGoogleURL(), browser()->GetSelectedTabContents()->GetURL()); + EXPECT_EQ(GetGoogleURL(), browser()->GetSelectedWebContents()->GetURL()); EXPECT_EQ(1u, BrowserList::size()); EXPECT_EQ(1, browser()->tab_count()); @@ -1105,7 +1107,7 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, } EXPECT_EQ(2, browser()->tab_count()); EXPECT_EQ(GetSettingsURL(), - browser()->GetSelectedTabContents()->GetURL().GetOrigin()); + browser()->GetSelectedWebContents()->GetURL().GetOrigin()); } IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, @@ -1131,7 +1133,7 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, } EXPECT_EQ(2, browser()->tab_count()); EXPECT_EQ(GetSettingsURL(), - browser()->GetSelectedTabContents()->GetURL().GetOrigin()); + browser()->GetSelectedWebContents()->GetURL().GetOrigin()); } IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, @@ -1145,7 +1147,7 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, } EXPECT_EQ(1, browser()->tab_count()); EXPECT_EQ(GetSettingsPersonalURL(), - browser()->GetSelectedTabContents()->GetURL()); + browser()->GetSelectedWebContents()->GetURL()); browser()->NewTab(); EXPECT_EQ(2, browser()->tab_count()); @@ -1159,7 +1161,7 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, } EXPECT_EQ(2, browser()->tab_count()); EXPECT_EQ(GetSettingsPersonalURL(), - browser()->GetSelectedTabContents()->GetURL()); + browser()->GetSelectedWebContents()->GetURL()); } IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, @@ -1189,7 +1191,7 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, } EXPECT_EQ(2, browser()->tab_count()); EXPECT_EQ(GetSettingsURL(), - browser()->GetSelectedTabContents()->GetURL().GetOrigin()); + browser()->GetSelectedWebContents()->GetURL().GetOrigin()); } // Tests that when a new tab is opened from the omnibox, the focus is moved from @@ -1241,7 +1243,7 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, } EXPECT_EQ(1, browser()->tab_count()); EXPECT_EQ(GURL(chrome::kChromeUIHistoryURL), - browser()->GetSelectedTabContents()->GetURL()); + browser()->GetSelectedWebContents()->GetURL()); } IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, @@ -1255,7 +1257,7 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, } EXPECT_EQ(1, browser()->tab_count()); EXPECT_EQ(GURL(chrome::kChromeUIBookmarksURL), - browser()->GetSelectedTabContents()->GetURL()); + browser()->GetSelectedWebContents()->GetURL()); } IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, @@ -1269,7 +1271,7 @@ IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, } EXPECT_EQ(1, browser()->tab_count()); EXPECT_EQ(GURL(chrome::kChromeUIDownloadsURL), - browser()->GetSelectedTabContents()->GetURL()); + browser()->GetSelectedWebContents()->GetURL()); } } // namespace diff --git a/chrome/browser/ui/browser_navigator_browsertest_chromeos.cc b/chrome/browser/ui/browser_navigator_browsertest_chromeos.cc index 085e079..39907a8 100644 --- a/chrome/browser/ui/browser_navigator_browsertest_chromeos.cc +++ b/chrome/browser/ui/browser_navigator_browsertest_chromeos.cc @@ -11,7 +11,7 @@ #include "chrome/browser/ui/browser_list.h" #include "chrome/browser/ui/browser_navigator.h" #include "chrome/test/base/ui_test_utils.h" -#include "content/browser/tab_contents/tab_contents.h" +#include "content/public/browser/web_contents.h" namespace { @@ -54,7 +54,7 @@ IN_PROC_BROWSER_TEST_F(BrowserGuestSessionNavigatorTest, EXPECT_EQ(incognito_browser, p.browser); EXPECT_EQ(2, incognito_browser->tab_count()); EXPECT_EQ(GURL("chrome://settings"), - incognito_browser->GetSelectedTabContents()->GetURL()); + incognito_browser->GetSelectedWebContents()->GetURL()); } // This test verifies that navigating to a large window with diff --git a/chrome/browser/ui/browser_tab_restore_service_delegate.cc b/chrome/browser/ui/browser_tab_restore_service_delegate.cc index 5644175..2a64ba5 100644 --- a/chrome/browser/ui/browser_tab_restore_service_delegate.cc +++ b/chrome/browser/ui/browser_tab_restore_service_delegate.cc @@ -9,6 +9,8 @@ #include "chrome/browser/ui/browser_window.h" #include "content/browser/tab_contents/navigation_controller.h" +using content::WebContents; + void BrowserTabRestoreServiceDelegate::ShowBrowserWindow() { browser_->window()->Show(); } @@ -30,8 +32,8 @@ TabContents* BrowserTabRestoreServiceDelegate::GetTabContentsAt( return browser_->GetTabContentsAt(index); } -TabContents* BrowserTabRestoreServiceDelegate::GetSelectedTabContents() const { - return browser_->GetSelectedTabContents(); +WebContents* BrowserTabRestoreServiceDelegate::GetSelectedWebContents() const { + return browser_->GetSelectedWebContents(); } bool BrowserTabRestoreServiceDelegate::IsTabPinned(int index) const { diff --git a/chrome/browser/ui/browser_tab_restore_service_delegate.h b/chrome/browser/ui/browser_tab_restore_service_delegate.h index 73ac3ec..76bd1bd 100644 --- a/chrome/browser/ui/browser_tab_restore_service_delegate.h +++ b/chrome/browser/ui/browser_tab_restore_service_delegate.h @@ -12,9 +12,6 @@ #include "chrome/browser/sessions/tab_restore_service_delegate.h" class Browser; -class SessionStorageNamespace; -class TabContents; -class TabNavigation; // Implementation of TabRestoreServiceDelegate which uses an instance of // Browser in order to fulfil its duties. @@ -30,7 +27,7 @@ class BrowserTabRestoreServiceDelegate : public TabRestoreServiceDelegate { virtual int GetTabCount() const OVERRIDE; virtual int GetSelectedIndex() const OVERRIDE; virtual TabContents* GetTabContentsAt(int index) const OVERRIDE; - virtual TabContents* GetSelectedTabContents() const OVERRIDE; + virtual content::WebContents* GetSelectedWebContents() const OVERRIDE; virtual bool IsTabPinned(int index) const OVERRIDE; virtual TabContents* AddRestoredTab( const std::vector<TabNavigation>& navigations, diff --git a/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.mm b/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.mm index 40e524e..bacd034 100644 --- a/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.mm +++ b/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.mm @@ -56,6 +56,7 @@ using content::OpenURLParams; using content::Referrer; using content::UserMetricsAction; +using content::WebContents; // Bookmark bar state changing and animations // @@ -2283,8 +2284,8 @@ static BOOL ValueInRangeInclusive(CGFloat low, CGFloat value, CGFloat high) { #pragma mark BookmarkBarToolbarViewController Protocol - (int)currentTabContentsHeight { - TabContents* tc = browser_->GetSelectedTabContents(); - return tc ? tc->GetView()->GetContainerSize().height() : 0; + WebContents* wc = browser_->GetSelectedWebContents(); + return wc ? wc->GetView()->GetContainerSize().height() : 0; } - (ui::ThemeProvider*)themeProvider { diff --git a/chrome/browser/ui/cocoa/browser_window_cocoa.mm b/chrome/browser/ui/cocoa/browser_window_cocoa.mm index aaab487..11c9562 100644 --- a/chrome/browser/ui/cocoa/browser_window_cocoa.mm +++ b/chrome/browser/ui/cocoa/browser_window_cocoa.mm @@ -227,7 +227,7 @@ void BrowserWindowCocoa::BookmarkBarStateChanged( void BrowserWindowCocoa::UpdateDevTools() { [controller_ updateDevToolsForContents: - browser_->GetSelectedTabContents()]; + browser_->GetSelectedWebContents()]; } void BrowserWindowCocoa::SetDevToolsDockSide(DevToolsDockSide side) { @@ -609,7 +609,7 @@ NSWindow* BrowserWindowCocoa::window() const { } void BrowserWindowCocoa::UpdateSidebarForContents(TabContents* tab_contents) { - if (tab_contents == browser_->GetSelectedTabContents()) { + if (tab_contents == browser_->GetSelectedWebContents()) { [controller_ updateSidebarForContents:tab_contents]; } } diff --git a/chrome/browser/ui/cocoa/browser_window_controller.h b/chrome/browser/ui/cocoa/browser_window_controller.h index 7414bc3..324351f 100644 --- a/chrome/browser/ui/cocoa/browser_window_controller.h +++ b/chrome/browser/ui/cocoa/browser_window_controller.h @@ -286,7 +286,7 @@ class TabContents; - (BOOL)canAttachConstrainedWindow; // Shows or hides the docked web inspector depending on |contents|'s state. -- (void)updateDevToolsForContents:(TabContents*)contents; +- (void)updateDevToolsForContents:(content::WebContents*)contents; // Specifies whether devtools should dock to right. - (void)setDevToolsDockToRight:(bool)dock_to_right; diff --git a/chrome/browser/ui/cocoa/browser_window_controller.mm b/chrome/browser/ui/cocoa/browser_window_controller.mm index b84a96c..fd6c773 100644 --- a/chrome/browser/ui/cocoa/browser_window_controller.mm +++ b/chrome/browser/ui/cocoa/browser_window_controller.mm @@ -525,8 +525,8 @@ enum { return ![previewableContentsController_ isShowingPreview]; } -- (void)updateDevToolsForContents:(TabContents*)contents { - [devToolsController_ updateDevToolsForTabContents:contents +- (void)updateDevToolsForContents:(WebContents*)contents { + [devToolsController_ updateDevToolsForWebContents:contents withProfile:browser_->profile()]; [devToolsController_ ensureContentsVisible]; } @@ -601,7 +601,7 @@ enum { - (void)windowDidBecomeKey:(NSNotification*)notification { // We need to activate the controls (in the "WebView"). To do this, get the // selected TabContents's RenderWidgetHostViewMac and tell it to activate. - if (TabContents* contents = browser_->GetSelectedTabContents()) { + if (WebContents* contents = browser_->GetSelectedWebContents()) { if (RenderWidgetHostView* rwhv = contents->GetRenderWidgetHostView()) rwhv->SetActive(true); } @@ -618,7 +618,7 @@ enum { // We need to deactivate the controls (in the "WebView"). To do this, get the // selected TabContents's RenderWidgetHostView and tell it to deactivate. - if (TabContents* contents = browser_->GetSelectedTabContents()) { + if (WebContents* contents = browser_->GetSelectedWebContents()) { if (RenderWidgetHostView* rwhv = contents->GetRenderWidgetHostView()) rwhv->SetActive(false); } @@ -629,7 +629,7 @@ enum { [self saveWindowPositionIfNeeded]; // Let the selected RenderWidgetHostView know, so that it can tell plugins. - if (TabContents* contents = browser_->GetSelectedTabContents()) { + if (WebContents* contents = browser_->GetSelectedWebContents()) { if (RenderWidgetHostView* rwhv = contents->GetRenderWidgetHostView()) rwhv->SetWindowVisibility(false); } @@ -638,7 +638,7 @@ enum { // Called when we have been unminimized. - (void)windowDidDeminiaturize:(NSNotification *)notification { // Let the selected RenderWidgetHostView know, so that it can tell plugins. - if (TabContents* contents = browser_->GetSelectedTabContents()) { + if (WebContents* contents = browser_->GetSelectedWebContents()) { if (RenderWidgetHostView* rwhv = contents->GetRenderWidgetHostView()) rwhv->SetWindowVisibility(true); } @@ -649,7 +649,7 @@ enum { // Let the selected RenderWidgetHostView know, so that it can tell plugins // (unless we are minimized, in which case nothing has really changed). if (![[self window] isMiniaturized]) { - if (TabContents* contents = browser_->GetSelectedTabContents()) { + if (WebContents* contents = browser_->GetSelectedWebContents()) { if (RenderWidgetHostView* rwhv = contents->GetRenderWidgetHostView()) rwhv->SetWindowVisibility(false); } @@ -661,7 +661,7 @@ enum { // Let the selected RenderWidgetHostView know, so that it can tell plugins // (unless we are minimized, in which case nothing has really changed). if (![[self window] isMiniaturized]) { - if (TabContents* contents = browser_->GetSelectedTabContents()) { + if (WebContents* contents = browser_->GetSelectedWebContents()) { if (RenderWidgetHostView* rwhv = contents->GetRenderWidgetHostView()) rwhv->SetWindowVisibility(true); } @@ -706,7 +706,7 @@ enum { std::max(kProportion * frame.size.width, std::min(kProportion * frame.size.height, frame.size.width)); - TabContents* contents = browser_->GetSelectedTabContents(); + WebContents* contents = browser_->GetSelectedWebContents(); if (contents) { // If the intrinsic width is bigger, then make it the zoomed width. const int kScrollbarWidth = 16; // TODO(viettrungluu): ugh. @@ -966,7 +966,7 @@ enum { DCHECK(browser_.get()); Profile* profile = browser_->profile(); DCHECK(profile); - TabContents* current_tab = browser_->GetSelectedTabContents(); + WebContents* current_tab = browser_->GetSelectedWebContents(); if (!current_tab) { return; } @@ -1462,7 +1462,7 @@ enum { } - (NSString*)activeTabTitle { - TabContents* contents = browser_->GetSelectedTabContents(); + WebContents* contents = browser_->GetSelectedWebContents(); return base::SysUTF16ToNSString(contents->GetTitle()); } @@ -1526,7 +1526,7 @@ enum { windowShim_->UpdateTitleBar(); [sidebarController_ updateSidebarForTabContents:contents]; - [devToolsController_ updateDevToolsForTabContents:contents + [devToolsController_ updateDevToolsForWebContents:contents withProfile:browser_->profile()]; // Update the bookmark bar. @@ -1739,7 +1739,7 @@ enum { } // Let the selected RenderWidgetHostView know, so that it can tell plugins. - if (TabContents* contents = browser_->GetSelectedTabContents()) { + if (WebContents* contents = browser_->GetSelectedWebContents()) { if (RenderWidgetHostView* rwhv = contents->GetRenderWidgetHostView()) rwhv->WindowFrameChanged(); } @@ -1795,7 +1795,7 @@ enum { [self resetWindowGrowthState]; // Let the selected RenderWidgetHostView know, so that it can tell plugins. - if (TabContents* contents = browser_->GetSelectedTabContents()) { + if (WebContents* contents = browser_->GetSelectedWebContents()) { if (RenderWidgetHostView* rwhv = contents->GetRenderWidgetHostView()) rwhv->WindowFrameChanged(); } diff --git a/chrome/browser/ui/cocoa/browser_window_controller_private.mm b/chrome/browser/ui/cocoa/browser_window_controller_private.mm index b4416f8..1bb17f2 100644 --- a/chrome/browser/ui/cocoa/browser_window_controller_private.mm +++ b/chrome/browser/ui/cocoa/browser_window_controller_private.mm @@ -36,6 +36,8 @@ #include "content/browser/tab_contents/tab_contents_view.h" #include "ui/base/ui_base_types.h" +using content::WebContents; + // Forward-declare symbols that are part of the 10.6 SDK. #if !defined(MAC_OS_X_VERSION_10_6) || \ MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_6 @@ -518,7 +520,7 @@ willPositionSheet:(NSWindow*)sheet // If the relayout shifts the content area up or down, let the renderer know. if (contentShifted) { - if (TabContents* contents = browser_->GetSelectedTabContents()) { + if (WebContents* contents = browser_->GetSelectedWebContents()) { if (RenderWidgetHostView* rwhv = contents->GetRenderWidgetHostView()) rwhv->WindowFrameChanged(); } diff --git a/chrome/browser/ui/cocoa/dev_tools_controller.h b/chrome/browser/ui/cocoa/dev_tools_controller.h index 1d68533..f4fa57f 100644 --- a/chrome/browser/ui/cocoa/dev_tools_controller.h +++ b/chrome/browser/ui/cocoa/dev_tools_controller.h @@ -44,7 +44,7 @@ class TabContents; // Depending on |contents|'s state, decides whether the docked web inspector // should be shown or hidden and adjusts its height (|delegate_| handles // the actual resize). -- (void)updateDevToolsForTabContents:(TabContents*)contents +- (void)updateDevToolsForWebContents:(content::WebContents*)contents withProfile:(Profile*)profile; // Specifies whether devtools should dock to right. diff --git a/chrome/browser/ui/cocoa/dev_tools_controller.mm b/chrome/browser/ui/cocoa/dev_tools_controller.mm index 346292e2..5d10075 100644 --- a/chrome/browser/ui/cocoa/dev_tools_controller.mm +++ b/chrome/browser/ui/cocoa/dev_tools_controller.mm @@ -17,6 +17,8 @@ #include "chrome/common/pref_names.h" #include "content/browser/tab_contents/tab_contents.h" +using content::WebContents; + namespace { // Minimal height of devtools pane or content pane when devtools are docked @@ -29,7 +31,7 @@ const int kMinContentsSize = 50; @interface DevToolsController (Private) -- (void)showDevToolsContents:(TabContents*)devToolsContents +- (void)showDevToolsContents:(WebContents*)devToolsContents withProfile:(Profile*)profile; - (void)showDevToolsContainer:(Profile*)profile; - (void)hideDevToolsContainer:(Profile*)profile; @@ -69,13 +71,13 @@ const int kMinContentsSize = 50; return splitView_.get(); } -- (void)updateDevToolsForTabContents:(TabContents*)contents +- (void)updateDevToolsForWebContents:(WebContents*)contents withProfile:(Profile*)profile { // Get current devtools content. TabContentsWrapper* devToolsTab = contents ? DevToolsWindow::GetDevToolsContents(contents) : NULL; - TabContents* devToolsContents = devToolsTab ? - devToolsTab->tab_contents() : NULL; + WebContents* devToolsContents = devToolsTab ? + devToolsTab->web_contents() : NULL; [self showDevToolsContents:devToolsContents withProfile:profile]; } @@ -99,7 +101,7 @@ const int kMinContentsSize = 50; [contentsController_ ensureContentsVisible]; } -- (void)showDevToolsContents:(TabContents*)devToolsContents +- (void)showDevToolsContents:(WebContents*)devToolsContents withProfile:(Profile*)profile { [contentsController_ ensureContentsSizeDoesNotChange]; @@ -117,7 +119,8 @@ const int kMinContentsSize = 50; } } - [contentsController_ changeTabContents:devToolsContents]; + [contentsController_ changeTabContents: + static_cast<TabContents*>(devToolsContents)]; } - (void)showDevToolsContainer:(Profile*)profile { diff --git a/chrome/browser/ui/cocoa/extensions/extension_action_context_menu.mm b/chrome/browser/ui/cocoa/extensions/extension_action_context_menu.mm index dc1c730..8ef4136e 100644 --- a/chrome/browser/ui/cocoa/extensions/extension_action_context_menu.mm +++ b/chrome/browser/ui/cocoa/extensions/extension_action_context_menu.mm @@ -37,6 +37,7 @@ using content::OpenURLParams; using content::Referrer; +using content::WebContents; // A class that loads the extension icon on the I/O thread before showing the // confirmation dialog to uninstall the given extension. @@ -153,7 +154,7 @@ int CurrentTabId() { Browser* browser = BrowserList::GetLastActive(); if(!browser) return -1; - TabContents* contents = browser->GetSelectedTabContents(); + WebContents* contents = browser->GetSelectedWebContents(); if (!contents) return -1; return ExtensionTabUtil::GetTabId(contents); diff --git a/chrome/browser/ui/cocoa/fullscreen_exit_bubble_controller_unittest.mm b/chrome/browser/ui/cocoa/fullscreen_exit_bubble_controller_unittest.mm index f49e36f..0bdb82e 100644 --- a/chrome/browser/ui/cocoa/fullscreen_exit_bubble_controller_unittest.mm +++ b/chrome/browser/ui/cocoa/fullscreen_exit_bubble_controller_unittest.mm @@ -13,11 +13,13 @@ #include "chrome/common/chrome_notification_types.h" #include "chrome/test/base/ui_test_utils.h" #include "content/browser/site_instance.h" -#include "content/browser/tab_contents/tab_contents.h" #include "content/public/browser/notification_service.h" +#include "content/public/browser/web_contents.h" #include "testing/gtest_mac.h" #include "ui/base/accelerators/accelerator_cocoa.h" +using content::WebContents; + @interface FullscreenExitBubbleController(JustForTesting) // Already defined. + (NSString*)keyCommandString; @@ -78,7 +80,7 @@ TEST_F(FullscreenExitBubbleControllerTest, DenyExitsFullscreen) { CreateBrowserWindow(); AppendTabToStrip(); - TabContents* fullscreen_tab = browser()->GetSelectedTabContents(); + WebContents* fullscreen_tab = browser()->GetSelectedWebContents(); { base::mac::ScopedNSAutoreleasePool pool; ui_test_utils::WindowedNotificationObserver fullscreen_observer( diff --git a/chrome/browser/ui/cocoa/tab_contents/tab_contents_controller.h b/chrome/browser/ui/cocoa/tab_contents/tab_contents_controller.h index 358501f..8b6f768 100644 --- a/chrome/browser/ui/cocoa/tab_contents/tab_contents_controller.h +++ b/chrome/browser/ui/cocoa/tab_contents/tab_contents_controller.h @@ -14,6 +14,10 @@ class TabContents; class TabContentsNotificationBridge; @class TabContentsController; +namespace content { +class WebContents; +} + // The interface for the tab contents view controller's delegate. @protocol TabContentsControllerDelegate @@ -51,7 +55,7 @@ class TabContentsNotificationBridge; // should be put into the view hierarchy. - (void)ensureContentsVisible; -// Call to change the underlying tab contents object. View is not changed, +// Call to change the underlying web contents object. View is not changed, // call |-ensureContentsVisible| to display the |newContents|'s render widget // host view. - (void)changeTabContents:(TabContents*)newContents; diff --git a/chrome/browser/ui/cocoa/tab_contents/tab_contents_controller.mm b/chrome/browser/ui/cocoa/tab_contents/tab_contents_controller.mm index a5f5a4d..fd6f74e 100644 --- a/chrome/browser/ui/cocoa/tab_contents/tab_contents_controller.mm +++ b/chrome/browser/ui/cocoa/tab_contents/tab_contents_controller.mm @@ -15,6 +15,8 @@ #include "content/public/browser/notification_source.h" #include "content/public/browser/notification_types.h" +using content::WebContents; + @interface TabContentsController(Private) // Forwards frame update to |delegate_| (ResizeNotificationView calls it). - (void)tabContentsViewFrameWillChange:(NSRect)frameRect; @@ -35,7 +37,7 @@ class TabContentsNotificationBridge : public content::NotificationObserver { const content::NotificationSource& source, const content::NotificationDetails& details); // Register for |contents|'s notifications, remove all prior registrations. - void ChangeTabContents(TabContents* contents); + void ChangeWebContents(WebContents* contents); private: content::NotificationRegistrar registrar_; TabContentsController* controller_; // weak, owns us @@ -60,7 +62,7 @@ void TabContentsNotificationBridge::Observe( } } -void TabContentsNotificationBridge::ChangeTabContents(TabContents* contents) { +void TabContentsNotificationBridge::ChangeWebContents(WebContents* contents) { registrar_.RemoveAll(); if (contents) { registrar_.Add( @@ -105,7 +107,7 @@ void TabContentsNotificationBridge::ChangeTabContents(TabContents* contents) { contents_ = contents; delegate_ = delegate; tabContentsBridge_.reset(new TabContentsNotificationBridge(self)); - tabContentsBridge_->ChangeTabContents(contents); + tabContentsBridge_->ChangeWebContents(contents); } return self; } @@ -164,7 +166,7 @@ void TabContentsNotificationBridge::ChangeTabContents(TabContents* contents) { - (void)changeTabContents:(TabContents*)newContents { contents_ = newContents; - tabContentsBridge_->ChangeTabContents(contents_); + tabContentsBridge_->ChangeWebContents(contents_); } - (void)tabContentsViewFrameWillChange:(NSRect)frameRect { diff --git a/chrome/browser/ui/cocoa/tabpose_window.mm b/chrome/browser/ui/cocoa/tabpose_window.mm index 8912654..08d3a2c 100644 --- a/chrome/browser/ui/cocoa/tabpose_window.mm +++ b/chrome/browser/ui/cocoa/tabpose_window.mm @@ -252,7 +252,7 @@ void ThumbnailLoader::LoadThumbnail() { - (int)bottomOffset { int bottomOffset = 0; TabContentsWrapper* devToolsContents = - DevToolsWindow::GetDevToolsContents(contents_->tab_contents()); + DevToolsWindow::GetDevToolsContents(contents_->web_contents()); if (devToolsContents && devToolsContents->tab_contents() && devToolsContents->tab_contents()->GetRenderViewHost() && devToolsContents->tab_contents()->GetRenderViewHost()->view()) { diff --git a/chrome/browser/ui/cocoa/toolbar/toolbar_controller.mm b/chrome/browser/ui/cocoa/toolbar/toolbar_controller.mm index 0affff4..08c0c09 100644 --- a/chrome/browser/ui/cocoa/toolbar/toolbar_controller.mm +++ b/chrome/browser/ui/cocoa/toolbar/toolbar_controller.mm @@ -760,7 +760,7 @@ class NotificationBridge : public content::NotificationObserver { } OpenURLParams params( url, Referrer(), CURRENT_TAB, content::PAGE_TRANSITION_TYPED, false); - browser_->GetSelectedTabContents()->OpenURL(params); + browser_->GetSelectedWebContents()->OpenURL(params); } // (URLDropTargetController protocol) @@ -777,7 +777,7 @@ class NotificationBridge : public content::NotificationObserver { OpenURLParams params( url, Referrer(), CURRENT_TAB, content::PAGE_TRANSITION_TYPED, false); - browser_->GetSelectedTabContents()->OpenURL(params); + browser_->GetSelectedWebContents()->OpenURL(params); } // (URLDropTargetController protocol) diff --git a/chrome/browser/ui/fullscreen_controller.cc b/chrome/browser/ui/fullscreen_controller.cc index deef679..cc001fc 100644 --- a/chrome/browser/ui/fullscreen_controller.cc +++ b/chrome/browser/ui/fullscreen_controller.cc @@ -44,7 +44,7 @@ bool FullscreenController::IsFullscreenForTab(const WebContents* tab) const { TabContentsWrapper::GetCurrentWrapperForContents(tab); if (!wrapper || (wrapper != fullscreened_tab_)) return false; - DCHECK(tab == browser_->GetSelectedTabContents()); + DCHECK(tab == browser_->GetSelectedWebContents()); DCHECK(window_->IsFullscreen()); return true; } @@ -85,7 +85,7 @@ void FullscreenController::RequestToLockMouse(WebContents* tab) { void FullscreenController::ToggleFullscreenModeForTab(WebContents* tab, bool enter_fullscreen) { - if (tab != browser_->GetSelectedTabContents()) + if (tab != browser_->GetSelectedWebContents()) return; bool in_browser_or_tab_fullscreen_mode; @@ -139,7 +139,7 @@ void FullscreenController::TogglePresentationMode(bool for_tab) { bool entering_fullscreen = !window_->InPresentationMode(); GURL url; if (for_tab) { - url = browser_->GetSelectedTabContents()->GetURL(); + url = browser_->GetSelectedWebContents()->GetURL(); tab_fullscreen_accepted_ = entering_fullscreen && GetFullscreenSetting(url) == CONTENT_SETTING_ALLOW; } @@ -165,7 +165,7 @@ void FullscreenController::ToggleFullscreenMode(bool for_tab) { GURL url; if (for_tab) { - url = browser_->GetSelectedTabContents()->GetURL(); + url = browser_->GetSelectedWebContents()->GetURL(); tab_fullscreen_accepted_ = entering_fullscreen && GetFullscreenSetting(url) == CONTENT_SETTING_ALLOW; } else { diff --git a/chrome/browser/ui/gtk/bookmarks/bookmark_bar_gtk.cc b/chrome/browser/ui/gtk/bookmarks/bookmark_bar_gtk.cc index d707d80..571f04f 100644 --- a/chrome/browser/ui/gtk/bookmarks/bookmark_bar_gtk.cc +++ b/chrome/browser/ui/gtk/bookmarks/bookmark_bar_gtk.cc @@ -53,6 +53,7 @@ using content::PageNavigator; using content::UserMetricsAction; +using content::WebContents; namespace { @@ -678,17 +679,17 @@ bool BookmarkBarGtk::GetTabContentsSize(gfx::Size* size) { NOTREACHED(); return false; } - TabContents* tab_contents = browser->GetSelectedTabContents(); - if (!tab_contents) { + WebContents* web_contents = browser->GetSelectedWebContents(); + if (!web_contents) { // It is possible to have a browser but no TabContents while under testing, // so don't NOTREACHED() and error the program. return false; } - if (!tab_contents->GetView()) { + if (!web_contents->GetView()) { NOTREACHED(); return false; } - *size = tab_contents->GetView()->GetContainerSize(); + *size = web_contents->GetView()->GetContainerSize(); return true; } diff --git a/chrome/browser/ui/gtk/browser_titlebar.cc b/chrome/browser/ui/gtk/browser_titlebar.cc index 1203082..bc32f99 100644 --- a/chrome/browser/ui/gtk/browser_titlebar.cc +++ b/chrome/browser/ui/gtk/browser_titlebar.cc @@ -54,6 +54,8 @@ #include "ui/gfx/image/image.h" #include "ui/gfx/skbitmap_operations.h" +using content::WebContents; + namespace { // The space above the titlebars. @@ -635,12 +637,12 @@ void BrowserTitlebar::UpdateTitleAndIcon() { } } -void BrowserTitlebar::UpdateThrobber(TabContents* tab_contents) { +void BrowserTitlebar::UpdateThrobber(WebContents* web_contents) { DCHECK(app_mode_favicon_); - if (tab_contents && tab_contents->IsLoading()) { + if (web_contents && web_contents->IsLoading()) { GdkPixbuf* icon_pixbuf = - throbber_.GetNextFrame(tab_contents->IsWaitingForResponse()); + throbber_.GetNextFrame(web_contents->IsWaitingForResponse()); gtk_image_set_from_pixbuf(GTK_IMAGE(app_mode_favicon_), icon_pixbuf); } else { ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); @@ -987,11 +989,11 @@ bool BrowserTitlebar::IsCommandIdChecked(int command_id) const { EncodingMenuController controller; if (controller.DoesCommandBelongToEncodingMenu(command_id)) { - TabContents* tab_contents = - browser_window_->browser()->GetSelectedTabContents(); - if (tab_contents) { + WebContents* web_contents = + browser_window_->browser()->GetSelectedWebContents(); + if (web_contents) { return controller.IsItemChecked(browser_window_->browser()->profile(), - tab_contents->GetEncoding(), + web_contents->GetEncoding(), command_id); } return false; diff --git a/chrome/browser/ui/gtk/browser_titlebar.h b/chrome/browser/ui/gtk/browser_titlebar.h index ff00d92..5de8a4c 100644 --- a/chrome/browser/ui/gtk/browser_titlebar.h +++ b/chrome/browser/ui/gtk/browser_titlebar.h @@ -30,6 +30,10 @@ class MenuGtk; class PopupPageMenuModel; class TabContents; +namespace content { +class WebContents; +} + class BrowserTitlebar : public content::NotificationObserver, public ui::ActiveWindowWatcherXObserver, public ui::SimpleMenuModel::Delegate { @@ -62,9 +66,9 @@ class BrowserTitlebar : public content::NotificationObserver, void UpdateTitleAndIcon(); // Called by the browser asking us to update the loading throbber. - // |tab_contents| is the tab that is associated with the window throbber. - // |tab_contents| can be null. - void UpdateThrobber(TabContents* tab_contents); + // |web_contents| is the tab that is associated with the window throbber. + // |web_contents| can be null. + void UpdateThrobber(content::WebContents* web_contents); // On Windows, right clicking in the titlebar background brings up the system // menu. There's no such thing on linux, so we just show the menu items we diff --git a/chrome/browser/ui/gtk/browser_window_gtk.cc b/chrome/browser/ui/gtk/browser_window_gtk.cc index 424c87e..614ad2f 100644 --- a/chrome/browser/ui/gtk/browser_window_gtk.cc +++ b/chrome/browser/ui/gtk/browser_window_gtk.cc @@ -807,7 +807,7 @@ void BrowserWindowGtk::BookmarkBarStateChanged( void BrowserWindowGtk::UpdateDevTools() { UpdateDevToolsForContents( - browser_->GetSelectedTabContents()); + browser_->GetSelectedWebContents()); } void BrowserWindowGtk::SetDevToolsDockSide(DevToolsDockSide side) @@ -851,11 +851,11 @@ void BrowserWindowGtk::LoadingAnimationCallback() { tabstrip_->UpdateLoadingAnimations(); } else if (ShouldShowWindowIcon()) { // ... or in the window icon area for popups and app windows. - TabContents* tab_contents = browser_->GetSelectedTabContents(); + WebContents* web_contents = browser_->GetSelectedTabContents(); // GetSelectedTabContents can return NULL for example under Purify when // the animations are running slowly and this function is called on // a timer through LoadingAnimationCallback. - titlebar_->UpdateThrobber(tab_contents); + titlebar_->UpdateThrobber(web_contents); } } @@ -1265,7 +1265,7 @@ void BrowserWindowGtk::Observe(int type, void BrowserWindowGtk::TabDetachedAt(TabContentsWrapper* 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 - // browser_->GetSelectedTabContents() will return NULL or something else. + // browser_->GetSelectedWebContents() will return NULL or something else. if (index == browser_->tabstrip_model()->active_index()) { infobar_container_->ChangeTabContents(NULL); UpdateDevToolsForContents(NULL); @@ -1283,7 +1283,7 @@ void BrowserWindowGtk::ActiveTabChanged(TabContentsWrapper* old_contents, // Update various elements that are interested in knowing the current // TabContents. - UpdateDevToolsForContents(new_contents->tab_contents()); + UpdateDevToolsForContents(new_contents->web_contents()); infobar_container_->ChangeTabContents(new_contents->infobar_tab_helper()); contents_container_->SetTab(new_contents); @@ -1370,7 +1370,7 @@ void BrowserWindowGtk::MaybeShowBookmarkBar(bool animate) { BookmarkBar::DONT_ANIMATE_STATE_CHANGE); } -void BrowserWindowGtk::UpdateDevToolsForContents(TabContents* contents) { +void BrowserWindowGtk::UpdateDevToolsForContents(WebContents* contents) { TRACE_EVENT0("ui::gtk", "BrowserWindowGtk::UpdateDevToolsForContents"); TabContentsWrapper* old_devtools = devtools_container_->tab(); TabContentsWrapper* devtools_contents = contents ? @@ -1387,7 +1387,7 @@ void BrowserWindowGtk::UpdateDevToolsForContents(TabContents* contents) { // anything other than user selecting a Tab. // See TabContentsViewViews::OnWindowPosChanged for reference on how it // should be implemented. - devtools_contents->tab_contents()->ShowContents(); + devtools_contents->web_contents()->ShowContents(); } bool should_show = old_devtools == NULL && devtools_contents != NULL; @@ -2130,11 +2130,11 @@ gboolean BrowserWindowGtk::OnGtkAccelerator(GtkAccelGroup* accel_group, 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. - TabContents* current_tab_contents = - browser()->GetSelectedTabContents(); + WebContents* current_web_contents = + browser()->GetSelectedWebContents(); // The current tab might not have a render view if it crashed. - if (!current_tab_contents || !current_tab_contents->GetContentNativeView() || - !gtk_widget_is_focus(current_tab_contents->GetContentNativeView())) { + if (!current_web_contents || !current_web_contents->GetContentNativeView() || + !gtk_widget_is_focus(current_web_contents->GetContentNativeView())) { int command_id = GetCustomCommandId(event); if (command_id == -1) command_id = GetPreHandleCommandId(event); diff --git a/chrome/browser/ui/gtk/browser_window_gtk.h b/chrome/browser/ui/gtk/browser_window_gtk.h index 7c3cfa6..8ee1bca 100644 --- a/chrome/browser/ui/gtk/browser_window_gtk.h +++ b/chrome/browser/ui/gtk/browser_window_gtk.h @@ -185,7 +185,7 @@ class BrowserWindowGtk : public BrowserWindow, // Accessor for the tab strip. TabStripGtk* tabstrip() const { return tabstrip_.get(); } - void UpdateDevToolsForContents(TabContents* contents); + void UpdateDevToolsForContents(content::WebContents* contents); // Shows docked devtools. void ShowDevToolsContainer(); diff --git a/chrome/browser/ui/gtk/gtk_util.cc b/chrome/browser/ui/gtk/gtk_util.cc index ecc08b0..f2ac283 100644 --- a/chrome/browser/ui/gtk/gtk_util.cc +++ b/chrome/browser/ui/gtk/gtk_util.cc @@ -56,6 +56,8 @@ #include <gdk/gdkx.h> #include <gtk/gtk.h> +using content::WebContents; + namespace { #if defined(GOOGLE_CHROME_BUILD) @@ -159,10 +161,10 @@ gboolean PaintNoBackground(GtkWidget* widget, #if defined(OS_CHROMEOS) -TabContents* GetBrowserWindowSelectedTabContents(BrowserWindow* window) { +WebContents* GetBrowserWindowSelectedWebContents(BrowserWindow* window) { chromeos::BrowserView* browser_view = static_cast<chromeos::BrowserView*>( window); - return browser_view->GetSelectedTabContents(); + return browser_view->GetSelectedWebContents(); } GtkWidget* GetBrowserWindowFocusedWidget(BrowserWindow* window) { @@ -179,10 +181,10 @@ GtkWidget* GetBrowserWindowFocusedWidget(BrowserWindow* window) { #else -TabContents* GetBrowserWindowSelectedTabContents(BrowserWindow* window) { +WebContents* GetBrowserWindowSelectedWebContents(BrowserWindow* window) { BrowserWindowGtk* browser_window = static_cast<BrowserWindowGtk*>( window); - return browser_window->browser()->GetSelectedTabContents(); + return browser_window->browser()->GetSelectedWebContents(); } GtkWidget* GetBrowserWindowFocusedWidget(BrowserWindow* window) { @@ -1172,7 +1174,7 @@ void DoCutCopyPaste(BrowserWindow* window, if (widget == NULL) return; // Do nothing if no focused widget. - TabContents* current_tab = GetBrowserWindowSelectedTabContents(window); + WebContents* current_tab = GetBrowserWindowSelectedWebContents(window); if (current_tab && widget == current_tab->GetContentNativeView()) { (current_tab->GetRenderViewHost()->*method)(); } else { diff --git a/chrome/browser/ui/gtk/omnibox/omnibox_view_gtk.cc b/chrome/browser/ui/gtk/omnibox/omnibox_view_gtk.cc index 7beff7e..a9b9462 100644 --- a/chrome/browser/ui/gtk/omnibox/omnibox_view_gtk.cc +++ b/chrome/browser/ui/gtk/omnibox/omnibox_view_gtk.cc @@ -58,6 +58,8 @@ #include "chrome/browser/ui/gtk/omnibox/omnibox_popup_view_gtk.h" #endif +using content::WebContents; + namespace { const gchar* kOmniboxViewGtkKey = "__OMNIBOX_VIEW_GTK__"; @@ -1586,8 +1588,8 @@ void OmniboxViewGtk::HandleDragDataGet(GtkWidget* widget, break; } case ui::CHROME_NAMED_URL: { - TabContents* current_tab = - BrowserList::GetLastActive()->GetSelectedTabContents(); + WebContents* current_tab = + BrowserList::GetLastActive()->GetSelectedWebContents(); string16 tab_title = current_tab->GetTitle(); // Pass an empty string if user has edited the URL. if (current_tab->GetURL().spec() != dragged_text_) diff --git a/chrome/browser/ui/intents/web_intent_picker_controller_browsertest.cc b/chrome/browser/ui/intents/web_intent_picker_controller_browsertest.cc index f694527..bfa2842 100644 --- a/chrome/browser/ui/intents/web_intent_picker_controller_browsertest.cc +++ b/chrome/browser/ui/intents/web_intent_picker_controller_browsertest.cc @@ -185,7 +185,7 @@ IN_PROC_BROWSER_TEST_F(WebIntentPickerControllerBrowserTest, ChooseService) { OnServiceChosen(controller, 1); ASSERT_EQ(2, browser()->tab_count()); EXPECT_EQ(GURL(kServiceURL2), - browser()->GetSelectedTabContents()->GetURL()); + browser()->GetSelectedWebContents()->GetURL()); EXPECT_TRUE(host->dispatched_); diff --git a/chrome/browser/ui/omnibox/omnibox_view_browsertest.cc b/chrome/browser/ui/omnibox/omnibox_view_browsertest.cc index 6f2ecf1..336b218 100644 --- a/chrome/browser/ui/omnibox/omnibox_view_browsertest.cc +++ b/chrome/browser/ui/omnibox/omnibox_view_browsertest.cc @@ -31,8 +31,8 @@ #include "chrome/common/url_constants.h" #include "chrome/test/base/in_process_browser_test.h" #include "chrome/test/base/ui_test_utils.h" -#include "content/browser/tab_contents/tab_contents.h" #include "content/public/browser/notification_service.h" +#include "content/public/browser/web_contents.h" #include "net/base/mock_host_resolver.h" #include "ui/base/events.h" #include "ui/base/keycodes/keyboard_codes.h" @@ -568,7 +568,7 @@ class OmniboxViewTest : public InProcessBrowserTest, // opened. ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_RETURN, ui::EF_CONTROL_DOWN)); - GURL url = browser()->GetSelectedTabContents()->GetURL(); + GURL url = browser()->GetSelectedWebContents()->GetURL(); EXPECT_STREQ(kDesiredTLDHostname, url.host().c_str()); } @@ -600,7 +600,7 @@ class OmniboxViewTest : public InProcessBrowserTest, // Open the default match. ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_RETURN, 0)); - GURL url = browser()->GetSelectedTabContents()->GetURL(); + GURL url = browser()->GetSelectedWebContents()->GetURL(); EXPECT_STREQ(kSearchTextURL, url.spec().c_str()); // Test that entering a single character then Enter performs a search. @@ -617,7 +617,7 @@ class OmniboxViewTest : public InProcessBrowserTest, // Open the default match. ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_RETURN, 0)); - url = browser()->GetSelectedTabContents()->GetURL(); + url = browser()->GetSelectedWebContents()->GetURL(); EXPECT_STREQ(kSearchSingleCharURL, url.spec().c_str()); } diff --git a/chrome/browser/ui/panels/panel.cc b/chrome/browser/ui/panels/panel.cc index 6b86b5f..e5429a3 100644 --- a/chrome/browser/ui/panels/panel.cc +++ b/chrome/browser/ui/panels/panel.cc @@ -107,9 +107,9 @@ void Panel::SetAutoResizable(bool resizable) { auto_resizable_ = resizable; if (auto_resizable_) { browser()->tabstrip_model()->AddObserver(this); - TabContents* tab_contents = browser()->GetSelectedTabContents(); - if (tab_contents) - EnableTabContentsAutoResize(tab_contents); + WebContents* web_contents = browser()->GetSelectedWebContents(); + if (web_contents) + EnableWebContentsAutoResize(web_contents); } else { browser()->tabstrip_model()->RemoveObserver(this); registrar_.RemoveAll(); @@ -125,7 +125,7 @@ void Panel::SetSizeRange(const gfx::Size& min_size, const gfx::Size& max_size) { min_size_ = min_size; max_size_ = max_size; - ConfigureAutoResize(browser()->GetSelectedTabContents()); + ConfigureAutoResize(browser()->GetSelectedWebContents()); } void Panel::SetAppIconVisibility(bool visible) { @@ -598,36 +598,36 @@ void Panel::TabInsertedAt(TabContentsWrapper* contents, bool foreground) { if (auto_resizable_) { DCHECK_EQ(0, index); - EnableTabContentsAutoResize(contents->tab_contents()); + EnableWebContentsAutoResize(contents->web_contents()); } } -void Panel::EnableTabContentsAutoResize(TabContents* tab_contents) { - DCHECK(tab_contents); - ConfigureAutoResize(tab_contents); +void Panel::EnableWebContentsAutoResize(WebContents* web_contents) { + DCHECK(web_contents); + ConfigureAutoResize(web_contents); // We also need to know when the render view host changes in order // to turn on auto-resize notifications in the new render view host. registrar_.RemoveAll(); // Stop notifications for previous contents, if any. registrar_.Add( this, - content::NOTIFICATION_TAB_CONTENTS_SWAPPED, - content::Source<TabContents>(tab_contents)); + content::NOTIFICATION_WEB_CONTENTS_SWAPPED, + content::Source<WebContents>(web_contents)); } void Panel::Observe(int type, const content::NotificationSource& source, const content::NotificationDetails& details) { - DCHECK_EQ(type, content::NOTIFICATION_TAB_CONTENTS_SWAPPED); - ConfigureAutoResize(content::Source<TabContents>(source).ptr()); + DCHECK_EQ(type, content::NOTIFICATION_WEB_CONTENTS_SWAPPED); + ConfigureAutoResize(content::Source<WebContents>(source).ptr()); } -void Panel::ConfigureAutoResize(TabContents* tab_contents) { - if (!auto_resizable_ || !tab_contents) +void Panel::ConfigureAutoResize(WebContents* web_contents) { + if (!auto_resizable_ || !web_contents) return; // NULL might be returned if the tab has not been added. - RenderViewHost* render_view_host = tab_contents->GetRenderViewHost(); + RenderViewHost* render_view_host = web_contents->GetRenderViewHost(); if (!render_view_host) return; @@ -637,7 +637,7 @@ void Panel::ConfigureAutoResize(TabContents* tab_contents) { } void Panel::OnWindowSizeAvailable() { - ConfigureAutoResize(browser()->GetSelectedTabContents()); + ConfigureAutoResize(browser()->GetSelectedWebContents()); } void Panel::DestroyBrowser() { diff --git a/chrome/browser/ui/panels/panel.h b/chrome/browser/ui/panels/panel.h index af3f0d3..61b54cf 100644 --- a/chrome/browser/ui/panels/panel.h +++ b/chrome/browser/ui/panels/panel.h @@ -272,12 +272,12 @@ class Panel : public BrowserWindow, // size may differ after panel layout. Panel(Browser* browser, const gfx::Size& requested_size); - // Configures the tab contents for auto resize, including configurations + // Configures the web contents for auto resize, including configurations // on the renderer and detecting renderer changes. - void EnableTabContentsAutoResize(TabContents* tab_contents); + void EnableWebContentsAutoResize(content::WebContents* web_contents); // Configures the renderer for auto resize (if auto resize is enabled). - void ConfigureAutoResize(TabContents* tab_contents); + void ConfigureAutoResize(content::WebContents* web_contents); Browser* browser_; // Weak, owned by native panel. diff --git a/chrome/browser/ui/panels/panel_browser_frame_view.cc b/chrome/browser/ui/panels/panel_browser_frame_view.cc index b4e6c1c..32f7478 100644 --- a/chrome/browser/ui/panels/panel_browser_frame_view.cc +++ b/chrome/browser/ui/panels/panel_browser_frame_view.cc @@ -38,6 +38,8 @@ #include "ui/views/painter.h" #include "ui/views/widget/widget_delegate.h" +using content::WebContents; + namespace { // The height in pixels of the titlebar. @@ -625,7 +627,7 @@ bool PanelBrowserFrameView::ShouldTabIconViewAnimate() const { // This function is queried during the creation of the window as the // TabIconView we host is initialized, so we need to NULL check the selected // TabContents because in this condition there is not yet a selected tab. - TabContents* current_tab = browser_view()->GetSelectedTabContents(); + WebContents* current_tab = browser_view()->GetSelectedWebContents(); return current_tab ? current_tab->IsLoading() : false; } diff --git a/chrome/browser/ui/panels/panel_browsertest.cc b/chrome/browser/ui/panels/panel_browsertest.cc index 35f54fb..16cc617 100644 --- a/chrome/browser/ui/panels/panel_browsertest.cc +++ b/chrome/browser/ui/panels/panel_browsertest.cc @@ -815,7 +815,7 @@ IN_PROC_BROWSER_TEST_F(PanelBrowserTest, FLAKY_AutoResize) { chrome::NOTIFICATION_PANEL_BOUNDS_ANIMATIONS_FINISHED, content::Source<Panel>(panel)); EXPECT_TRUE(ui_test_utils::ExecuteJavaScript( - panel->browser()->GetSelectedTabContents()->GetRenderViewHost(), + panel->browser()->GetSelectedWebContents()->GetRenderViewHost(), std::wstring(), L"changeSize(50);")); enlarge.Wait(); @@ -828,7 +828,7 @@ IN_PROC_BROWSER_TEST_F(PanelBrowserTest, FLAKY_AutoResize) { chrome::NOTIFICATION_PANEL_BOUNDS_ANIMATIONS_FINISHED, content::Source<Panel>(panel)); EXPECT_TRUE(ui_test_utils::ExecuteJavaScript( - panel->browser()->GetSelectedTabContents()->GetRenderViewHost(), + panel->browser()->GetSelectedWebContents()->GetRenderViewHost(), std::wstring(), L"changeSize(-30);")); shrink.Wait(); @@ -1477,7 +1477,7 @@ IN_PROC_BROWSER_TEST_F(PanelBrowserTest, CreateWithExistingContents) { chrome::NOTIFICATION_PANEL_BOUNDS_ANIMATIONS_FINISHED, content::Source<Panel>(panel)); EXPECT_TRUE(ui_test_utils::ExecuteJavaScript( - panel_browser->GetSelectedTabContents()->GetRenderViewHost(), + panel_browser->GetSelectedWebContents()->GetRenderViewHost(), std::wstring(), L"changeSize(50);")); enlarge.Wait(); @@ -1543,7 +1543,7 @@ IN_PROC_BROWSER_TEST_F(PanelBrowserTest, TightAutosizeAroundSingleLine) { chrome::NOTIFICATION_PANEL_BOUNDS_ANIMATIONS_FINISHED, content::Source<Panel>(panel)); EXPECT_TRUE(ui_test_utils::ExecuteJavaScript( - panel->browser()->GetSelectedTabContents()->GetRenderViewHost(), + panel->browser()->GetSelectedWebContents()->GetRenderViewHost(), std::wstring(), L"document.body.innerHTML =" L"'<nobr>line of text and a <button>Button</button>';")); diff --git a/chrome/browser/ui/pdf/pdf_browsertest.cc b/chrome/browser/ui/pdf/pdf_browsertest.cc index fa2e0df..ba3dab8 100644 --- a/chrome/browser/ui/pdf/pdf_browsertest.cc +++ b/chrome/browser/ui/pdf/pdf_browsertest.cc @@ -16,8 +16,8 @@ #include "chrome/test/base/in_process_browser_test.h" #include "chrome/test/base/ui_test_utils.h" #include "content/browser/renderer_host/render_view_host.h" -#include "content/browser/tab_contents/tab_contents.h" #include "content/public/browser/notification_observer.h" +#include "content/public/browser/web_contents.h" #include "net/test/test_server.h" #include "third_party/skia/include/core/SkBitmap.h" #include "ui/base/clipboard/clipboard.h" @@ -85,7 +85,7 @@ class PDFBrowserTest : public InProcessBrowserTest, ui_test_utils::RegisterAndWait( this, chrome::NOTIFICATION_TAB_SNAPSHOT_TAKEN, - content::Source<WebContents>(wrapper->tab_contents())); + content::Source<WebContents>(wrapper->web_contents())); ASSERT_FALSE(snapshot_different_) << "Rendering didn't match, see result " "at " << snapshot_filename_.value().c_str(); } @@ -234,13 +234,13 @@ IN_PROC_BROWSER_TEST_F(PDFBrowserTest, MAYBE_Scroll) { wheel_event.type = WebKit::WebInputEvent::MouseWheel; wheel_event.deltaY = -200; wheel_event.wheelTicksY = -2; - TabContents* tab_contents = browser()->GetSelectedTabContents(); - tab_contents->GetRenderViewHost()->ForwardWheelEvent(wheel_event); + WebContents* web_contents = browser()->GetSelectedWebContents(); + web_contents->GetRenderViewHost()->ForwardWheelEvent(wheel_event); ASSERT_NO_FATAL_FAILURE(WaitForResponse()); int y_offset = 0; ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractInt( - browser()->GetSelectedTabContents()->GetRenderViewHost(), + browser()->GetSelectedWebContents()->GetRenderViewHost(), std::wstring(), L"window.domAutomationController.send(plugin.pageYOffset())", &y_offset)); @@ -269,7 +269,7 @@ IN_PROC_BROWSER_TEST_F(PDFBrowserTest, MAYBE_FindAndCopy) { objects[ui::Clipboard::CBF_TEXT] = params; clipboard.WriteObjects(objects); - browser()->GetSelectedTabContents()->GetRenderViewHost()->Copy(); + browser()->GetSelectedWebContents()->GetRenderViewHost()->Copy(); ASSERT_NO_FATAL_FAILURE(WaitForResponse()); std::string text; @@ -285,7 +285,7 @@ IN_PROC_BROWSER_TEST_F(PDFBrowserTest, FLAKY_SLOW_Loading) { ASSERT_TRUE(pdf_test_server()->Start()); NavigationController* controller = - &(browser()->GetSelectedTabContents()->GetController()); + &(browser()->GetSelectedWebContents()->GetController()); content::NotificationRegistrar registrar; registrar.Add(this, content::NOTIFICATION_LOAD_STOP, @@ -320,7 +320,7 @@ IN_PROC_BROWSER_TEST_F(PDFBrowserTest, FLAKY_SLOW_Loading) { // and before creating a byte-range request loader. bool complete = false; ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( - browser()->GetSelectedTabContents()->GetRenderViewHost(), + browser()->GetSelectedWebContents()->GetRenderViewHost(), std::wstring(), L"window.domAutomationController.send(plugin.documentLoadComplete())", &complete)); @@ -331,7 +331,7 @@ IN_PROC_BROWSER_TEST_F(PDFBrowserTest, FLAKY_SLOW_Loading) { // nested message loop for the JS call. if (last_count != load_stop_notification_count()) continue; - ui_test_utils::WaitForLoadStop(browser()->GetSelectedTabContents()); + ui_test_utils::WaitForLoadStop(browser()->GetSelectedWebContents()); } } } @@ -351,14 +351,14 @@ IN_PROC_BROWSER_TEST_F(PDFBrowserTest, MAYBE_OnLoadAndReload) { ui_test_utils::WindowedNotificationObserver observer( content::NOTIFICATION_LOAD_STOP, content::Source<NavigationController>( - &browser()->GetSelectedTabContents()->GetController())); + &browser()->GetSelectedWebContents()->GetController())); ASSERT_TRUE(ui_test_utils::ExecuteJavaScript( - browser()->GetSelectedTabContents()->GetRenderViewHost(), + browser()->GetSelectedWebContents()->GetRenderViewHost(), std::wstring(), L"reloadPDF();")); observer.Wait(); - ASSERT_EQ("success", browser()->GetSelectedTabContents()->GetURL().query()); + ASSERT_EQ("success", browser()->GetSelectedWebContents()->GetURL().query()); } } // namespace diff --git a/chrome/browser/ui/toolbar/toolbar_model.cc b/chrome/browser/ui/toolbar/toolbar_model.cc index 6bf2515..4bc9059 100644 --- a/chrome/browser/ui/toolbar/toolbar_model.cc +++ b/chrome/browser/ui/toolbar/toolbar_model.cc @@ -29,6 +29,7 @@ using content::NavigationEntry; using content::SSLStatus; +using content::WebContents; ToolbarModel::ToolbarModel(Browser* browser) : browser_(browser), @@ -82,9 +83,9 @@ bool ToolbarModel::ShouldDisplayURL() const { } } - TabContents* tab_contents = browser_->GetSelectedTabContents(); - if (tab_contents && tab_contents->GetWebUIForCurrentState()) - return !tab_contents->GetWebUIForCurrentState()->should_hide_url(); + WebContents* web_contents = browser_->GetSelectedWebContents(); + if (web_contents && web_contents->GetWebUIForCurrentState()) + return !web_contents->GetWebUIForCurrentState()->should_hide_url(); if (entry && entry->GetURL().SchemeIs(chrome::kExtensionScheme)) return false; diff --git a/chrome/browser/ui/toolbar/wrench_menu_model.cc b/chrome/browser/ui/toolbar/wrench_menu_model.cc index a7acc3a..63875e5 100644 --- a/chrome/browser/ui/toolbar/wrench_menu_model.cc +++ b/chrome/browser/ui/toolbar/wrench_menu_model.cc @@ -57,6 +57,7 @@ #endif using content::UserMetricsAction; +using content::WebContents; //////////////////////////////////////////////////////////////////////////////// // EncodingMenuModel @@ -98,7 +99,7 @@ void EncodingMenuModel::Build() { } bool EncodingMenuModel::IsCommandIdChecked(int command_id) const { - TabContents* current_tab = browser_->GetSelectedTabContents(); + WebContents* current_tab = browser_->GetSelectedWebContents(); if (!current_tab) return false; EncodingMenuController controller; @@ -590,8 +591,8 @@ void WrenchMenuModel::UpdateZoomControls() { bool enable_increment = false; bool enable_decrement = false; int zoom_percent = 100; - if (browser_->GetSelectedTabContents()) { - zoom_percent = browser_->GetSelectedTabContents()->GetZoomPercent( + if (browser_->GetSelectedWebContents()) { + zoom_percent = browser_->GetSelectedWebContents()->GetZoomPercent( &enable_increment, &enable_decrement); } zoom_label_ = l10n_util::GetStringFUTF16( diff --git a/chrome/browser/ui/toolbar/wrench_menu_model_unittest.cc b/chrome/browser/ui/toolbar/wrench_menu_model_unittest.cc index c58907d..e6047e46 100644 --- a/chrome/browser/ui/toolbar/wrench_menu_model_unittest.cc +++ b/chrome/browser/ui/toolbar/wrench_menu_model_unittest.cc @@ -194,6 +194,6 @@ class EncodingMenuModelTest : public BrowserWithTestWindowTest, TEST_F(EncodingMenuModelTest, IsCommandIdCheckedWithNoTabs) { EncodingMenuModel model(browser()); - ASSERT_EQ(NULL, browser()->GetSelectedTabContents()); + ASSERT_EQ(NULL, browser()->GetSelectedWebContents()); EXPECT_FALSE(model.IsCommandIdChecked(IDC_ENCODING_ISO88591)); } diff --git a/chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc b/chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc index 14306ab..5aeb19b 100644 --- a/chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc +++ b/chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc @@ -1081,7 +1081,7 @@ void BookmarkBarView::ShowContextMenuForView(View* source, (parent == profile->GetBookmarkModel()->other_node()) && (parent->child_count() == 1); context_menu_.reset(new BookmarkContextMenu(GetWidget(), profile, - browser_->GetSelectedTabContents(), parent, nodes, close_on_remove)); + browser_->GetSelectedWebContents(), parent, nodes, close_on_remove)); context_menu_->RunMenuAt(p); } diff --git a/chrome/browser/ui/views/constrained_html_delegate_gtk.cc b/chrome/browser/ui/views/constrained_html_delegate_gtk.cc index fc3f167..0014484 100644 --- a/chrome/browser/ui/views/constrained_html_delegate_gtk.cc +++ b/chrome/browser/ui/views/constrained_html_delegate_gtk.cc @@ -50,7 +50,7 @@ class ConstrainedHtmlDelegateGtk : public views::NativeWidgetGtk, virtual void DeleteDelegate() OVERRIDE { if (!closed_via_webui_) html_delegate_->OnDialogClosed(""); - tab_container_->ChangeTabContents(NULL); + tab_container_->ChangeWebContents(NULL); } virtual bool GetBackgroundColor(GdkColor* color) OVERRIDE { *color = ui::kGdkWhite; @@ -114,7 +114,7 @@ ConstrainedHtmlDelegateGtk::ConstrainedHtmlDelegateGtk( tab_container_ = new TabContentsContainer; GetWidget()->SetContentsView(tab_container_); - tab_container_->ChangeTabContents(html_tab_contents_->tab_contents()); + tab_container_->ChangeWebContents(html_tab_contents_->web_contents()); gfx::Size dialog_size; html_delegate_->GetDialogSize(&dialog_size); diff --git a/chrome/browser/ui/views/constrained_html_delegate_views.cc b/chrome/browser/ui/views/constrained_html_delegate_views.cc index e98c846..818ed3b 100644 --- a/chrome/browser/ui/views/constrained_html_delegate_views.cc +++ b/chrome/browser/ui/views/constrained_html_delegate_views.cc @@ -76,7 +76,7 @@ class ConstrainedHtmlDelegateViews : public TabContentsContainer, views::View* child) OVERRIDE { TabContentsContainer::ViewHierarchyChanged(is_add, parent, child); if (is_add && child == this) { - ChangeTabContents(html_tab_contents_->tab_contents()); + ChangeWebContents(html_tab_contents_->tab_contents()); } } diff --git a/chrome/browser/ui/views/find_bar_host_interactive_uitest.cc b/chrome/browser/ui/views/find_bar_host_interactive_uitest.cc index e93e569..75a0fde 100644 --- a/chrome/browser/ui/views/find_bar_host_interactive_uitest.cc +++ b/chrome/browser/ui/views/find_bar_host_interactive_uitest.cc @@ -353,7 +353,7 @@ IN_PROC_BROWSER_TEST_F(FindInPageTest, MAYBE_PasteWithoutTextChange) { // Press Ctrl-V to paste the content back, it should start finding even if the // content is not changed. content::Source<WebContents> notification_source( - browser()->GetSelectedTabContents()); + browser()->GetSelectedWebContents()); ui_test_utils::WindowedNotificationObserverWithDetails <FindNotificationDetails> observer( chrome::NOTIFICATION_FIND_RESULT_AVAILABLE, notification_source); diff --git a/chrome/browser/ui/views/frame/app_panel_browser_frame_view.cc b/chrome/browser/ui/views/frame/app_panel_browser_frame_view.cc index 3f4ab77..52e5361 100644 --- a/chrome/browser/ui/views/frame/app_panel_browser_frame_view.cc +++ b/chrome/browser/ui/views/frame/app_panel_browser_frame_view.cc @@ -23,6 +23,8 @@ #include "ui/views/widget/widget.h" #include "ui/views/widget/widget_delegate.h" +using content::WebContents; + namespace { // The frame border is only visible in restored mode and is hardcoded to 1 px on @@ -238,8 +240,8 @@ void AppPanelBrowserFrameView::ButtonPressed(views::Button* sender, bool AppPanelBrowserFrameView::ShouldTabIconViewAnimate() const { // This function is queried during the creation of the window as the // TabIconView we host is initialized, so we need to NULL check the selected - // TabContents because in this condition there is not yet a selected tab. - TabContents* current_tab = browser_view()->GetSelectedTabContents(); + // WebContents because in this condition there is not yet a selected tab. + WebContents* current_tab = browser_view()->GetSelectedWebContents(); return current_tab ? current_tab->IsLoading() : false; } diff --git a/chrome/browser/ui/views/frame/browser_view.cc b/chrome/browser/ui/views/frame/browser_view.cc index 75e261d..52ff0a5 100644 --- a/chrome/browser/ui/views/frame/browser_view.cc +++ b/chrome/browser/ui/views/frame/browser_view.cc @@ -219,7 +219,7 @@ void BookmarkExtensionBackground::Paint(gfx::Canvas* canvas, if (host_view_->IsDetached()) { // Draw the background to match the new tab page. int height = 0; - TabContents* contents = browser_->GetSelectedTabContents(); + WebContents* contents = browser_->GetSelectedWebContents(); if (contents && contents->GetView()) height = contents->GetView()->GetContainerSize().height(); NtpBackgroundUtil::PaintBackgroundDetachedMode( @@ -539,8 +539,8 @@ bool BrowserView::ActivateAppModalDialog() const { return false; } -TabContents* BrowserView::GetSelectedTabContents() const { - return browser_->GetSelectedTabContents(); +WebContents* BrowserView::GetSelectedWebContents() const { + return browser_->GetSelectedWebContents(); } TabContentsWrapper* BrowserView::GetSelectedTabContentsWrapper() const { @@ -887,9 +887,9 @@ void BrowserView::FullScreenStateChanged() { } void BrowserView::RestoreFocus() { - TabContents* selected_tab_contents = GetSelectedTabContents(); - if (selected_tab_contents) - selected_tab_contents->GetView()->RestoreFocus(); + WebContents* selected_web_contents = GetSelectedWebContents(); + if (selected_web_contents) + selected_web_contents->GetView()->RestoreFocus(); } LocationBar* BrowserView::GetLocationBar() const { @@ -1320,7 +1320,7 @@ void BrowserView::ShowInstant(TabContentsWrapper* preview) { if (!preview_container_) preview_container_ = new TabContentsContainer(); contents_->SetPreview(preview_container_, preview->tab_contents()); - preview_container_->ChangeTabContents(preview->tab_contents()); + preview_container_->ChangeWebContents(preview->web_contents()); } void BrowserView::HideInstant() { @@ -1328,7 +1328,7 @@ void BrowserView::HideInstant() { return; // The contents must be changed before SetPreview is invoked. - preview_container_->ChangeTabContents(NULL); + preview_container_->ChangeWebContents(NULL); contents_->SetPreview(NULL, NULL); delete preview_container_; preview_container_ = NULL; @@ -1403,7 +1403,7 @@ void BrowserView::Observe(int type, switch (type) { case chrome::NOTIFICATION_SIDEBAR_CHANGED: if (content::Details<SidebarContainer>(details)->tab_contents() == - browser_->GetSelectedTabContents()) { + browser_->GetSelectedWebContents()) { UpdateSidebar(); } break; @@ -1420,12 +1420,12 @@ void BrowserView::Observe(int type, void BrowserView::TabDetachedAt(TabContentsWrapper* 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 - // browser_->GetSelectedTabContents() will return NULL or something else. + // browser_->GetSelectedWebContents() will return NULL or something else. if (index == browser_->tabstrip_model()->active_index()) { // We need to reset the current tab contents to NULL before it gets // freed. This is because the focus manager performs some operations // on the selected TabContents when it is removed. - contents_container_->ChangeTabContents(NULL); + contents_container_->ChangeWebContents(NULL); infobar_container_->ChangeTabContents(NULL); UpdateSidebarForContents(NULL); UpdateDevToolsForContents(NULL); @@ -1460,7 +1460,7 @@ void BrowserView::TabReplacedAt(TabStripModel* tab_strip_model, contents_->MakePreviewContentsActiveContents(); TabContentsContainer* old_container = contents_container_; contents_container_ = preview_container_; - old_container->ChangeTabContents(NULL); + old_container->ChangeWebContents(NULL); delete old_container; preview_container_ = NULL; } @@ -1669,10 +1669,10 @@ void BrowserView::OnWidgetActivationChanged(views::Widget* widget, } void BrowserView::OnWindowBeginUserBoundsChange() { - TabContents* tab_contents = GetSelectedTabContents(); - if (!tab_contents) + WebContents* web_contents = GetSelectedWebContents(); + if (!web_contents) return; - tab_contents->GetRenderViewHost()->NotifyMoveOrResizeStarted(); + web_contents->GetRenderViewHost()->NotifyMoveOrResizeStarted(); } void BrowserView::OnWidgetMove() { @@ -2025,11 +2025,11 @@ void BrowserView::LoadingAnimationCallback() { tabstrip_->UpdateLoadingAnimations(); } else if (ShouldShowWindowIcon()) { // ... or in the window icon area for popups and app windows. - TabContents* tab_contents = browser_->GetSelectedTabContents(); - // GetSelectedTabContents can return NULL for example under Purify when + WebContents* web_contents = browser_->GetSelectedWebContents(); + // GetSelectedWebContents can return NULL for example under Purify when // the animations are running slowly and this function is called on a timer // through LoadingAnimationCallback. - frame_->UpdateThrobber(tab_contents && tab_contents->IsLoading()); + frame_->UpdateThrobber(web_contents && web_contents->IsLoading()); } } @@ -2121,7 +2121,7 @@ void BrowserView::UpdateSidebarForContents(TabContentsWrapper* tab_contents) { // Update sidebar content. TabContents* old_contents = static_cast<TabContents*>(sidebar_container_->web_contents()); - sidebar_container_->ChangeTabContents(sidebar_contents); + sidebar_container_->ChangeWebContents(sidebar_contents); SidebarManager::GetInstance()-> NotifyStateChanges(old_contents, sidebar_contents); @@ -2158,18 +2158,18 @@ void BrowserView::UpdateSidebarForContents(TabContentsWrapper* tab_contents) { } void BrowserView::UpdateDevToolsForContents(TabContentsWrapper* wrapper) { - TabContents* devtools_contents = NULL; + WebContents* devtools_contents = NULL; if (wrapper) { TabContentsWrapper* devtools_contents_wrapper = - DevToolsWindow::GetDevToolsContents(wrapper->tab_contents()); + DevToolsWindow::GetDevToolsContents(wrapper->web_contents()); if (devtools_contents_wrapper) - devtools_contents = devtools_contents_wrapper->tab_contents(); + devtools_contents = devtools_contents_wrapper->web_contents(); } bool should_show = devtools_contents && !devtools_container_->visible(); bool should_hide = !devtools_contents && devtools_container_->visible(); - devtools_container_->ChangeTabContents(devtools_contents); + devtools_container_->ChangeWebContents(devtools_contents); if (should_show) ShowDevToolsContainer(); @@ -2594,7 +2594,7 @@ void BrowserView::UpdateAcceleratorMetrics( void BrowserView::ProcessTabSelected(TabContentsWrapper* new_contents) { // If |contents_container_| already has the correct TabContents, we can save // some work. This also prevents extra events from being reported by the - // Visibility API under Windows, as ChangeTabContents will briefly hide + // Visibility API under Windows, as ChangeWebContents will briefly hide // the TabContents window. DCHECK(new_contents); bool change_tab_contents = @@ -2607,7 +2607,7 @@ void BrowserView::ProcessTabSelected(TabContentsWrapper* new_contents) { // we don't want any TabContents to be attached, so that we // avoid an unnecessary resize and re-layout of a TabContents. if (change_tab_contents) - contents_container_->ChangeTabContents(NULL); + contents_container_->ChangeWebContents(NULL); infobar_container_->ChangeTabContents(new_contents->infobar_tab_helper()); if (bookmark_bar_view_.get()) { bookmark_bar_view_->SetBookmarkBarState( @@ -2616,11 +2616,11 @@ void BrowserView::ProcessTabSelected(TabContentsWrapper* new_contents) { } UpdateUIForContents(new_contents); if (change_tab_contents) - contents_container_->ChangeTabContents(new_contents->tab_contents()); + contents_container_->ChangeWebContents(new_contents->web_contents()); UpdateSidebarForContents(new_contents); UpdateDevToolsForContents(new_contents); - // TODO(beng): This should be called automatically by ChangeTabContents, but I + // TODO(beng): This should be called automatically by ChangeWebContents, but I // am striving for parity now rather than cleanliness. This is // required to make features like Duplicate Tab, Undo Close Tab, // etc not result in sad tab. diff --git a/chrome/browser/ui/views/frame/browser_view.h b/chrome/browser/ui/views/frame/browser_view.h index 1425466..5cbc987 100644 --- a/chrome/browser/ui/views/frame/browser_view.h +++ b/chrome/browser/ui/views/frame/browser_view.h @@ -185,7 +185,7 @@ class BrowserView : public BrowserWindow, // determine loading state. It'd be nicer if we could change this to be // bool IsSelectedTabLoading() const; or something like that. We could even // move it to a WindowDelegate subclass. - TabContents* GetSelectedTabContents() const; + content::WebContents* GetSelectedWebContents() const; TabContentsWrapper* GetSelectedTabContentsWrapper() const; // Retrieves the icon to use in the frame to indicate an OTR window. diff --git a/chrome/browser/ui/views/frame/opaque_browser_frame_view.cc b/chrome/browser/ui/views/frame/opaque_browser_frame_view.cc index 45de640..e65dc57 100644 --- a/chrome/browser/ui/views/frame/opaque_browser_frame_view.cc +++ b/chrome/browser/ui/views/frame/opaque_browser_frame_view.cc @@ -50,6 +50,8 @@ #include "chrome/browser/ui/virtual_keyboard/virtual_keyboard_manager.h" #endif +using content::WebContents; + namespace { // The frame border is only visible in restored mode and is hardcoded to 4 px on @@ -469,8 +471,8 @@ void OpaqueBrowserFrameView::ButtonPressed(views::Button* sender, bool OpaqueBrowserFrameView::ShouldTabIconViewAnimate() const { // This function is queried during the creation of the window as the // TabIconView we host is initialized, so we need to NULL check the selected - // TabContents because in this condition there is not yet a selected tab. - TabContents* current_tab = browser_view()->GetSelectedTabContents(); + // WebContents because in this condition there is not yet a selected tab. + WebContents* current_tab = browser_view()->GetSelectedWebContents(); return current_tab ? current_tab->IsLoading() : false; } diff --git a/chrome/browser/ui/views/html_dialog_view_browsertest.cc b/chrome/browser/ui/views/html_dialog_view_browsertest.cc index 7116011..37ce254 100644 --- a/chrome/browser/ui/views/html_dialog_view_browsertest.cc +++ b/chrome/browser/ui/views/html_dialog_view_browsertest.cc @@ -15,11 +15,13 @@ #include "chrome/test/base/in_process_browser_test.h" #include "chrome/test/base/ui_test_utils.h" #include "content/browser/renderer_host/render_widget_host_view.h" -#include "content/browser/tab_contents/tab_contents.h" +#include "content/browser/tab_contents/tab_contents_view.h" +#include "content/public/browser/web_contents.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" #include "ui/views/widget/widget.h" +using content::WebContents; using testing::Eq; namespace { @@ -106,10 +108,10 @@ IN_PROC_BROWSER_TEST_F(HtmlDialogBrowserTest, MAYBE_SizeWindow) { TestHtmlDialogView* html_view = new TestHtmlDialogView(browser()->profile(), delegate); - TabContents* tab_contents = browser()->GetSelectedTabContents(); - ASSERT_TRUE(tab_contents != NULL); - views::Widget::CreateWindowWithParent(html_view, - tab_contents->GetDialogRootWindow()); + WebContents* web_contents = browser()->GetSelectedWebContents(); + ASSERT_TRUE(web_contents != NULL); + views::Widget::CreateWindowWithParent( + html_view, web_contents->GetView()->GetTopLevelNativeWindow()); html_view->InitDialog(); html_view->GetWidget()->Show(); @@ -125,12 +127,12 @@ IN_PROC_BROWSER_TEST_F(HtmlDialogBrowserTest, MAYBE_SizeWindow) { set_bounds.set_width(400); set_bounds.set_height(300); - html_view->MoveContents(tab_contents, set_bounds); + html_view->MoveContents(web_contents, set_bounds); ui_test_utils::RunMessageLoop(); // TestHtmlDialogView will quit. actual_bounds = html_view->GetWidget()->GetClientAreaScreenBounds(); EXPECT_EQ(set_bounds, actual_bounds); - rwhv_bounds = html_view->dom_contents()->tab_contents()-> + rwhv_bounds = html_view->dom_contents()->web_contents()-> GetRenderWidgetHostView()->GetViewBounds(); EXPECT_LT(0, rwhv_bounds.width()); EXPECT_LT(0, rwhv_bounds.height()); @@ -141,12 +143,12 @@ IN_PROC_BROWSER_TEST_F(HtmlDialogBrowserTest, MAYBE_SizeWindow) { set_bounds.set_width(550); set_bounds.set_height(250); - html_view->MoveContents(tab_contents, set_bounds); + html_view->MoveContents(web_contents, set_bounds); ui_test_utils::RunMessageLoop(); // TestHtmlDialogView will quit. actual_bounds = html_view->GetWidget()->GetClientAreaScreenBounds(); EXPECT_EQ(set_bounds, actual_bounds); - rwhv_bounds = html_view->dom_contents()->tab_contents()-> + rwhv_bounds = html_view->dom_contents()->web_contents()-> GetRenderWidgetHostView()->GetViewBounds(); EXPECT_LT(0, rwhv_bounds.width()); EXPECT_LT(0, rwhv_bounds.height()); @@ -157,12 +159,12 @@ IN_PROC_BROWSER_TEST_F(HtmlDialogBrowserTest, MAYBE_SizeWindow) { gfx::Size min_size = html_view->GetWidget()->GetMinimumSize(); set_bounds.set_size(min_size); - html_view->MoveContents(tab_contents, set_bounds); + html_view->MoveContents(web_contents, set_bounds); ui_test_utils::RunMessageLoop(); // TestHtmlDialogView will quit. actual_bounds = html_view->GetWidget()->GetClientAreaScreenBounds(); EXPECT_EQ(set_bounds, actual_bounds); - rwhv_bounds = html_view->dom_contents()->tab_contents()-> + rwhv_bounds = html_view->dom_contents()->web_contents()-> GetRenderWidgetHostView()->GetViewBounds(); EXPECT_LT(0, rwhv_bounds.width()); EXPECT_LT(0, rwhv_bounds.height()); @@ -173,7 +175,7 @@ IN_PROC_BROWSER_TEST_F(HtmlDialogBrowserTest, MAYBE_SizeWindow) { set_bounds.set_width(0); set_bounds.set_height(0); - html_view->MoveContents(tab_contents, set_bounds); + html_view->MoveContents(web_contents, set_bounds); ui_test_utils::RunMessageLoop(); // TestHtmlDialogView will quit. actual_bounds = html_view->GetWidget()->GetClientAreaScreenBounds(); EXPECT_LT(0, actual_bounds.width()); @@ -187,10 +189,10 @@ IN_PROC_BROWSER_TEST_F(HtmlDialogBrowserTest, DISABLED_WebContentRendered) { TestHtmlDialogView* html_view = new TestHtmlDialogView(browser()->profile(), delegate); - TabContents* tab_contents = browser()->GetSelectedTabContents(); - ASSERT_TRUE(tab_contents != NULL); - views::Widget::CreateWindowWithParent(html_view, - tab_contents->GetDialogRootWindow()); + WebContents* web_contents = browser()->GetSelectedWebContents(); + ASSERT_TRUE(web_contents != NULL); + views::Widget::CreateWindowWithParent( + html_view, web_contents->GetView()->GetTopLevelNativeWindow()); EXPECT_TRUE(html_view->initialized_); html_view->InitDialog(); diff --git a/chrome/browser/ui/views/ssl_client_certificate_selector_browsertest.cc b/chrome/browser/ui/views/ssl_client_certificate_selector_browsertest.cc index 25a28ea..42527d8 100644 --- a/chrome/browser/ui/views/ssl_client_certificate_selector_browsertest.cc +++ b/chrome/browser/ui/views/ssl_client_certificate_selector_browsertest.cc @@ -10,6 +10,7 @@ #include "chrome/browser/ui/views/ssl_client_certificate_selector.h" #include "chrome/test/base/in_process_browser_test.h" #include "chrome/test/base/ui_test_utils.h" +#include "content/browser/tab_contents/tab_contents.h" #include "content/browser/ssl/ssl_client_auth_handler_mock.h" #include "net/base/cert_test_util.h" #include "net/base/x509_certificate.h" @@ -58,7 +59,7 @@ class SSLClientCertificateSelectorTest : public InProcessBrowserTest { io_loop_finished_event_.Wait(); - ui_test_utils::WaitForLoadStop(browser()->GetSelectedTabContents()); + ui_test_utils::WaitForLoadStop(browser()->GetSelectedWebContents()); selector_ = new SSLClientCertificateSelector( browser()->GetSelectedTabContentsWrapper(), cert_request_info_, diff --git a/chrome/browser/ui/views/tab_contents/tab_contents_container.cc b/chrome/browser/ui/views/tab_contents/tab_contents_container.cc index 870149d..da9b522 100644 --- a/chrome/browser/ui/views/tab_contents/tab_contents_container.cc +++ b/chrome/browser/ui/views/tab_contents/tab_contents_container.cc @@ -22,33 +22,33 @@ using content::WebContents; TabContentsContainer::TabContentsContainer() : native_container_(NULL), - tab_contents_(NULL) { + web_contents_(NULL) { set_id(VIEW_ID_TAB_CONTAINER); } TabContentsContainer::~TabContentsContainer() { - if (tab_contents_) + if (web_contents_) RemoveObservers(); } -void TabContentsContainer::ChangeTabContents(TabContents* contents) { - if (tab_contents_) { - native_container_->DetachContents(tab_contents_); - tab_contents_->WasHidden(); +void TabContentsContainer::ChangeWebContents(WebContents* contents) { + if (web_contents_) { + native_container_->DetachContents(web_contents_); + web_contents_->WasHidden(); RemoveObservers(); } - tab_contents_ = contents; - // When detaching the last tab of the browser ChangeTabContents is invoked + web_contents_ = contents; + // When detaching the last tab of the browser ChangeWebContents is invoked // with NULL. Don't attempt to do anything in that case. - if (tab_contents_) { - RenderWidgetHostViewChanged(tab_contents_->GetRenderWidgetHostView()); - native_container_->AttachContents(tab_contents_); + if (web_contents_) { + RenderWidgetHostViewChanged(web_contents_->GetRenderWidgetHostView()); + native_container_->AttachContents(web_contents_); AddObservers(); } } content::WebContents* TabContentsContainer::web_contents() { - return tab_contents_; + return web_contents_; } void TabContentsContainer::WebContentsFocused(WebContents* contents) { @@ -62,8 +62,8 @@ void TabContentsContainer::SetFastResize(bool fast_resize) { void TabContentsContainer::SetReservedContentsRect( const gfx::Rect& reserved_rect) { cached_reserved_rect_ = reserved_rect; - if (tab_contents_ && tab_contents_->GetRenderWidgetHostView()) { - tab_contents_->GetRenderWidgetHostView()->set_reserved_contents_rect( + if (web_contents_ && web_contents_->GetRenderWidgetHostView()) { + web_contents_->GetRenderWidgetHostView()->set_reserved_contents_rect( reserved_rect); } } @@ -110,7 +110,7 @@ void TabContentsContainer::GetAccessibleState(ui::AccessibleViewState* state) { #if defined(HAVE_XINPUT2) bool TabContentsContainer::OnMousePressed(const views::MouseEvent& event) { - DCHECK(tab_contents_); + DCHECK(web_contents_); if (event.flags() & (ui::EF_LEFT_MOUSE_BUTTON | ui::EF_RIGHT_MOUSE_BUTTON | ui::EF_MIDDLE_MOUSE_BUTTON)) { @@ -139,10 +139,10 @@ bool TabContentsContainer::OnMousePressed(const views::MouseEvent& event) { } switch (button) { case 8: - tab_contents_->GetController().GoBack(); + web_contents_->GetController().GoBack(); return true; case 9: - tab_contents_->GetController().GoForward(); + web_contents_->GetController().GoForward(); return true; } @@ -169,12 +169,12 @@ void TabContentsContainer::AddObservers() { registrar_.Add( this, content::NOTIFICATION_RENDER_VIEW_HOST_CHANGED, - content::Source<NavigationController>(&tab_contents_->GetController())); + content::Source<NavigationController>(&web_contents_->GetController())); registrar_.Add( this, content::NOTIFICATION_WEB_CONTENTS_DESTROYED, - content::Source<WebContents>(tab_contents_)); + content::Source<WebContents>(web_contents_)); } void TabContentsContainer::RemoveObservers() { @@ -191,8 +191,8 @@ void TabContentsContainer::RenderViewHostChanged(RenderViewHost* old_host, void TabContentsContainer::TabContentsDestroyed(WebContents* contents) { // Sometimes, a TabContents is destroyed before we know about it. This allows // us to clean up our state in case this happens. - DCHECK(contents == tab_contents_); - ChangeTabContents(NULL); + DCHECK(contents == web_contents_); + ChangeWebContents(NULL); } void TabContentsContainer::RenderWidgetHostViewChanged( diff --git a/chrome/browser/ui/views/tab_contents/tab_contents_container.h b/chrome/browser/ui/views/tab_contents/tab_contents_container.h index c42cb2d..5faa0e68 100644 --- a/chrome/browser/ui/views/tab_contents/tab_contents_container.h +++ b/chrome/browser/ui/views/tab_contents/tab_contents_container.h @@ -14,7 +14,6 @@ class NativeTabContentsContainer; class RenderViewHost; class RenderWidgetHostView; -class TabContents; namespace content { class WebContents; @@ -26,8 +25,8 @@ class TabContentsContainer : public views::View, TabContentsContainer(); virtual ~TabContentsContainer(); - // Changes the TabContents associated with this view. - void ChangeTabContents(TabContents* contents); + // Changes the WebContents associated with this view. + void ChangeWebContents(content::WebContents* contents); View* GetFocusView() { return native_container_->GetView(); } @@ -84,8 +83,8 @@ class TabContentsContainer : public views::View, // view handle associated with the attached TabContents. NativeTabContentsContainer* native_container_; - // The attached TabContents. - TabContents* tab_contents_; + // The attached WebContents. + content::WebContents* web_contents_; // Handles registering for our notifications. content::NotificationRegistrar registrar_; diff --git a/chrome/browser/ui/views/wrench_menu.cc b/chrome/browser/ui/views/wrench_menu.cc index 6f4cad4..c5864af 100644 --- a/chrome/browser/ui/views/wrench_menu.cc +++ b/chrome/browser/ui/views/wrench_menu.cc @@ -45,6 +45,7 @@ #include "ui/views/widget/widget.h" using content::UserMetricsAction; +using content::WebContents; using ui::MenuModel; using views::CustomButton; using views::ImageButton; @@ -505,7 +506,7 @@ class WrenchMenu::ZoomView : public WrenchMenuView, void UpdateZoomControls() { bool enable_increment = false; bool enable_decrement = false; - TabContents* selected_tab = menu_->browser_->GetSelectedTabContents(); + WebContents* selected_tab = menu_->browser_->GetSelectedWebContents(); int zoom = 100; if (selected_tab) zoom = selected_tab->GetZoomPercent(&enable_increment, &enable_decrement); @@ -526,7 +527,7 @@ class WrenchMenu::ZoomView : public WrenchMenuView, int max_w = 0; - TabContents* selected_tab = menu_->browser_->GetSelectedTabContents(); + WebContents* selected_tab = menu_->browser_->GetSelectedWebContents(); if (selected_tab) { int min_percent = selected_tab->GetMinimumZoomPercent(); int max_percent = selected_tab->GetMaximumZoomPercent(); diff --git a/chrome/browser/ui/webui/active_downloads_ui.cc b/chrome/browser/ui/webui/active_downloads_ui.cc index 2ac5fa9..5d2cfa4 100644 --- a/chrome/browser/ui/webui/active_downloads_ui.cc +++ b/chrome/browser/ui/webui/active_downloads_ui.cc @@ -414,8 +414,7 @@ Browser* ActiveDownloadsUI::GetPopup() { it != BrowserList::end(); ++it) { if ((*it)->is_type_panel() && (*it)->is_app()) { - WebContents* web_contents = - (*it)->GetSelectedTabContentsWrapper()->web_contents(); + WebContents* web_contents = (*it)->GetSelectedWebContents(); DCHECK(web_contents); if (!web_contents) continue; diff --git a/chrome/browser/ui/webui/ntp/app_launcher_handler.cc b/chrome/browser/ui/webui/ntp/app_launcher_handler.cc index f48510f..21c0d22 100644 --- a/chrome/browser/ui/webui/ntp/app_launcher_handler.cc +++ b/chrome/browser/ui/webui/ntp/app_launcher_handler.cc @@ -559,11 +559,11 @@ void AppLauncherHandler::HandleLaunchApp(const ListValue* args) { // To give a more "launchy" experience when using the NTP launcher, we close // it automatically. Browser* browser = BrowserList::GetLastActiveWithProfile(profile); - TabContents* old_contents = NULL; + WebContents* old_contents = NULL; if (browser) - old_contents = browser->GetSelectedTabContents(); + old_contents = browser->GetSelectedWebContents(); - TabContents* new_contents = Browser::OpenApplication( + WebContents* new_contents = Browser::OpenApplication( profile, extension, launch_container, GURL(url), old_contents ? CURRENT_TAB : NEW_FOREGROUND_TAB); diff --git a/chrome/browser/ui/webui/web_ui_browsertest.cc b/chrome/browser/ui/webui/web_ui_browsertest.cc index 3a67dc3..38a5c49 100644 --- a/chrome/browser/ui/webui/web_ui_browsertest.cc +++ b/chrome/browser/ui/webui/web_ui_browsertest.cc @@ -22,7 +22,7 @@ #include "chrome/common/url_constants.h" #include "chrome/test/base/test_tab_strip_model_observer.h" #include "chrome/test/base/ui_test_utils.h" -#include "content/browser/tab_contents/tab_contents.h" +#include "content/public/browser/web_contents.h" #include "content/public/browser/web_ui_message_handler.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest-spi.h" @@ -182,7 +182,7 @@ void WebUIBrowserTest::PreLoadJavascriptLibraries( void WebUIBrowserTest::BrowsePreload(const GURL& browse_to) { TestNavigationObserver navigation_observer( content::Source<NavigationController>( - &browser()->GetSelectedTabContentsWrapper()->tab_contents()-> + &browser()->GetSelectedTabContentsWrapper()->web_contents()-> GetController()), this, 1); browser::NavigateParams params( @@ -213,7 +213,7 @@ void WebUIBrowserTest::BrowsePrintPreload(const GURL& browse_to) { TabContentsWrapper* preview_tab = tab_controller->GetPrintPreviewForTab( browser()->GetSelectedTabContentsWrapper()); ASSERT_TRUE(preview_tab); - SetWebUIInstance(preview_tab->tab_contents()->GetWebUI()); + SetWebUIInstance(preview_tab->web_contents()->GetWebUI()); } const char WebUIBrowserTest::kDummyURL[] = "chrome://DummyURL"; @@ -409,7 +409,7 @@ bool WebUIBrowserTest::RunJavascriptUsingHandler( void WebUIBrowserTest::SetupHandlers() { WebUI* web_ui_instance = override_selected_web_ui_ ? override_selected_web_ui_ : - browser()->GetSelectedTabContents()->GetWebUI(); + browser()->GetSelectedWebContents()->GetWebUI(); ASSERT_TRUE(web_ui_instance != NULL); web_ui_instance->set_register_callback_overwrites(true); test_handler_->set_web_ui(web_ui_instance); diff --git a/chrome/browser/ui/webui/workers_ui_browsertest.cc b/chrome/browser/ui/webui/workers_ui_browsertest.cc index c78e84c..39fbfa1 100644 --- a/chrome/browser/ui/webui/workers_ui_browsertest.cc +++ b/chrome/browser/ui/webui/workers_ui_browsertest.cc @@ -6,8 +6,10 @@ #include "chrome/common/url_constants.h" #include "chrome/test/base/in_process_browser_test.h" #include "chrome/test/base/ui_test_utils.h" -#include "content/browser/tab_contents/tab_contents.h" #include "content/public/browser/navigation_details.h" +#include "content/public/browser/web_contents.h" + +using content::WebContents; namespace { @@ -44,13 +46,13 @@ IN_PROC_BROWSER_TEST_F(WorkersUITest, MAYBE_SharedWorkersList) { NEW_FOREGROUND_TAB, ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); - TabContents* tab_contents = browser()->GetSelectedTabContents(); - ASSERT_TRUE(tab_contents != NULL); + WebContents* web_contents = browser()->GetSelectedWebContents(); + ASSERT_TRUE(web_contents != NULL); std::string result; ASSERT_TRUE( ui_test_utils::ExecuteJavaScriptAndExtractString( - tab_contents->GetRenderViewHost(), + web_contents->GetRenderViewHost(), L"", L"window.domAutomationController.send(" L"'' + document.getElementsByTagName('td')[1].textContent);", diff --git a/chrome/test/base/ui_test_utils.cc b/chrome/test/base/ui_test_utils.cc index 5cb2e63..01d332e 100644 --- a/chrome/test/base/ui_test_utils.cc +++ b/chrome/test/base/ui_test_utils.cc @@ -304,10 +304,10 @@ void RunAllPendingInMessageLoop(content::BrowserThread::ID thread_id) { } bool GetCurrentTabTitle(const Browser* browser, string16* title) { - TabContents* tab_contents = browser->GetSelectedTabContents(); - if (!tab_contents) + WebContents* web_contents = browser->GetSelectedWebContents(); + if (!web_contents) return false; - NavigationEntry* last_entry = tab_contents->GetController().GetActiveEntry(); + NavigationEntry* last_entry = web_contents->GetController().GetActiveEntry(); if (!last_entry) return false; title->assign(last_entry->GetTitleForDisplay("")); @@ -338,7 +338,7 @@ void WaitForBrowserActionUpdated(ExtensionAction* browser_action) { content::Source<ExtensionAction>(browser_action)); } -void WaitForLoadStop(TabContents* tab) { +void WaitForLoadStop(WebContents* tab) { WindowedNotificationObserver load_stop_observer( content::NOTIFICATION_LOAD_STOP, content::Source<NavigationController>(&tab->GetController())); @@ -371,7 +371,7 @@ void OpenURLOffTheRecord(Profile* profile, const GURL& url) { Browser::OpenURLOffTheRecord(profile, url); Browser* browser = BrowserList::FindTabbedBrowser( profile->GetOffTheRecordProfile(), false); - WaitForNavigations(&browser->GetSelectedTabContents()->GetController(), 1); + WaitForNavigations(&browser->GetSelectedWebContents()->GetController(), 1); } void NavigateToURL(browser::NavigateParams* params) { @@ -400,11 +400,11 @@ static void NavigateToURLWithDispositionBlockUntilNavigationsComplete( int number_of_navigations, WindowOpenDisposition disposition, int browser_test_flags) { - if (disposition == CURRENT_TAB && browser->GetSelectedTabContents()) - WaitForLoadStop(browser->GetSelectedTabContents()); + if (disposition == CURRENT_TAB && browser->GetSelectedWebContents()) + WaitForLoadStop(browser->GetSelectedWebContents()); TestNavigationObserver same_tab_observer( content::Source<NavigationController>( - &browser->GetSelectedTabContents()->GetController()), + &browser->GetSelectedWebContents()->GetController()), NULL, number_of_navigations); @@ -429,11 +429,11 @@ static void NavigateToURLWithDispositionBlockUntilNavigationsComplete( // Some other flag caused the wait prior to this. return; } - TabContents* tab_contents = NULL; + WebContents* web_contents = NULL; if (disposition == NEW_BACKGROUND_TAB) { // We've opened up a new tab, but not selected it. - tab_contents = browser->GetTabContentsAt(browser->active_index() + 1); - EXPECT_TRUE(tab_contents != NULL) + web_contents = browser->GetTabContentsAt(browser->active_index() + 1); + EXPECT_TRUE(web_contents != NULL) << " Unable to wait for navigation to \"" << url.spec() << "\" because the new tab is not available yet"; return; @@ -441,7 +441,7 @@ static void NavigateToURLWithDispositionBlockUntilNavigationsComplete( (disposition == NEW_FOREGROUND_TAB) || (disposition == SINGLETON_TAB)) { // The currently selected tab is the right one. - tab_contents = browser->GetSelectedTabContents(); + web_contents = browser->GetSelectedWebContents(); } if (disposition == CURRENT_TAB) { same_tab_observer.WaitForObservation( @@ -449,12 +449,12 @@ static void NavigateToURLWithDispositionBlockUntilNavigationsComplete( base::Bind(&MessageLoop::Quit, base::Unretained(MessageLoopForUI::current()))); return; - } else if (tab_contents) { - NavigationController* controller = &tab_contents->GetController(); + } else if (web_contents) { + NavigationController* controller = &web_contents->GetController(); WaitForNavigations(controller, number_of_navigations); return; } - EXPECT_TRUE(NULL != tab_contents) << " Unable to wait for navigation to \"" + EXPECT_TRUE(NULL != web_contents) << " Unable to wait for navigation to \"" << url.spec() << "\"" << " because we can't get the tab contents"; } @@ -485,7 +485,7 @@ void NavigateToURLBlockUntilNavigationsComplete(Browser* browser, DOMElementProxyRef GetActiveDOMDocument(Browser* browser) { JavaScriptExecutionController* executor = new InProcessJavaScriptExecutionController( - browser->GetSelectedTabContents()->GetRenderViewHost()); + browser->GetSelectedWebContents()->GetRenderViewHost()); int element_handle; executor->ExecuteJavaScriptAndGetReturn("document;", &element_handle); return executor->GetObjectProxy<DOMElementProxy>(element_handle); @@ -566,7 +566,7 @@ AppModalDialog* WaitForAppModalDialog() { return content::Source<AppModalDialog>(observer.source()).ptr(); } -void CrashTab(TabContents* tab) { +void CrashTab(WebContents* tab) { content::RenderProcessHost* rph = tab->GetRenderProcessHost(); base::KillProcess(rph->GetHandle(), 0, false); TestNotificationObserver observer; diff --git a/chrome/test/base/ui_test_utils.h b/chrome/test/base/ui_test_utils.h index 4fce446..3657c4e 100644 --- a/chrome/test/base/ui_test_utils.h +++ b/chrome/test/base/ui_test_utils.h @@ -54,6 +54,10 @@ namespace browser { struct NavigateParams; } +namespace content { +class WebContents; +} + namespace gfx { class Size; } @@ -106,7 +110,7 @@ void WaitForBrowserActionUpdated(ExtensionAction* browser_action); // Waits for a load stop for the specified |tab|'s controller, if the tab is // currently loading. Otherwise returns immediately. -void WaitForLoadStop(TabContents* tab); +void WaitForLoadStop(content::WebContents* tab); // Waits for a new browser to be created, returning the browser. Browser* WaitForNewBrowser(); @@ -192,7 +196,7 @@ GURL GetFileUrlWithQuery(const FilePath& path, const std::string& query_string); AppModalDialog* WaitForAppModalDialog(); // Causes the specified tab to crash. Blocks until it is crashed. -void CrashTab(TabContents* tab); +void CrashTab(content::WebContents* tab); // Performs a find in the page of the specified tab. Returns the number of // matches found. |ordinal| is an optional parameter which is set to the index diff --git a/chrome/test/data/webui/hung_renderer_dialog_ui_test-inl.h b/chrome/test/data/webui/hung_renderer_dialog_ui_test-inl.h index 5552d8b..9fd0e8e 100644 --- a/chrome/test/data/webui/hung_renderer_dialog_ui_test-inl.h +++ b/chrome/test/data/webui/hung_renderer_dialog_ui_test-inl.h @@ -12,6 +12,8 @@ #include "content/browser/tab_contents/tab_contents.h" #include "content/browser/webui/web_ui.h" +using content::WebContents; + // Test framework for chrome/test/data/webui/hung_renderer_dialog_test.js. class HungRendererDialogUITest : public WebUIBrowserTest { public: @@ -29,14 +31,14 @@ void HungRendererDialogUITest::ShowHungRendererDialogInternal() { // Choose which tab contents to report as hung. In this case, the default // tab contents will be about:blank. ASSERT_TRUE(browser()); - TabContents* tab_contents = browser()->GetSelectedTabContents(); + WebContents* web_contents = browser()->GetSelectedWebContents(); // The TestHtmlDialogObserver will catch our dialog when it gets created. TestHtmlDialogObserver dialog_observer(this); // Show a disabled Hung Renderer Dialog that won't kill processes or restart // hang timers. - HungRendererDialog::ShowHungRendererDialogInternal(tab_contents, false); + HungRendererDialog::ShowHungRendererDialogInternal(web_contents, false); // Now we can get the WebUI object from the observer, and make some details // about our test available to the JavaScript. diff --git a/content/browser/accessibility/renderer_accessibility_browsertest.cc b/content/browser/accessibility/renderer_accessibility_browsertest.cc index 82ee0d6..8a07a7b 100644 --- a/content/browser/accessibility/renderer_accessibility_browsertest.cc +++ b/content/browser/accessibility/renderer_accessibility_browsertest.cc @@ -12,9 +12,9 @@ #include "content/browser/renderer_host/render_view_host.h" #include "content/browser/renderer_host/render_widget_host.h" #include "content/browser/renderer_host/render_widget_host_view.h" -#include "content/browser/tab_contents/tab_contents.h" #include "content/public/browser/notification_service.h" #include "content/public/browser/notification_types.h" +#include "content/public/browser/web_contents.h" #if defined(OS_WIN) #include <atlbase.h> @@ -39,7 +39,7 @@ class RendererAccessibilityBrowserTest : public InProcessBrowserTest { content::NOTIFICATION_RENDER_VIEW_HOST_ACCESSIBILITY_TREE_UPDATED, content::NotificationService::AllSources()); RenderWidgetHostView* host_view = - browser()->GetSelectedTabContents()->GetRenderWidgetHostView(); + browser()->GetSelectedWebContents()->GetRenderWidgetHostView(); RenderWidgetHost* host = host_view->GetRenderWidgetHost(); RenderViewHost* view_host = static_cast<RenderViewHost*>(host); view_host->set_save_accessibility_tree_for_testing(true); diff --git a/content/browser/device_orientation/device_orientation_browsertest.cc b/content/browser/device_orientation/device_orientation_browsertest.cc index 03a2c7f..7fb2899 100644 --- a/content/browser/device_orientation/device_orientation_browsertest.cc +++ b/content/browser/device_orientation/device_orientation_browsertest.cc @@ -10,7 +10,7 @@ #include "chrome/test/base/ui_test_utils.h" #include "content/browser/device_orientation/orientation.h" #include "content/browser/device_orientation/provider.h" -#include "content/browser/tab_contents/tab_contents.h" +#include "content/public/browser/web_contents.h" #include "content/public/common/content_switches.h" namespace device_orientation { @@ -62,7 +62,7 @@ IN_PROC_BROWSER_TEST_F(DeviceOrientationBrowserTest, BasicTest) { // Check that the page got the event it expected and that the provider // saw requests for adding and removing an observer. - EXPECT_EQ("pass", browser()->GetSelectedTabContents()->GetURL().ref()); + EXPECT_EQ("pass", browser()->GetSelectedWebContents()->GetURL().ref()); EXPECT_TRUE(provider->added_observer_); EXPECT_TRUE(provider->removed_observer_); } diff --git a/content/browser/download/mhtml_generation_browsertest.cc b/content/browser/download/mhtml_generation_browsertest.cc index 4b81e35..ec91405 100644 --- a/content/browser/download/mhtml_generation_browsertest.cc +++ b/content/browser/download/mhtml_generation_browsertest.cc @@ -10,10 +10,12 @@ #include "chrome/test/base/testing_browser_process.h" #include "chrome/test/base/ui_test_utils.h" #include "content/browser/download/mhtml_generation_manager.h" -#include "content/browser/tab_contents/tab_contents.h" +#include "content/public/browser/web_contents.h" #include "net/test/test_server.h" #include "testing/gtest/include/gtest/gtest.h" +using content::WebContents; + namespace { class MHTMLGenerationTest : public InProcessBrowserTest { @@ -55,7 +57,7 @@ IN_PROC_BROWSER_TEST_F(MHTMLGenerationTest, GenerateMHTML) { ui_test_utils::NavigateToURL(browser(), test_server()->GetURL("files/google/google.html")); - TabContents* tab = browser()->GetSelectedTabContents(); + WebContents* tab = browser()->GetSelectedWebContents(); MHTMLGenerationManager* mhtml_generation_manager = g_browser_process->mhtml_generation_manager(); diff --git a/content/browser/download/mhtml_generation_manager.cc b/content/browser/download/mhtml_generation_manager.cc index d263662..8e0ab7e 100644 --- a/content/browser/download/mhtml_generation_manager.cc +++ b/content/browser/download/mhtml_generation_manager.cc @@ -8,12 +8,13 @@ #include "base/platform_file.h" #include "content/browser/renderer_host/render_process_host_impl.h" #include "content/browser/renderer_host/render_view_host.h" -#include "content/browser/tab_contents/tab_contents.h" #include "content/public/browser/notification_service.h" +#include "content/public/browser/web_contents.h" #include "content/common/view_messages.h" #include "content/public/browser/notification_types.h" using content::BrowserThread; +using content::WebContents; MHTMLGenerationManager::Job::Job() : browser_file(base::kInvalidPlatformFileValue), @@ -31,7 +32,7 @@ MHTMLGenerationManager::MHTMLGenerationManager() { MHTMLGenerationManager::~MHTMLGenerationManager() { } -void MHTMLGenerationManager::GenerateMHTML(TabContents* tab_contents, +void MHTMLGenerationManager::GenerateMHTML(WebContents* web_contents, const FilePath& file, const GenerateMHTMLCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); @@ -40,13 +41,13 @@ void MHTMLGenerationManager::GenerateMHTML(TabContents* tab_contents, int job_id = id_counter++; Job job; job.file_path = file; - job.process_id = tab_contents->GetRenderProcessHost()->GetID(); - job.routing_id = tab_contents->GetRenderViewHost()->routing_id(); + job.process_id = web_contents->GetRenderProcessHost()->GetID(); + job.routing_id = web_contents->GetRenderViewHost()->routing_id(); job.callback = callback; id_to_job_[job_id] = job; base::ProcessHandle renderer_process = - tab_contents->GetRenderProcessHost()->GetHandle(); + web_contents->GetRenderProcessHost()->GetHandle(); BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, base::Bind(&MHTMLGenerationManager::CreateFile, this, job_id, file, renderer_process)); diff --git a/content/browser/download/mhtml_generation_manager.h b/content/browser/download/mhtml_generation_manager.h index 0190657..8c3635d 100644 --- a/content/browser/download/mhtml_generation_manager.h +++ b/content/browser/download/mhtml_generation_manager.h @@ -15,7 +15,10 @@ #include "ipc/ipc_platform_file.h" class FilePath; -class TabContents; + +namespace content { +class WebContents; +} class CONTENT_EXPORT MHTMLGenerationManager : public base::RefCountedThreadSafe< @@ -28,8 +31,8 @@ class CONTENT_EXPORT MHTMLGenerationManager int64 /* size of the file */)> GenerateMHTMLCallback; // Instructs the render view to generate a MHTML representation of the current - // page for |tab_contents|. - void GenerateMHTML(TabContents* tab_contents, + // page for |web_contents|. + void GenerateMHTML(content::WebContents* web_contents, const FilePath& file, const GenerateMHTMLCallback& callback); diff --git a/content/browser/file_system/file_system_browsertest.cc b/content/browser/file_system/file_system_browsertest.cc index 75fac0f..582cd08 100644 --- a/content/browser/file_system/file_system_browsertest.cc +++ b/content/browser/file_system/file_system_browsertest.cc @@ -40,11 +40,11 @@ class FileSystemBrowserTest : public InProcessBrowserTest { ui_test_utils::NavigateToURLBlockUntilNavigationsComplete( the_browser, test_url, 2); LOG(INFO) << "Navigation done."; - std::string result = the_browser->GetSelectedTabContents()->GetURL().ref(); + std::string result = the_browser->GetSelectedWebContents()->GetURL().ref(); if (result != "pass") { std::string js_result; ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractString( - the_browser->GetSelectedTabContents()->GetRenderViewHost(), L"", + the_browser->GetSelectedWebContents()->GetRenderViewHost(), L"", L"window.domAutomationController.send(getLog())", &js_result)); FAIL() << "Failed: " << js_result; } diff --git a/content/browser/in_process_webkit/indexed_db_browsertest.cc b/content/browser/in_process_webkit/indexed_db_browsertest.cc index 6617ed4..ac375ed 100644 --- a/content/browser/in_process_webkit/indexed_db_browsertest.cc +++ b/content/browser/in_process_webkit/indexed_db_browsertest.cc @@ -49,11 +49,11 @@ class IndexedDBBrowserTest : public InProcessBrowserTest { ui_test_utils::NavigateToURLBlockUntilNavigationsComplete( the_browser, test_url, 2); LOG(INFO) << "Navigation done."; - std::string result = the_browser->GetSelectedTabContents()->GetURL().ref(); + std::string result = the_browser->GetSelectedWebContents()->GetURL().ref(); if (result != "pass") { std::string js_result; ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractString( - the_browser->GetSelectedTabContents()->GetRenderViewHost(), L"", + the_browser->GetSelectedWebContents()->GetRenderViewHost(), L"", L"window.domAutomationController.send(getLog())", &js_result)); FAIL() << "Failed: " << js_result; } @@ -113,7 +113,7 @@ IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTest, DISABLED_TransactionTest) { IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTest, DISABLED_DoesntHangTest) { SimpleTest(testUrl(FilePath( FILE_PATH_LITERAL("transaction_run_forever.html")))); - ui_test_utils::CrashTab(browser()->GetSelectedTabContents()); + ui_test_utils::CrashTab(browser()->GetSelectedWebContents()); SimpleTest(testUrl(FilePath(FILE_PATH_LITERAL("transaction_test.html")))); } diff --git a/content/browser/renderer_host/render_process_host_browsertest.cc b/content/browser/renderer_host/render_process_host_browsertest.cc index 5740395..9db2c2f 100644 --- a/content/browser/renderer_host/render_process_host_browsertest.cc +++ b/content/browser/renderer_host/render_process_host_browsertest.cc @@ -15,6 +15,8 @@ #include "content/public/browser/browser_thread.h" #include "content/public/common/content_switches.h" +using content::WebContents; + RenderProcessHostTest::RenderProcessHostTest() { EnableDOMAutomation(); } @@ -42,8 +44,8 @@ void DoNothing() {} // handle. base::ProcessHandle RenderProcessHostTest::ShowSingletonTab(const GURL& page) { browser()->ShowSingletonTab(page); - TabContents* tc = browser()->GetSelectedTabContents(); - CHECK(tc->GetURL() == page); + WebContents* wc = browser()->GetSelectedWebContents(); + CHECK(wc->GetURL() == page); // Ensure that the backgrounding / foregrounding gets a chance to run. content::BrowserThread::PostTaskAndReply( @@ -51,7 +53,7 @@ base::ProcessHandle RenderProcessHostTest::ShowSingletonTab(const GURL& page) { base::Bind(DoNothing), MessageLoop::QuitClosure()); MessageLoop::current()->Run(); - return tc->GetRenderProcessHost()->GetHandle(); + return wc->GetRenderProcessHost()->GetHandle(); } IN_PROC_BROWSER_TEST_F(RenderProcessHostTest, ProcessPerTab) { diff --git a/content/browser/renderer_host/render_view_host_browsertest.cc b/content/browser/renderer_host/render_view_host_browsertest.cc index 22204ce..e8c44df 100644 --- a/content/browser/renderer_host/render_view_host_browsertest.cc +++ b/content/browser/renderer_host/render_view_host_browsertest.cc @@ -17,6 +17,8 @@ #include "net/base/net_util.h" #include "net/test/test_server.h" +using content::WebContents; + class RenderViewHostTest : public InProcessBrowserTest { public: RenderViewHostTest() {} @@ -30,7 +32,7 @@ IN_PROC_BROWSER_TEST_F(RenderViewHostTest, ui_test_utils::NavigateToURL(browser(), empty_url); RenderViewHost* rvh = - browser()->GetSelectedTabContents()->GetRenderViewHost(); + browser()->GetSelectedWebContents()->GetRenderViewHost(); { Value* value = rvh->ExecuteJavascriptAndGetValue(string16(), @@ -164,8 +166,8 @@ IN_PROC_BROWSER_TEST_F(RenderViewHostTest, class RenderViewHostTestWebContentsObserver : public content::WebContentsObserver { public: - explicit RenderViewHostTestWebContentsObserver(TabContents* tab_contents) - : content::WebContentsObserver(tab_contents), + explicit RenderViewHostTestWebContentsObserver(WebContents* web_contents) + : content::WebContentsObserver(web_contents), navigation_count_(0) {} virtual ~RenderViewHostTestWebContentsObserver() {} @@ -198,7 +200,7 @@ class RenderViewHostTestWebContentsObserver IN_PROC_BROWSER_TEST_F(RenderViewHostTest, FrameNavigateSocketAddress) { ASSERT_TRUE(test_server()->Start()); RenderViewHostTestWebContentsObserver observer( - browser()->GetSelectedTabContents()); + browser()->GetSelectedWebContents()); GURL test_url = test_server()->GetURL("files/simple.html"); ui_test_utils::NavigateToURL(browser(), test_url); @@ -211,7 +213,7 @@ IN_PROC_BROWSER_TEST_F(RenderViewHostTest, FrameNavigateSocketAddress) { IN_PROC_BROWSER_TEST_F(RenderViewHostTest, BaseURLParam) { ASSERT_TRUE(test_server()->Start()); RenderViewHostTestWebContentsObserver observer( - browser()->GetSelectedTabContents()); + browser()->GetSelectedWebContents()); // Base URL is not set if it is the same as the URL. GURL test_url = test_server()->GetURL("files/simple.html"); diff --git a/content/browser/renderer_host/render_view_host_manager_browsertest.cc b/content/browser/renderer_host/render_view_host_manager_browsertest.cc index d9582da..e14db12 100644 --- a/content/browser/renderer_host/render_view_host_manager_browsertest.cc +++ b/content/browser/renderer_host/render_view_host_manager_browsertest.cc @@ -60,13 +60,13 @@ IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, // Get the original SiteInstance for later comparison. scoped_refptr<SiteInstance> orig_site_instance( - browser()->GetSelectedTabContents()->GetSiteInstance()); + browser()->GetSelectedWebContents()->GetSiteInstance()); EXPECT_TRUE(orig_site_instance != NULL); // Test clicking a rel=noreferrer + target=blank link. bool success = false; EXPECT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( - browser()->GetSelectedTabContents()->GetRenderViewHost(), L"", + browser()->GetSelectedWebContents()->GetRenderViewHost(), L"", L"window.domAutomationController.send(clickNoRefTargetBlankLink());", &success)); EXPECT_TRUE(success); @@ -79,16 +79,16 @@ IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, EXPECT_EQ(2, browser()->tab_count()); EXPECT_EQ(1, browser()->active_index()); EXPECT_EQ("/files/title2.html", - browser()->GetSelectedTabContents()->GetURL().path()); + browser()->GetSelectedWebContents()->GetURL().path()); // Wait for the cross-site transition in the new tab to finish. - ui_test_utils::WaitForLoadStop(browser()->GetSelectedTabContents()); - EXPECT_FALSE(browser()->GetSelectedTabContents()-> + ui_test_utils::WaitForLoadStop(browser()->GetSelectedWebContents()); + EXPECT_FALSE(browser()->GetSelectedWebContents()-> GetRenderManagerForTesting()->pending_render_view_host()); // Should have a new SiteInstance. scoped_refptr<SiteInstance> noref_blank_site_instance( - browser()->GetSelectedTabContents()->GetSiteInstance()); + browser()->GetSelectedWebContents()->GetSiteInstance()); EXPECT_NE(orig_site_instance, noref_blank_site_instance); } @@ -114,13 +114,13 @@ IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, // Get the original SiteInstance for later comparison. scoped_refptr<SiteInstance> orig_site_instance( - browser()->GetSelectedTabContents()->GetSiteInstance()); + browser()->GetSelectedWebContents()->GetSiteInstance()); EXPECT_TRUE(orig_site_instance != NULL); // Test clicking a target=blank link. bool success = false; EXPECT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( - browser()->GetSelectedTabContents()->GetRenderViewHost(), L"", + browser()->GetSelectedWebContents()->GetRenderViewHost(), L"", L"window.domAutomationController.send(clickTargetBlankLink());", &success)); EXPECT_TRUE(success); @@ -134,13 +134,13 @@ IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, EXPECT_EQ(1, browser()->active_index()); // Wait for the cross-site transition in the new tab to finish. - ui_test_utils::WaitForLoadStop(browser()->GetSelectedTabContents()); + ui_test_utils::WaitForLoadStop(browser()->GetSelectedWebContents()); EXPECT_EQ("/files/title2.html", - browser()->GetSelectedTabContents()->GetURL().path()); + browser()->GetSelectedWebContents()->GetURL().path()); // Should have the same SiteInstance. scoped_refptr<SiteInstance> blank_site_instance( - browser()->GetSelectedTabContents()->GetSiteInstance()); + browser()->GetSelectedWebContents()->GetSiteInstance()); EXPECT_EQ(orig_site_instance, blank_site_instance); } @@ -166,29 +166,29 @@ IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, // Get the original SiteInstance for later comparison. scoped_refptr<SiteInstance> orig_site_instance( - browser()->GetSelectedTabContents()->GetSiteInstance()); + browser()->GetSelectedWebContents()->GetSiteInstance()); EXPECT_TRUE(orig_site_instance != NULL); // Test clicking a rel=noreferrer link. bool success = false; EXPECT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( - browser()->GetSelectedTabContents()->GetRenderViewHost(), L"", + browser()->GetSelectedWebContents()->GetRenderViewHost(), L"", L"window.domAutomationController.send(clickNoRefLink());", &success)); EXPECT_TRUE(success); // Wait for the cross-site transition in the current tab to finish. - ui_test_utils::WaitForLoadStop(browser()->GetSelectedTabContents()); + ui_test_utils::WaitForLoadStop(browser()->GetSelectedWebContents()); // Opens in same tab. EXPECT_EQ(1, browser()->tab_count()); EXPECT_EQ(0, browser()->active_index()); EXPECT_EQ("/files/title2.html", - browser()->GetSelectedTabContents()->GetURL().path()); + browser()->GetSelectedWebContents()->GetURL().path()); // Should have the same SiteInstance. scoped_refptr<SiteInstance> noref_site_instance( - browser()->GetSelectedTabContents()->GetSiteInstance()); + browser()->GetSelectedWebContents()->GetSiteInstance()); EXPECT_EQ(orig_site_instance, noref_site_instance); } @@ -214,7 +214,7 @@ IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, ClickLinkAfter204Error) { // Get the original SiteInstance for later comparison. scoped_refptr<SiteInstance> orig_site_instance( - browser()->GetSelectedTabContents()->GetSiteInstance()); + browser()->GetSelectedWebContents()->GetSiteInstance()); EXPECT_TRUE(orig_site_instance != NULL); // Load a cross-site page that fails with a 204 error. @@ -222,31 +222,31 @@ IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, ClickLinkAfter204Error) { // We should still be looking at the normal page. scoped_refptr<SiteInstance> post_nav_site_instance( - browser()->GetSelectedTabContents()->GetSiteInstance()); + browser()->GetSelectedWebContents()->GetSiteInstance()); EXPECT_EQ(orig_site_instance, post_nav_site_instance); EXPECT_EQ("/files/click-noreferrer-links.html", - browser()->GetSelectedTabContents()->GetURL().path()); + browser()->GetSelectedWebContents()->GetURL().path()); // Renderer-initiated navigations should work. bool success = false; EXPECT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( - browser()->GetSelectedTabContents()->GetRenderViewHost(), L"", + browser()->GetSelectedWebContents()->GetRenderViewHost(), L"", L"window.domAutomationController.send(clickNoRefLink());", &success)); EXPECT_TRUE(success); // Wait for the cross-site transition in the current tab to finish. - ui_test_utils::WaitForLoadStop(browser()->GetSelectedTabContents()); + ui_test_utils::WaitForLoadStop(browser()->GetSelectedWebContents()); // Opens in same tab. EXPECT_EQ(1, browser()->tab_count()); EXPECT_EQ(0, browser()->active_index()); EXPECT_EQ("/files/title2.html", - browser()->GetSelectedTabContents()->GetURL().path()); + browser()->GetSelectedWebContents()->GetURL().path()); // Should have the same SiteInstance. scoped_refptr<SiteInstance> noref_site_instance( - browser()->GetSelectedTabContents()->GetSiteInstance()); + browser()->GetSelectedWebContents()->GetSiteInstance()); EXPECT_EQ(orig_site_instance, noref_site_instance); } @@ -316,22 +316,22 @@ IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, LeakingRenderViewHosts) { // Observe the newly created render_view_host to make sure it will not leak. RenderViewHostObserverArray rvh_observers; - rvh_observers.AddObserverToRVH(browser()->GetSelectedTabContents()-> + rvh_observers.AddObserverToRVH(browser()->GetSelectedWebContents()-> GetRenderViewHost()); GURL view_source_url(chrome::kViewSourceScheme + std::string(":") + navigated_url.spec()); ui_test_utils::NavigateToURL(browser(), view_source_url); - rvh_observers.AddObserverToRVH(browser()->GetSelectedTabContents()-> + rvh_observers.AddObserverToRVH(browser()->GetSelectedWebContents()-> GetRenderViewHost()); // Now navigate to a different instance so that we swap out again. ui_test_utils::NavigateToURL(browser(), https_server.GetURL("files/title2.html")); - rvh_observers.AddObserverToRVH(browser()->GetSelectedTabContents()-> + rvh_observers.AddObserverToRVH(browser()->GetSelectedWebContents()-> GetRenderViewHost()); // This used to leak a render view host. - browser()->CloseTabContents(browser()->GetSelectedTabContents()); + browser()->CloseTabContents(browser()->GetSelectedWebContents()); EXPECT_EQ(0U, rvh_observers.GetNumObservers()); } diff --git a/content/browser/renderer_host/resource_dispatcher_host_browsertest.cc b/content/browser/renderer_host/resource_dispatcher_host_browsertest.cc index c8ef3ed..74e4546 100644 --- a/content/browser/renderer_host/resource_dispatcher_host_browsertest.cc +++ b/content/browser/renderer_host/resource_dispatcher_host_browsertest.cc @@ -20,7 +20,7 @@ class ResourceDispatcherHostBrowserTest : public InProcessBrowserTest { protected: RenderViewHost* render_view_host() { - return browser()->GetSelectedTabContents()->GetRenderViewHost(); + return browser()->GetSelectedWebContents()->GetRenderViewHost(); } bool GetPopupTitle(const GURL& url, string16* title); diff --git a/content/browser/speech/speech_input_browsertest.cc b/content/browser/speech/speech_input_browsertest.cc index 204d988..f0f9f2b 100644 --- a/content/browser/speech/speech_input_browsertest.cc +++ b/content/browser/speech/speech_input_browsertest.cc @@ -19,6 +19,8 @@ #include "content/public/common/speech_input_result.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" +using content::WebContents; + namespace speech_input { class FakeSpeechInputManager; } @@ -160,13 +162,13 @@ class SpeechInputBrowserTest : public InProcessBrowserTest { mouse_event.x = 0; mouse_event.y = 0; mouse_event.clickCount = 1; - TabContents* tab_contents = browser()->GetSelectedTabContents(); + WebContents* web_contents = browser()->GetSelectedWebContents(); ui_test_utils::WindowedNotificationObserver observer( content::NOTIFICATION_LOAD_STOP, - content::Source<NavigationController>(&tab_contents->GetController())); - tab_contents->GetRenderViewHost()->ForwardMouseEvent(mouse_event); + content::Source<NavigationController>(&web_contents->GetController())); + web_contents->GetRenderViewHost()->ForwardMouseEvent(mouse_event); mouse_event.type = WebKit::WebInputEvent::MouseUp; - tab_contents->GetRenderViewHost()->ForwardMouseEvent(mouse_event); + web_contents->GetRenderViewHost()->ForwardMouseEvent(mouse_event); observer.Wait(); } @@ -176,7 +178,7 @@ class SpeechInputBrowserTest : public InProcessBrowserTest { // then sets the URL fragment as 'pass' if it received the expected string. LoadAndStartSpeechInputTest(filename); - EXPECT_EQ("pass", browser()->GetSelectedTabContents()->GetURL().ref()); + EXPECT_EQ("pass", browser()->GetSelectedWebContents()->GetURL().ref()); } // InProcessBrowserTest methods. diff --git a/content/browser/tab_contents/tab_contents.cc b/content/browser/tab_contents/tab_contents.cc index 8b26b57..f8399ff 100644 --- a/content/browser/tab_contents/tab_contents.cc +++ b/content/browser/tab_contents/tab_contents.cc @@ -1560,8 +1560,8 @@ void TabContents::NotifySwapped() { // pointer. See Bug 1230284. notify_disconnection_ = true; content::NotificationService::current()->Notify( - content::NOTIFICATION_TAB_CONTENTS_SWAPPED, - content::Source<TabContents>(this), + content::NOTIFICATION_WEB_CONTENTS_SWAPPED, + content::Source<WebContents>(this), content::NotificationService::NoDetails()); } diff --git a/content/browser/webkit_browsertest.cc b/content/browser/webkit_browsertest.cc index 4970828..4126826 100644 --- a/content/browser/webkit_browsertest.cc +++ b/content/browser/webkit_browsertest.cc @@ -10,6 +10,8 @@ typedef InProcessBrowserTest WebKitBrowserTest; +using content::WebContents; + const char kAsyncScriptThatAbortsOnEndPage[] = "files/webkit/async_script_abort_on_end.html"; @@ -26,12 +28,12 @@ IN_PROC_BROWSER_TEST_F(WebKitBrowserTest, AbortOnEnd) { ui_test_utils::NavigateToURL(browser(), url); - TabContents* tab_contents = browser()->GetSelectedTabContents(); + WebContents* web_contents = browser()->GetSelectedWebContents(); // If you are seeing this test fail, please strongly investigate the // possibility that http://crbug.com/75604 and // https://bugs.webkit.org/show_bug.cgi?id=71122 have reverted before // marking this as flakey. - EXPECT_FALSE(tab_contents->IsCrashed()); + EXPECT_FALSE(web_contents->IsCrashed()); } // This is a browser test because the DumpRenderTree framework holds @@ -50,6 +52,6 @@ IN_PROC_BROWSER_TEST_F(WebKitBrowserTest, XsltBadImport) { ui_test_utils::NavigateToURL(browser(), url); - TabContents* tab_contents = browser()->GetSelectedTabContents(); - EXPECT_FALSE(tab_contents->IsCrashed()); + WebContents* web_contents = browser()->GetSelectedWebContents(); + EXPECT_FALSE(web_contents->IsCrashed()); } diff --git a/content/public/browser/download_manager.h b/content/public/browser/download_manager.h index bb3f8ff..7b4ad69 100644 --- a/content/public/browser/download_manager.h +++ b/content/public/browser/download_manager.h @@ -145,7 +145,7 @@ class CONTENT_EXPORT DownloadManager // (exclusive). You may pass in null Time values to do an unbounded delete // in either direction. virtual int RemoveDownloadsBetween(const base::Time remove_begin, - const base::Time remove_end) = 0; + const base::Time remove_end) = 0; // Remove downloads will delete all downloads that have a timestamp that is // the same or more recent than |remove_begin|. The number of downloads diff --git a/content/public/browser/notification_types.h b/content/public/browser/notification_types.h index 281c55e..36499c6 100644 --- a/content/public/browser/notification_types.h +++ b/content/public/browser/notification_types.h @@ -232,10 +232,10 @@ enum NotificationType { // This notification is sent when a TabContents swaps its render view host // with another one, possibly changing processes. The source is a - // Source<TabContents> with a pointer to the TabContents. A + // Source<WebContents> with a pointer to the WebContents. A // TAB_CONTENTS_DISCONNECTED notification is guaranteed before the // source pointer becomes junk. No details are expected. - NOTIFICATION_TAB_CONTENTS_SWAPPED, + NOTIFICATION_WEB_CONTENTS_SWAPPED, // This message is sent after a WebContents is disconnected from the // renderer process. The source is a Source<WebContents> with a pointer to |