diff options
Diffstat (limited to 'chrome/browser/ui')
39 files changed, 230 insertions, 206 deletions
diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc index 2033b7a..9f1f931 100644 --- a/chrome/browser/ui/browser.cc +++ b/chrome/browser/ui/browser.cc @@ -1196,10 +1196,10 @@ TabContentsWrapper* Browser::GetTabContentsWrapperAt(int index) const { return tabstrip_model()->GetTabContentsAt(index); } -TabContents* Browser::GetTabContentsAt(int index) const { +WebContents* Browser::GetWebContentsAt(int index) const { TabContentsWrapper* wrapper = tabstrip_model()->GetTabContentsAt(index); if (wrapper) - return wrapper->tab_contents(); + return wrapper->web_contents(); return NULL; } @@ -1287,7 +1287,7 @@ void Browser::BookmarkBarSizeChanged(bool is_animating) { window_->ToolbarSizeChanged(is_animating); } -TabContents* Browser::AddRestoredTab( +WebContents* Browser::AddRestoredTab( const std::vector<TabNavigation>& navigations, int tab_index, int selected_navigation, @@ -1303,7 +1303,7 @@ TabContents* Browser::AddRestoredTab( MSG_ROUTING_NONE, GetSelectedWebContents(), session_storage_namespace); - TabContents* new_tab = wrapper->tab_contents(); + WebContents* new_tab = wrapper->web_contents(); wrapper->extension_tab_helper()->SetExtensionAppById(extension_app_id); std::vector<NavigationEntry*> entries; TabNavigation::CreateNavigationEntriesFromTabNavigations( @@ -3103,7 +3103,7 @@ TabContentsWrapper* Browser::CreateTabContentsForURL( } bool Browser::CanDuplicateContentsAt(int index) { - content::NavigationController& nc = GetTabContentsAt(index)->GetController(); + content::NavigationController& nc = GetWebContentsAt(index)->GetController(); return nc.GetWebContents() && nc.GetLastCommittedEntry(); } @@ -4811,7 +4811,7 @@ void Browser::ProcessPendingUIUpdates() { i != scheduled_updates_.end(); ++i) { bool found = false; for (int tab = 0; tab < tab_count(); tab++) { - if (GetTabContentsAt(tab) == i->first) { + if (GetWebContentsAt(tab) == i->first) { found = true; break; } diff --git a/chrome/browser/ui/browser.h b/chrome/browser/ui/browser.h index a8a62d8..88a03d5 100644 --- a/chrome/browser/ui/browser.h +++ b/chrome/browser/ui/browser.h @@ -397,7 +397,8 @@ class Browser : public TabHandlerDelegate, // A convenient version of the above which returns the TCW's WebContents. content::WebContents* GetSelectedWebContents() const; TabContentsWrapper* GetTabContentsWrapperAt(int index) const; - TabContents* GetTabContentsAt(int index) const; + // A convenient version of the above which returns the TCW's WebContents. + content::WebContents* GetWebContentsAt(int index) const; void ActivateTabAt(int index, bool user_gesture); bool IsTabPinned(int index) const; bool IsTabDiscarded(int index) const; @@ -433,14 +434,15 @@ class Browser : public TabHandlerDelegate, // extension. If |pin| is true and |tab_index|/ is the last pinned tab, then // the newly created tab is pinned. If |from_last_session| is true, // |navigations| are from the previous session. - TabContents* AddRestoredTab(const std::vector<TabNavigation>& navigations, - int tab_index, - int selected_navigation, - const std::string& extension_app_id, - bool select, - bool pin, - bool from_last_session, - SessionStorageNamespace* storage_namespace); + content::WebContents* AddRestoredTab( + const std::vector<TabNavigation>& navigations, + int tab_index, + int selected_navigation, + const std::string& extension_app_id, + bool select, + bool pin, + bool from_last_session, + SessionStorageNamespace* storage_namespace); // Creates a new tab with the already-created WebContents 'new_contents'. // The window for the added contents will be reparented correctly when this // method returns. If |disposition| is NEW_POPUP, |pos| should hold the diff --git a/chrome/browser/ui/browser_browsertest.cc b/chrome/browser/ui/browser_browsertest.cc index f6bdb59f..21a5419 100644 --- a/chrome/browser/ui/browser_browsertest.cc +++ b/chrome/browser/ui/browser_browsertest.cc @@ -44,11 +44,11 @@ #include "content/browser/renderer_host/render_process_host_impl.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/public/browser/favicon_status.h" #include "content/public/browser/navigation_entry.h" #include "content/public/browser/notification_service.h" #include "content/public/browser/notification_source.h" +#include "content/public/browser/web_contents.h" #include "content/public/common/page_transition_types.h" #include "content/public/common/url_constants.h" #include "grit/chromium_strings.h" @@ -232,7 +232,7 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, JavascriptAlertActivatesTab) { AddTabAtIndex(0, url, content::PAGE_TRANSITION_TYPED); EXPECT_EQ(2, browser()->tab_count()); EXPECT_EQ(0, browser()->active_index()); - TabContents* second_tab = browser()->GetTabContentsAt(1); + WebContents* second_tab = browser()->GetWebContentsAt(1); ASSERT_TRUE(second_tab); second_tab->GetRenderViewHost()->ExecuteJavascriptInWebFrame( string16(), @@ -348,7 +348,7 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, MAYBE_SingleBeforeUnloadAfterWindowClose) { // Close the new window with JavaScript, which should show a single // beforeunload dialog. Then show another alert, to make it easy to verify // that a second beforeunload dialog isn't shown. - browser()->GetTabContentsAt(0)->GetRenderViewHost()-> + browser()->GetWebContentsAt(0)->GetRenderViewHost()-> ExecuteJavascriptInWebFrame(string16(), ASCIIToUTF16("w.close(); alert('bar');")); AppModalDialog* alert = ui_test_utils::WaitForAppModalDialog(); @@ -616,9 +616,9 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, DISABLED_ConvertTabToAppShortcut) { ASSERT_TRUE(http_url.SchemeIs(chrome::kHttpScheme)); ASSERT_EQ(1, browser()->tab_count()); - TabContents* initial_tab = browser()->GetTabContentsAt(0); - TabContents* app_tab = browser()->AddSelectedTabWithURL( - http_url, content::PAGE_TRANSITION_TYPED)->tab_contents(); + WebContents* initial_tab = browser()->GetWebContentsAt(0); + WebContents* app_tab = browser()->AddSelectedTabWithURL( + http_url, content::PAGE_TRANSITION_TYPED)->web_contents(); ASSERT_EQ(2, browser()->tab_count()); ASSERT_EQ(1u, BrowserList::GetBrowserCount(browser()->profile())); @@ -643,12 +643,12 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, DISABLED_ConvertTabToAppShortcut) { // Check that the tab contents is in the new browser, and not in the old. ASSERT_EQ(1, browser()->tab_count()); - ASSERT_EQ(initial_tab, browser()->GetTabContentsAt(0)); + ASSERT_EQ(initial_tab, browser()->GetWebContentsAt(0)); // Check that the appliaction browser has a single tab, and that tab contains // the content that we app-ified. ASSERT_EQ(1, app_browser->tab_count()); - ASSERT_EQ(app_tab, app_browser->GetTabContentsAt(0)); + ASSERT_EQ(app_tab, app_browser->GetWebContentsAt(0)); // Normal tabs should accept load drops. EXPECT_TRUE(initial_tab->GetMutableRendererPrefs()->can_accept_load_drops); @@ -1044,7 +1044,7 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, RestorePinnedTabs) { EXPECT_FALSE(new_model->IsTabPinned(2)); EXPECT_EQ(browser()->profile()->GetHomePage(), - new_model->GetTabContentsAt(2)->tab_contents()->GetURL()); + new_model->GetTabContentsAt(2)->web_contents()->GetURL()); EXPECT_TRUE( new_model->GetTabContentsAt(0)->extension_tab_helper()->extension_app() == diff --git a/chrome/browser/ui/browser_init.cc b/chrome/browser/ui/browser_init.cc index 5fcac4e..91b6ca5 100644 --- a/chrome/browser/ui/browser_init.cc +++ b/chrome/browser/ui/browser_init.cc @@ -78,10 +78,10 @@ #include "chrome/common/url_constants.h" #include "chrome/installer/util/browser_distribution.h" #include "content/browser/child_process_security_policy.h" -#include "content/browser/tab_contents/tab_contents.h" #include "content/browser/tab_contents/tab_contents_view.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/navigation_details.h" +#include "content/public/browser/web_contents.h" #include "grit/chromium_strings.h" #include "grit/generated_resources.h" #include "grit/locale_settings.h" @@ -453,7 +453,7 @@ bool SessionCrashedInfoBarDelegate::Accept() { uint32 behavior = 0; Browser* browser = BrowserList::GetLastActiveWithProfile(profile_); if (browser && browser->tab_count() == 1 - && browser->GetTabContentsAt(0)->GetURL() == + && browser->GetWebContentsAt(0)->GetURL() == GURL(chrome::kChromeUINewTabURL)) { // There is only one tab and its the new tab page, make session restore // clobber it. diff --git a/chrome/browser/ui/browser_init_browsertest.cc b/chrome/browser/ui/browser_init_browsertest.cc index 05c938b..c649289 100644 --- a/chrome/browser/ui/browser_init_browsertest.cc +++ b/chrome/browser/ui/browser_init_browsertest.cc @@ -20,7 +20,7 @@ #include "chrome/common/pref_names.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" class BrowserInitTest : public ExtensionBrowserTest { @@ -151,7 +151,7 @@ IN_PROC_BROWSER_TEST_F(BrowserInitTest, // The new browser should have one tab for each URL. ASSERT_EQ(static_cast<int>(urls.size()), new_browser->tab_count()); for (size_t i=0; i < urls.size(); i++) { - EXPECT_EQ(urls[i], new_browser->GetTabContentsAt(i)->GetURL()); + EXPECT_EQ(urls[i], new_browser->GetWebContentsAt(i)->GetURL()); } } diff --git a/chrome/browser/ui/browser_navigator.cc b/chrome/browser/ui/browser_navigator.cc index 7289caa..cb1e72a 100644 --- a/chrome/browser/ui/browser_navigator.cc +++ b/chrome/browser/ui/browser_navigator.cc @@ -30,9 +30,11 @@ #include "chrome/common/pref_names.h" #include "chrome/common/url_constants.h" #include "content/browser/browser_url_handler.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/notification_service.h" +#include "content/public/browser/web_contents.h" #include "net/http/http_util.h" using content::GlobalRequestID; @@ -245,7 +247,7 @@ Profile* GetSourceProfile(browser::NavigateParams* params, return params->browser->profile(); } -void LoadURLInContents(TabContents* target_contents, +void LoadURLInContents(WebContents* target_contents, const GURL& url, browser::NavigateParams* params, const std::string& extra_headers) { @@ -483,8 +485,8 @@ void Navigate(NavigateParams* params) { } if (params->disposition != CURRENT_TAB) { - TabContents* source_contents = params->source_contents ? - params->source_contents->tab_contents() : NULL; + WebContents* source_contents = params->source_contents ? + params->source_contents->web_contents() : NULL; params->target_contents = Browser::TabContentsFactory( params->browser->profile(), @@ -504,7 +506,7 @@ void Navigate(NavigateParams* params) { // in the background, tell it that it's hidden. if ((params->tabstrip_add_types & TabStripModel::ADD_ACTIVE) == 0) { // TabStripModel::AddTabContents invokes HideContents if not foreground. - params->target_contents->tab_contents()->WasHidden(); + params->target_contents->web_contents()->WasHidden(); } } else { // ... otherwise if we're loading in the current tab, the target is the @@ -514,8 +516,8 @@ void Navigate(NavigateParams* params) { } if (user_initiated) { - static_cast<RenderViewHostDelegate*>(params->target_contents-> - tab_contents())->OnUserGesture(); + params->target_contents->web_contents()->GetRenderViewHost()-> + delegate()->OnUserGesture(); } InitializeExtraHeaders(params, params->target_contents->profile(), @@ -527,7 +529,7 @@ void Navigate(NavigateParams* params) { // Perform the actual navigation, tracking whether it came from the // renderer. - LoadURLInContents(params->target_contents->tab_contents(), + LoadURLInContents(params->target_contents->web_contents(), url, params, extra_headers); } } else { @@ -543,7 +545,7 @@ void Navigate(NavigateParams* params) { (params->disposition == NEW_FOREGROUND_TAB || params->disposition == NEW_WINDOW) && (params->tabstrip_add_types & TabStripModel::ADD_INHERIT_OPENER)) - params->source_contents->tab_contents()->Focus(); + params->source_contents->web_contents()->Focus(); if (params->source_contents == params->target_contents) { // The navigation occurred in the source tab. @@ -569,7 +571,7 @@ void Navigate(NavigateParams* params) { } if (singleton_index >= 0) { - TabContents* target = params->browser->GetTabContentsAt(singleton_index); + WebContents* target = params->browser->GetWebContentsAt(singleton_index); if (target->IsCrashed()) { target->GetController().Reload(true); @@ -588,7 +590,7 @@ void Navigate(NavigateParams* params) { content::NotificationService::current()->Notify( content::NOTIFICATION_TAB_ADDED, content::Source<content::WebContentsDelegate>(params->browser), - content::Details<WebContents>(params->target_contents->tab_contents())); + content::Details<WebContents>(params->target_contents->web_contents())); } } @@ -625,9 +627,9 @@ int GetIndexOfSingletonTab(browser::NavigateParams* params) { replacements.ClearQuery(); } - if (CompareURLsWithReplacements(tab->tab_contents()->GetURL(), + if (CompareURLsWithReplacements(tab->web_contents()->GetURL(), params->url, replacements) || - CompareURLsWithReplacements(tab->tab_contents()->GetURL(), + CompareURLsWithReplacements(tab->web_contents()->GetURL(), rewritten_url, replacements)) { params->target_contents = tab; return tab_index; diff --git a/chrome/browser/ui/browser_tab_restore_service_delegate.cc b/chrome/browser/ui/browser_tab_restore_service_delegate.cc index 32ffe02..9006c2c 100644 --- a/chrome/browser/ui/browser_tab_restore_service_delegate.cc +++ b/chrome/browser/ui/browser_tab_restore_service_delegate.cc @@ -27,9 +27,9 @@ int BrowserTabRestoreServiceDelegate::GetSelectedIndex() const { return browser_->active_index(); } -TabContents* BrowserTabRestoreServiceDelegate::GetTabContentsAt( +WebContents* BrowserTabRestoreServiceDelegate::GetWebContentsAt( int index) const { - return browser_->GetTabContentsAt(index); + return browser_->GetWebContentsAt(index); } WebContents* BrowserTabRestoreServiceDelegate::GetSelectedWebContents() const { @@ -40,7 +40,7 @@ bool BrowserTabRestoreServiceDelegate::IsTabPinned(int index) const { return browser_->IsTabPinned(index); } -TabContents* BrowserTabRestoreServiceDelegate::AddRestoredTab( +WebContents* BrowserTabRestoreServiceDelegate::AddRestoredTab( const std::vector<TabNavigation>& navigations, int tab_index, int selected_navigation, diff --git a/chrome/browser/ui/browser_tab_restore_service_delegate.h b/chrome/browser/ui/browser_tab_restore_service_delegate.h index 76bd1bd..8cac1a8 100644 --- a/chrome/browser/ui/browser_tab_restore_service_delegate.h +++ b/chrome/browser/ui/browser_tab_restore_service_delegate.h @@ -26,10 +26,10 @@ class BrowserTabRestoreServiceDelegate : public TabRestoreServiceDelegate { virtual const SessionID& GetSessionID() const OVERRIDE; virtual int GetTabCount() const OVERRIDE; virtual int GetSelectedIndex() const OVERRIDE; - virtual TabContents* GetTabContentsAt(int index) const OVERRIDE; + virtual content::WebContents* GetWebContentsAt(int index) const OVERRIDE; virtual content::WebContents* GetSelectedWebContents() const OVERRIDE; virtual bool IsTabPinned(int index) const OVERRIDE; - virtual TabContents* AddRestoredTab( + virtual content::WebContents* AddRestoredTab( const std::vector<TabNavigation>& navigations, int tab_index, int selected_navigation, diff --git a/chrome/browser/ui/cocoa/applescript/window_applescript.mm b/chrome/browser/ui/cocoa/applescript/window_applescript.mm index df71751..5a5f095 100644 --- a/chrome/browser/ui/cocoa/applescript/window_applescript.mm +++ b/chrome/browser/ui/cocoa/applescript/window_applescript.mm @@ -21,7 +21,7 @@ #import "chrome/browser/ui/cocoa/applescript/tab_applescript.h" #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" #include "chrome/common/url_constants.h" -#include "content/browser/tab_contents/tab_contents.h" +#include "content/public/browser/web_contents.h" @interface WindowAppleScript(WindowAppleScriptPrivateMethods) // The NSWindow that corresponds to this window. @@ -151,7 +151,7 @@ for (int i = 0; i < browser_->tab_count(); ++i) { // Check to see if tab is closing. - if (browser_->GetTabContentsAt(i)->IsBeingDestroyed()) { + if (browser_->GetWebContentsAt(i)->IsBeingDestroyed()) { continue; } @@ -176,7 +176,7 @@ TabContentsWrapper* contents = browser_->AddSelectedTabWithURL(GURL(chrome::kChromeUINewTabURL), content::PAGE_TRANSITION_TYPED); - contents->tab_contents()->SetNewTabStartTime(newTabStartTime); + contents->web_contents()->SetNewTabStartTime(newTabStartTime); [aTab setTabContent:contents]; } @@ -194,14 +194,14 @@ params.disposition = NEW_FOREGROUND_TAB; params.tabstrip_index = index; browser::Navigate(¶ms); - params.target_contents->tab_contents()->SetNewTabStartTime( + params.target_contents->web_contents()->SetNewTabStartTime( newTabStartTime); [aTab setTabContent:params.target_contents]; } - (void)removeFromTabsAtIndex:(int)index { - browser_->CloseTabContents(browser_->GetTabContentsAt(index)); + browser_->CloseTabContents(browser_->GetWebContentsAt(index)); } - (NSNumber*)orderedIndex { diff --git a/chrome/browser/ui/cocoa/bookmarks/bookmark_all_tabs_controller.mm b/chrome/browser/ui/cocoa/bookmarks/bookmark_all_tabs_controller.mm index 0c0cd6a..3fb3b71 100644 --- a/chrome/browser/ui/cocoa/bookmarks/bookmark_all_tabs_controller.mm +++ b/chrome/browser/ui/cocoa/bookmarks/bookmark_all_tabs_controller.mm @@ -11,10 +11,12 @@ #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_list.h" #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" -#include "content/browser/tab_contents/tab_contents.h" +#include "content/public/browser/web_contents.h" #include "grit/generated_resources.h" #include "ui/base/l10n/l10n_util_mac.h" +using content::WebContents; + @implementation BookmarkAllTabsController - (id)initWithParentWindow:(NSWindow*)parentWindow @@ -45,9 +47,9 @@ TabStripModel* tabstrip_model = browser->tabstrip_model(); const int tabCount = tabstrip_model->count(); for (int i = 0; i < tabCount; ++i) { - TabContents* tc = tabstrip_model->GetTabContentsAt(i)->tab_contents(); - const string16 tabTitle = tc->GetTitle(); - const GURL& tabURL(tc->GetURL()); + WebContents* wc = tabstrip_model->GetTabContentsAt(i)->web_contents(); + const string16 tabTitle = wc->GetTitle(); + const GURL& tabURL(wc->GetURL()); ActiveTabNameURLPair tabPair(tabTitle, tabURL); activeTabPairsVector_.push_back(tabPair); } diff --git a/chrome/browser/ui/cocoa/browser_window_controller.mm b/chrome/browser/ui/cocoa/browser_window_controller.mm index fd6c773..140fb58 100644 --- a/chrome/browser/ui/cocoa/browser_window_controller.mm +++ b/chrome/browser/ui/cocoa/browser_window_controller.mm @@ -1479,7 +1479,7 @@ enum { // TabContentsControllerDelegate protocol. - (void)tabContentsViewFrameWillChange:(TabContentsController*)source frameRect:(NSRect)frameRect { - TabContents* contents = [source tabContents]; + WebContents* contents = [source webContents]; RenderWidgetHostView* render_widget_host_view = contents ? contents->GetRenderWidgetHostView() : NULL; if (!render_widget_host_view) @@ -1518,14 +1518,15 @@ enum { } // TabStripControllerDelegate protocol. -- (void)onActivateTabWithContents:(TabContents*)contents { +- (void)onActivateTabWithContents:(WebContents*)contents { // Update various elements that are interested in knowing the current // TabContents. // Update all the UI bits. windowShim_->UpdateTitleBar(); - [sidebarController_ updateSidebarForTabContents:contents]; + [sidebarController_ updateSidebarForTabContents: + static_cast<TabContents*>(contents)]; [devToolsController_ updateDevToolsForWebContents:contents withProfile:browser_->profile()]; @@ -1546,7 +1547,7 @@ enum { [devToolsController_ ensureContentsVisible]; } -- (void)onReplaceTabWithContents:(TabContents*)contents { +- (void)onReplaceTabWithContents:(WebContents*)contents { // Simply remove the preview view if it exists; the tab strip // controller will reinstall the view as the active view. [previewableContentsController_ hidePreview]; @@ -1554,7 +1555,7 @@ enum { } - (void)onTabChanged:(TabStripModelObserver::TabChangeType)change - withContents:(TabContents*)contents { + withContents:(WebContents*)contents { // Update titles if this is the currently selected tab and if it isn't just // the loading state which changed. if (change != TabStripModelObserver::LOADING_ONLY) @@ -1569,7 +1570,7 @@ enum { [self updateBookmarkBarVisibilityWithAnimation:NO]; } -- (void)onTabDetachedWithContents:(TabContents*)contents { +- (void)onTabDetachedWithContents:(WebContents*)contents { TabContentsWrapper* wrapper = TabContentsWrapper::GetCurrentWrapperForContents(contents); [infoBarContainerController_ tabDetachedWithContents:wrapper]; diff --git a/chrome/browser/ui/cocoa/dev_tools_controller.mm b/chrome/browser/ui/cocoa/dev_tools_controller.mm index 5d10075..7288b01 100644 --- a/chrome/browser/ui/cocoa/dev_tools_controller.mm +++ b/chrome/browser/ui/cocoa/dev_tools_controller.mm @@ -119,8 +119,7 @@ const int kMinContentsSize = 50; } } - [contentsController_ changeTabContents: - static_cast<TabContents*>(devToolsContents)]; + [contentsController_ changeWebContents:devToolsContents]; } - (void)showDevToolsContainer:(Profile*)profile { diff --git a/chrome/browser/ui/cocoa/sidebar_controller.mm b/chrome/browser/ui/cocoa/sidebar_controller.mm index e07cac8..72510b9 100644 --- a/chrome/browser/ui/cocoa/sidebar_controller.mm +++ b/chrome/browser/ui/cocoa/sidebar_controller.mm @@ -76,7 +76,8 @@ const int kMinWebWidth = 50; sidebarContents = activeSidebar->sidebar_contents(); } - TabContents* oldSidebarContents = [contentsController_ tabContents]; + TabContents* oldSidebarContents = static_cast<TabContents*>( + [contentsController_ webContents]); if (oldSidebarContents == sidebarContents) return; @@ -141,7 +142,7 @@ const int kMinWebWidth = 50; } } - [contentsController_ changeTabContents:sidebarContents]; + [contentsController_ changeWebContents:sidebarContents]; } - (void)resizeSidebarToNewWidth:(CGFloat)width { 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 8b6f768..1fcfe05 100644 --- a/chrome/browser/ui/cocoa/tab_contents/tab_contents_controller.h +++ b/chrome/browser/ui/cocoa/tab_contents/tab_contents_controller.h @@ -10,7 +10,6 @@ #include "base/memory/scoped_ptr.h" -class TabContents; class TabContentsNotificationBridge; @class TabContentsController; @@ -28,8 +27,8 @@ class WebContents; @end -// A class that controls the TabContents view. It manages displaying the -// native view for a given TabContents. +// A class that controls the WebContents view. It manages displaying the +// native view for a given WebContents. // Note that just creating the class does not display the view. We defer // inserting it until the box is the correct size to avoid multiple resize // messages to the renderer. You must call |-ensureContentsVisible| to display @@ -37,14 +36,14 @@ class WebContents; @interface TabContentsController : NSViewController { @private - TabContents* contents_; // weak + content::WebContents* contents_; // weak // Delegate to be notified about size changes. id<TabContentsControllerDelegate> delegate_; // weak scoped_ptr<TabContentsNotificationBridge> tabContentsBridge_; } -@property(readonly, nonatomic) TabContents* tabContents; +@property(readonly, nonatomic) content::WebContents* webContents; -- (id)initWithContents:(TabContents*)contents +- (id)initWithContents:(content::WebContents*)contents delegate:(id<TabContentsControllerDelegate>)delegate; // Call when the tab contents is about to be replaced with the currently @@ -58,7 +57,7 @@ class WebContents; // 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; +- (void)changeWebContents:(content::WebContents*)newContents; // Called when the tab contents is the currently selected tab and is about to be // removed from the view hierarchy. @@ -72,7 +71,7 @@ class WebContents; // Called when the tab contents is updated in some non-descript way (the // notification from the model isn't specific). |updatedContents| could reflect // an entirely new tab contents object. -- (void)tabDidChange:(TabContents*)updatedContents; +- (void)tabDidChange:(content::WebContents*)updatedContents; @end 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 54eb98a..6282c0b 100644 --- a/chrome/browser/ui/cocoa/tab_contents/tab_contents_controller.mm +++ b/chrome/browser/ui/cocoa/tab_contents/tab_contents_controller.mm @@ -20,7 +20,7 @@ using content::WebContents; @interface TabContentsController(Private) // Forwards frame update to |delegate_| (ResizeNotificationView calls it). - (void)tabContentsViewFrameWillChange:(NSRect)frameRect; -// Notification from TabContents (forwarded by TabContentsNotificationBridge). +// Notification from WebContents (forwarded by TabContentsNotificationBridge). - (void)tabContentsRenderViewHostChanged:(RenderViewHost*)oldHost newHost:(RenderViewHost*)newHost; @end @@ -100,9 +100,9 @@ void TabContentsNotificationBridge::ChangeWebContents(WebContents* contents) { @implementation TabContentsController -@synthesize tabContents = contents_; +@synthesize webContents = contents_; -- (id)initWithContents:(TabContents*)contents +- (id)initWithContents:(WebContents*)contents delegate:(id<TabContentsControllerDelegate>)delegate { if ((self = [super initWithNibName:nil bundle:nil])) { contents_ = contents; @@ -165,7 +165,7 @@ void TabContentsNotificationBridge::ChangeWebContents(WebContents* contents) { NSViewHeightSizable]; } -- (void)changeTabContents:(TabContents*)newContents { +- (void)changeWebContents:(WebContents*)newContents { contents_ = newContents; tabContentsBridge_->ChangeWebContents(contents_); } @@ -189,7 +189,7 @@ void TabContentsNotificationBridge::ChangeWebContents(WebContents* contents) { // The RWHV is ripped out of the view hierarchy on tab switches, so it never // formally resigns first responder status. Handle this by explicitly sending // a Blur() message to the renderer, but only if the RWHV currently has focus. - RenderViewHost* rvh = [self tabContents]->GetRenderViewHost(); + RenderViewHost* rvh = [self webContents]->GetRenderViewHost(); if (rvh && rvh->view() && rvh->view()->HasFocus()) rvh->Blur(); } @@ -200,13 +200,13 @@ void TabContentsNotificationBridge::ChangeWebContents(WebContents* contents) { // logic will restore focus to the appropriate view. } -- (void)tabDidChange:(TabContents*)updatedContents { +- (void)tabDidChange:(WebContents*)updatedContents { // Calling setContentView: here removes any first responder status // the view may have, so avoid changing the view hierarchy unless // the view is different. - if ([self tabContents] != updatedContents) { - [self changeTabContents:updatedContents]; - if ([self tabContents]) + if ([self webContents] != updatedContents) { + [self changeWebContents:updatedContents]; + if ([self webContents]) [self ensureContentsVisible]; } } diff --git a/chrome/browser/ui/cocoa/tabpose_window.mm b/chrome/browser/ui/cocoa/tabpose_window.mm index 08d3a2c..2fb2a8f 100644 --- a/chrome/browser/ui/cocoa/tabpose_window.mm +++ b/chrome/browser/ui/cocoa/tabpose_window.mm @@ -32,7 +32,7 @@ #include "content/browser/renderer_host/backing_store_mac.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/public/browser/web_contents.h" #include "grit/theme_resources.h" #include "grit/ui_resources.h" #include "skia/ext/skia_utils_mac.h" @@ -225,7 +225,7 @@ void ThumbnailLoader::LoadThumbnail() { // Medium term, we want to show thumbs of the actual info bar views, which // means I need to create InfoBarControllers here. - NSWindow* window = [contents_->tab_contents()->GetNativeView() window]; + NSWindow* window = [contents_->web_contents()->GetNativeView() window]; NSWindowController* windowController = [window windowController]; if ([windowController isKindOfClass:[BrowserWindowController class]]) { BrowserWindowController* bwc = @@ -253,14 +253,14 @@ void ThumbnailLoader::LoadThumbnail() { int bottomOffset = 0; TabContentsWrapper* devToolsContents = DevToolsWindow::GetDevToolsContents(contents_->web_contents()); - if (devToolsContents && devToolsContents->tab_contents() && - devToolsContents->tab_contents()->GetRenderViewHost() && - devToolsContents->tab_contents()->GetRenderViewHost()->view()) { + if (devToolsContents && devToolsContents->web_contents() && + devToolsContents->web_contents()->GetRenderViewHost() && + devToolsContents->web_contents()->GetRenderViewHost()->view()) { // The devtool's size might not be up-to-date, but since its height doesn't // change on window resize, and since most users don't use devtools, this is // good enough. bottomOffset += - devToolsContents->tab_contents()->GetRenderViewHost()->view()-> + devToolsContents->web_contents()->GetRenderViewHost()->view()-> GetViewBounds().height(); bottomOffset += 1; // :-( Divider line between web contents and devtools. } @@ -285,7 +285,7 @@ void ThumbnailLoader::LoadThumbnail() { } - (void)drawInContext:(CGContextRef)context { - RenderWidgetHost* rwh = contents_->tab_contents()->GetRenderViewHost(); + RenderWidgetHost* rwh = contents_->web_contents()->GetRenderViewHost(); // NULL if renderer crashed. RenderWidgetHostView* rwhv = rwh ? rwh->view() : NULL; if (!rwhv) { @@ -431,7 +431,7 @@ class Tile { // Returns an unelided title. The view logic is responsible for eliding. const string16& title() const { - return contents_->tab_contents()->GetTitle(); + return contents_->web_contents()->GetTitle(); } TabContentsWrapper* tab_contents() const { return contents_; } diff --git a/chrome/browser/ui/cocoa/tabs/tab_strip_controller.h b/chrome/browser/ui/cocoa/tabs/tab_strip_controller.h index 6f730c4..f65ad55 100644 --- a/chrome/browser/ui/cocoa/tabs/tab_strip_controller.h +++ b/chrome/browser/ui/cocoa/tabs/tab_strip_controller.h @@ -27,7 +27,6 @@ class Browser; class ConstrainedWindowMac; class TabStripModelObserverBridge; class TabStripModel; -class TabContents; // The interface for the tab strip controller's delegate. // Delegating TabStripModelObserverBridge's events (in lieu of directly @@ -37,17 +36,17 @@ class TabContents; @protocol TabStripControllerDelegate // Stripped down version of TabStripModelObserverBridge:selectTabWithContents. -- (void)onActivateTabWithContents:(TabContents*)contents; +- (void)onActivateTabWithContents:(content::WebContents*)contents; // Stripped down version of TabStripModelObserverBridge:tabReplacedWithContents. -- (void)onReplaceTabWithContents:(TabContents*)contents; +- (void)onReplaceTabWithContents:(content::WebContents*)contents; // Stripped down version of TabStripModelObserverBridge:tabChangedWithContents. - (void)onTabChanged:(TabStripModelObserver::TabChangeType)change - withContents:(TabContents*)contents; + withContents:(content::WebContents*)contents; // Stripped down version of TabStripModelObserverBridge:tabDetachedWithContents. -- (void)onTabDetachedWithContents:(TabContents*)contents; +- (void)onTabDetachedWithContents:(content::WebContents*)contents; @end diff --git a/chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm b/chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm index 11cbb56..c9a4abc 100644 --- a/chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm +++ b/chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm @@ -51,10 +51,10 @@ #include "chrome/browser/ui/tabs/tab_menu_model.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/pref_names.h" -#include "content/browser/tab_contents/tab_contents.h" #include "content/browser/tab_contents/tab_contents_view.h" #include "content/public/browser/navigation_controller.h" #include "content/public/browser/user_metrics.h" +#include "content/public/browser/web_contents.h" #include "grit/generated_resources.h" #include "grit/theme_resources.h" #include "grit/theme_resources_standard.h" @@ -69,6 +69,7 @@ using content::OpenURLParams; using content::Referrer; using content::UserMetricsAction; +using content::WebContents; NSString* const kTabStripNumberOfTabsChanged = @"kTabStripNumberOfTabsChanged"; @@ -502,7 +503,7 @@ private: } // New content is in place, delegate should adjust itself accordingly. - [delegate_ onActivateTabWithContents:[controller tabContents]]; + [delegate_ onActivateTabWithContents:[controller webContents]]; // It also restores content autoresizing properties. [controller ensureContentsVisible]; @@ -1095,7 +1096,7 @@ private: // Handles setting the title of the tab based on the given |contents|. Uses // a canned string if |contents| is NULL. -- (void)setTabTitle:(NSViewController*)tab withContents:(TabContents*)contents { +- (void)setTabTitle:(NSViewController*)tab withContents:(WebContents*)contents { NSString* titleString = nil; if (contents) titleString = base::SysUTF16ToNSString(contents->GetTitle()); @@ -1123,7 +1124,7 @@ private: // Make a new tab. Load the contents of this tab from the nib and associate // the new controller with |contents| so it can be looked up later. scoped_nsobject<TabContentsController> contentsController( - [[TabContentsController alloc] initWithContents:contents->tab_contents() + [[TabContentsController alloc] initWithContents:contents->web_contents() delegate:self]); [tabContentsArray_ insertObject:contentsController atIndex:index]; @@ -1132,7 +1133,7 @@ private: [newController setMini:tabStripModel_->IsMiniTab(modelIndex)]; [newController setPinned:tabStripModel_->IsTabPinned(modelIndex)]; [newController setApp:tabStripModel_->IsAppTab(modelIndex)]; - [newController setUrl:contents->tab_contents()->GetURL()]; + [newController setUrl:contents->web_contents()->GetURL()]; [tabArray_ insertObject:newController atIndex:index]; NSView* newView = [newController view]; @@ -1142,7 +1143,7 @@ private: [newView setFrame:NSOffsetRect([newView frame], 0, -[[self class] defaultTabHeight])]; - [self setTabTitle:newController withContents:contents->tab_contents()]; + [self setTabTitle:newController withContents:contents->web_contents()]; // If a tab is being inserted, we can again use the entire tab strip width // for layout. @@ -1179,14 +1180,14 @@ private: if (oldContents) { int oldModelIndex = browser_->GetIndexOfController( - &(oldContents->tab_contents()->GetController())); + &(oldContents->web_contents()->GetController())); if (oldModelIndex != -1) { // When closing a tab, the old tab may be gone. NSInteger oldIndex = [self indexFromModelIndex:oldModelIndex]; TabContentsController* oldController = [tabContentsArray_ objectAtIndex:oldIndex]; [oldController willBecomeUnselectedTab]; - oldContents->tab_contents()->GetView()->StoreFocus(); - oldContents->tab_contents()->WasHidden(); + oldContents->web_contents()->GetView()->StoreFocus(); + oldContents->web_contents()->WasHidden(); } } @@ -1221,8 +1222,8 @@ private: [self swapInTabAtIndex:modelIndex]; if (newContents) { - newContents->tab_contents()->DidBecomeSelected(); - newContents->tab_contents()->GetView()->RestoreFocus(); + newContents->web_contents()->DidBecomeSelected(); + newContents->web_contents()->GetView()->RestoreFocus(); if (newContents->find_tab_helper()->find_ui_active()) browser_->GetFindBarController()->find_bar()->SetFocusAndSelection(); @@ -1235,20 +1236,20 @@ private: NSInteger index = [self indexFromModelIndex:modelIndex]; TabContentsController* oldController = [tabContentsArray_ objectAtIndex:index]; - DCHECK_EQ(oldContents->tab_contents(), [oldController tabContents]); + DCHECK_EQ(oldContents->web_contents(), [oldController webContents]); // Simply create a new TabContentsController for |newContents| and place it // into the array, replacing |oldContents|. A ActiveTabChanged notification // will follow, at which point we will install the new view. scoped_nsobject<TabContentsController> newController( [[TabContentsController alloc] - initWithContents:newContents->tab_contents() + initWithContents:newContents->web_contents() delegate:self]); // Bye bye, |oldController|. [tabContentsArray_ replaceObjectAtIndex:index withObject:newController]; - [delegate_ onReplaceTabWithContents:newContents->tab_contents()]; + [delegate_ onReplaceTabWithContents:newContents->web_contents()]; // Fake a tab changed notification to force tab titles and favicons to update. [self tabChangedWithContents:newContents @@ -1366,7 +1367,7 @@ private: postNotificationName:kTabStripNumberOfTabsChanged object:self]; - [delegate_ onTabDetachedWithContents:contents->tab_contents()]; + [delegate_ onTabDetachedWithContents:contents->web_contents()]; } // A helper routine for creating an NSImageView to hold the favicon or app icon @@ -1423,13 +1424,13 @@ private: TabLoadingState oldState = [tabController loadingState]; TabLoadingState newState = kTabDone; NSImage* throbberImage = nil; - if (contents->tab_contents()->IsCrashed()) { + if (contents->web_contents()->IsCrashed()) { newState = kTabCrashed; newHasIcon = true; - } else if (contents->tab_contents()->IsWaitingForResponse()) { + } else if (contents->web_contents()->IsWaitingForResponse()) { newState = kTabWaiting; throbberImage = throbberWaitingImage; - } else if (contents->tab_contents()->IsLoading()) { + } else if (contents->web_contents()->IsLoading()) { newState = kTabLoading; throbberImage = throbberLoadingImage; } @@ -1476,7 +1477,7 @@ private: NSInteger index = [self indexFromModelIndex:modelIndex]; if (modelIndex == tabStripModel_->active_index()) - [delegate_ onTabChanged:change withContents:contents->tab_contents()]; + [delegate_ onTabChanged:change withContents:contents->web_contents()]; if (change == TabStripModelObserver::TITLE_NOT_LOADING) { // TODO(sky): make this work. @@ -1487,13 +1488,13 @@ private: TabController* tabController = [tabArray_ objectAtIndex:index]; if (change != TabStripModelObserver::LOADING_ONLY) - [self setTabTitle:tabController withContents:contents->tab_contents()]; + [self setTabTitle:tabController withContents:contents->web_contents()]; [self updateFaviconForContents:contents atIndex:modelIndex]; TabContentsController* updatedController = [tabContentsArray_ objectAtIndex:index]; - [updatedController tabDidChange:contents->tab_contents()]; + [updatedController tabDidChange:contents->web_contents()]; } // Called when a tab is moved (usually by drag&drop). Keep our parallel arrays @@ -1543,7 +1544,7 @@ private: [tabController setMini:tabStripModel_->IsMiniTab(modelIndex)]; [tabController setPinned:tabStripModel_->IsTabPinned(modelIndex)]; [tabController setApp:tabStripModel_->IsAppTab(modelIndex)]; - [tabController setUrl:contents->tab_contents()->GetURL()]; + [tabController setUrl:contents->web_contents()->GetURL()]; [self updateFaviconForContents:contents atIndex:modelIndex]; // If the tab is being restored and it's pinned, the mini state is set after // the tab has already been rendered, so re-layout the tabstrip. In all other @@ -1886,7 +1887,7 @@ private: content::RecordAction(UserMetricsAction("Tab_DropURLOnTab")); OpenURLParams params( *url, Referrer(), CURRENT_TAB, content::PAGE_TRANSITION_TYPED, false); - tabStripModel_->GetTabContentsAt(index)->tab_contents()->OpenURL(params); + tabStripModel_->GetTabContentsAt(index)->web_contents()->OpenURL(params); tabStripModel_->ActivateTabAt(index, true); break; default: @@ -2056,7 +2057,7 @@ private: // We use the TabContentsController's view in |swapInTabAtIndex|, so we have // to pass it to the sheet controller here. NSView* tabContentsView = - [window->owner()->tab_contents()->GetNativeView() superview]; + [window->owner()->web_contents()->GetNativeView() superview]; window->delegate()->RunSheet([self sheetController], tabContentsView); // TODO(avi, thakis): GTMWindowSheetController has no api to move tabsheets @@ -2075,7 +2076,7 @@ private: - (void)removeConstrainedWindow:(ConstrainedWindowMac*)window { NSView* tabContentsView = - [window->owner()->tab_contents()->GetNativeView() superview]; + [window->owner()->web_contents()->GetNativeView() superview]; // TODO(avi, thakis): GTMWindowSheetController has no api to move tabsheets // between windows. Until then, we have to prevent having to move a tabsheet diff --git a/chrome/browser/ui/cocoa/tabs/tab_strip_controller_unittest.mm b/chrome/browser/ui/cocoa/tabs/tab_strip_controller_unittest.mm index f5783ad..1ac6841 100644 --- a/chrome/browser/ui/cocoa/tabs/tab_strip_controller_unittest.mm +++ b/chrome/browser/ui/cocoa/tabs/tab_strip_controller_unittest.mm @@ -19,20 +19,22 @@ #include "testing/gtest/include/gtest/gtest.h" #include "testing/platform_test.h" +using content::WebContents; + @interface TestTabStripControllerDelegate : NSObject<TabStripControllerDelegate> { } @end @implementation TestTabStripControllerDelegate -- (void)onActivateTabWithContents:(TabContents*)contents { +- (void)onActivateTabWithContents:(WebContents*)contents { } -- (void)onReplaceTabWithContents:(TabContents*)contents { +- (void)onReplaceTabWithContents:(WebContents*)contents { } - (void)onTabChanged:(TabStripModelObserver::TabChangeType)change - withContents:(TabContents*)contents { + withContents:(WebContents*)contents { } -- (void)onTabDetachedWithContents:(TabContents*)contents { +- (void)onTabDetachedWithContents:(WebContents*)contents { } @end diff --git a/chrome/browser/ui/gtk/tabs/drag_data.cc b/chrome/browser/ui/gtk/tabs/drag_data.cc index ce9268a..28ca688 100644 --- a/chrome/browser/ui/gtk/tabs/drag_data.cc +++ b/chrome/browser/ui/gtk/tabs/drag_data.cc @@ -10,6 +10,8 @@ #include "content/browser/tab_contents/tab_contents.h" #include "content/public/browser/web_contents_delegate.h" +using content::WebContents; + DraggedTabData::DraggedTabData() : tab_(NULL), contents_(NULL), @@ -97,9 +99,9 @@ TabContentsWrapper* DragData::GetSourceTabContentsWrapper() { return GetSourceTabData()->contents_; } -TabContents* DragData::GetSourceTabContents() { +WebContents* DragData::GetSourceWebContents() { TabContentsWrapper* contents = GetSourceTabData()->contents_; - return contents ? contents->tab_contents(): NULL; + return contents ? contents->web_contents(): NULL; } DraggedTabData* DragData::GetSourceTabData() { diff --git a/chrome/browser/ui/gtk/tabs/drag_data.h b/chrome/browser/ui/gtk/tabs/drag_data.h index 827bb09..1cfb749 100644 --- a/chrome/browser/ui/gtk/tabs/drag_data.h +++ b/chrome/browser/ui/gtk/tabs/drag_data.h @@ -15,6 +15,7 @@ class TabContentsWrapper; class TabGtk; namespace content { +class WebContents; class WebContentsDelegate; } @@ -92,8 +93,8 @@ class DragData { // Convenience for |source_tab_drag_data()->contents_|. TabContentsWrapper* GetSourceTabContentsWrapper(); - // Convenience for |source_tab_drag_data()->contents_->tab_contents()|. - TabContents* GetSourceTabContents(); + // Convenience for |source_tab_drag_data()->contents_->web_contents()|. + content::WebContents* GetSourceWebContents(); // Convenience for getting the DraggedTabData corresponding to the tab that // was under the mouse pointer when the user started dragging. diff --git a/chrome/browser/ui/gtk/tabs/dragged_tab_controller_gtk.cc b/chrome/browser/ui/gtk/tabs/dragged_tab_controller_gtk.cc index d80d4f7..fdf6b57 100644 --- a/chrome/browser/ui/gtk/tabs/dragged_tab_controller_gtk.cc +++ b/chrome/browser/ui/gtk/tabs/dragged_tab_controller_gtk.cc @@ -18,9 +18,9 @@ #include "chrome/browser/ui/gtk/tabs/dragged_view_gtk.h" #include "chrome/browser/ui/gtk/tabs/tab_strip_gtk.h" #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" -#include "content/browser/tab_contents/tab_contents.h" #include "content/public/browser/notification_source.h" #include "content/public/browser/notification_types.h" +#include "content/public/browser/web_contents.h" #include "ui/gfx/screen.h" using content::OpenURLParams; @@ -90,7 +90,7 @@ void DraggedTabControllerGtk::CaptureDragInfo(const gfx::Point& mouse_offset) { void DraggedTabControllerGtk::Drag() { if (!drag_data_->GetSourceTabData()->tab_ || !drag_data_->GetSourceTabContentsWrapper() || - !drag_data_->GetSourceTabContents()) { + !drag_data_->GetSourceWebContents()) { return; } @@ -115,10 +115,10 @@ bool DraggedTabControllerGtk::EndDrag(bool canceled) { } TabGtk* DraggedTabControllerGtk::GetDraggedTabForContents( - TabContents* contents) { + WebContents* contents) { if (attached_tabstrip_ == source_tabstrip_) { for (size_t i = 0; i < drag_data_->size(); i++) { - if (contents == drag_data_->get(i)->contents_->tab_contents()) + if (contents == drag_data_->get(i)->contents_->web_contents()) return drag_data_->get(i)->tab_; } } @@ -157,15 +157,15 @@ DraggedTabData DraggedTabControllerGtk::InitDraggedTabData(TabGtk* tab) { // collected/destroyed while the drag is in process, leading to // nasty crashes. content::WebContentsDelegate* original_delegate = - contents->tab_contents()->GetDelegate(); - contents->tab_contents()->SetDelegate(this); + contents->web_contents()->GetDelegate(); + contents->web_contents()->SetDelegate(this); DraggedTabData dragged_tab_data(tab, contents, original_delegate, source_model_index, pinned, mini); registrar_.Add( this, content::NOTIFICATION_WEB_CONTENTS_DESTROYED, - content::Source<WebContents>(dragged_tab_data.contents_->tab_contents())); + content::Source<WebContents>(dragged_tab_data.contents_->web_contents())); return dragged_tab_data; } @@ -229,7 +229,7 @@ void DraggedTabControllerGtk::Observe( DCHECK(type == content::NOTIFICATION_WEB_CONTENTS_DESTROYED); WebContents* destroyed_contents = content::Source<WebContents>(source).ptr(); for (size_t i = 0; i < drag_data_->size(); ++i) { - if (drag_data_->get(i)->contents_->tab_contents() == destroyed_contents) { + if (drag_data_->get(i)->contents_->web_contents() == destroyed_contents) { // One of the tabs we're dragging has been destroyed. Cancel the drag. if (destroyed_contents->GetDelegate() == this) destroyed_contents->SetDelegate(NULL); @@ -426,12 +426,12 @@ void DraggedTabControllerGtk::Attach(TabStripGtk* attached_tabstrip, // Remove ourselves as the delegate now that the dragged TabContents is // being inserted back into a Browser. for (size_t i = 0; i < drag_data_->size(); ++i) { - drag_data_->get(i)->contents_->tab_contents()->SetDelegate(NULL); + drag_data_->get(i)->contents_->web_contents()->SetDelegate(NULL); drag_data_->get(i)->original_delegate_ = NULL; } // Return the TabContents' to normalcy. - drag_data_->GetSourceTabContents()->SetCapturingContents(false); + drag_data_->GetSourceWebContents()->SetCapturingContents(false); // We need to ask the tabstrip we're attached to ensure that the ideal // bounds for all its tabs are correctly generated, because the calculation @@ -490,7 +490,7 @@ void DraggedTabControllerGtk::Detach() { // Detaching resets the delegate, but we still want to be the delegate. for (size_t i = 0; i < drag_data_->size(); ++i) - drag_data_->get(i)->contents_->tab_contents()->SetDelegate(this); + drag_data_->get(i)->contents_->web_contents()->SetDelegate(this); attached_tabstrip_ = NULL; } @@ -785,7 +785,7 @@ bool DraggedTabControllerGtk::CompleteDrag() { void DraggedTabControllerGtk::ResetDelegates() { for (size_t i = 0; i < drag_data_->size(); ++i) { if (drag_data_->get(i)->contents_ && - drag_data_->get(i)->contents_->tab_contents()->GetDelegate() == this) { + drag_data_->get(i)->contents_->web_contents()->GetDelegate() == this) { drag_data_->get(i)->ResetDelegate(); } } @@ -794,7 +794,7 @@ void DraggedTabControllerGtk::ResetDelegates() { void DraggedTabControllerGtk::EnsureDraggedView() { if (!dragged_view_.get()) { gfx::Rect rect; - drag_data_->GetSourceTabContents()->GetContainerBounds(&rect); + drag_data_->GetSourceWebContents()->GetContainerBounds(&rect); dragged_view_.reset(new DraggedViewGtk(drag_data_.get(), mouse_offset_, rect.size())); } @@ -850,7 +850,7 @@ void DraggedTabControllerGtk::CleanUpDraggedTabs() { registrar_.Remove( this, content::NOTIFICATION_WEB_CONTENTS_DESTROYED, content::Source<WebContents>( - drag_data_->get(i)->contents_->tab_contents())); + drag_data_->get(i)->contents_->web_contents())); } source_tabstrip_->DestroyDraggedTab(drag_data_->get(i)->tab_); drag_data_->get(i)->tab_ = NULL; diff --git a/chrome/browser/ui/gtk/tabs/dragged_tab_controller_gtk.h b/chrome/browser/ui/gtk/tabs/dragged_tab_controller_gtk.h index 198b885..5b01d41 100644 --- a/chrome/browser/ui/gtk/tabs/dragged_tab_controller_gtk.h +++ b/chrome/browser/ui/gtk/tabs/dragged_tab_controller_gtk.h @@ -58,7 +58,7 @@ class DraggedTabControllerGtk : public content::NotificationObserver, // Retrieve the tab that corresponds to |contents| if it is being dragged by // this controller, or NULL if |contents| does not correspond to any tab // being dragged. - TabGtk* GetDraggedTabForContents(TabContents* contents); + TabGtk* GetDraggedTabForContents(content::WebContents* contents); // Returns true if |tab| matches any tab being dragged. bool IsDraggingTab(const TabGtk* tab); diff --git a/chrome/browser/ui/gtk/tabs/dragged_view_gtk.cc b/chrome/browser/ui/gtk/tabs/dragged_view_gtk.cc index 86ed7c8..2857c22 100644 --- a/chrome/browser/ui/gtk/tabs/dragged_view_gtk.cc +++ b/chrome/browser/ui/gtk/tabs/dragged_view_gtk.cc @@ -390,7 +390,7 @@ gboolean DraggedViewGtk::OnExpose(GtkWidget* widget, GdkEventExpose* event) { gtk_widget_get_allocation(widget, &allocation); // Draw the render area. - BackingStore* backing_store = drag_data_->GetSourceTabContents()-> + BackingStore* backing_store = drag_data_->GetSourceWebContents()-> GetRenderViewHost()->GetBackingStore(false); if (backing_store && !attached_) { // This leaves room for the border. diff --git a/chrome/browser/ui/gtk/tabs/tab_gtk.cc b/chrome/browser/ui/gtk/tabs/tab_gtk.cc index 7b0037a..e32085c 100644 --- a/chrome/browser/ui/gtk/tabs/tab_gtk.cc +++ b/chrome/browser/ui/gtk/tabs/tab_gtk.cc @@ -24,6 +24,8 @@ #include "ui/base/gtk/scoped_handle_gtk.h" #include "ui/gfx/path.h" +using content::WebContents; + namespace { // Returns the width of the title for the current font, in pixels. @@ -264,7 +266,7 @@ void TabGtk::CloseButtonClicked() { delegate_->CloseTab(this); } -void TabGtk::UpdateData(TabContents* contents, bool app, bool loading_only) { +void TabGtk::UpdateData(WebContents* contents, bool app, bool loading_only) { TabRendererGtk::UpdateData(contents, app, loading_only); // Cache the title width so we don't recalculate it every time the tab is // resized. diff --git a/chrome/browser/ui/gtk/tabs/tab_gtk.h b/chrome/browser/ui/gtk/tabs/tab_gtk.h index 85e24fd..145b48f 100644 --- a/chrome/browser/ui/gtk/tabs/tab_gtk.h +++ b/chrome/browser/ui/gtk/tabs/tab_gtk.h @@ -120,7 +120,7 @@ class TabGtk : public TabRendererGtk, virtual bool IsVisible() const OVERRIDE; virtual void SetVisible(bool visible) const OVERRIDE; virtual void CloseButtonClicked() OVERRIDE; - virtual void UpdateData(TabContents* contents, + virtual void UpdateData(content::WebContents* contents, bool app, bool loading_only) OVERRIDE; virtual void SetBounds(const gfx::Rect& bounds) OVERRIDE; diff --git a/chrome/browser/ui/gtk/tabs/tab_renderer_gtk.cc b/chrome/browser/ui/gtk/tabs/tab_renderer_gtk.cc index b34a600..bfb6d66 100644 --- a/chrome/browser/ui/gtk/tabs/tab_renderer_gtk.cc +++ b/chrome/browser/ui/gtk/tabs/tab_renderer_gtk.cc @@ -41,6 +41,8 @@ #include "ui/gfx/platform_font_pango.h" #include "ui/gfx/skbitmap_operations.h" +using content::WebContents; + #if !GTK_CHECK_VERSION(2, 22, 0) #define gtk_button_get_event_window(button) button->event_window #endif // Gtk+ >= 2.22 @@ -322,7 +324,7 @@ void TabRendererGtk::Observe(int type, theme_service_->GetColor(ThemeService::COLOR_BACKGROUND_TAB_TEXT); } -void TabRendererGtk::UpdateData(TabContents* contents, +void TabRendererGtk::UpdateData(WebContents* contents, bool app, bool loading_only) { DCHECK(contents); diff --git a/chrome/browser/ui/gtk/tabs/tab_renderer_gtk.h b/chrome/browser/ui/gtk/tabs/tab_renderer_gtk.h index a0617a2..b7cc579 100644 --- a/chrome/browser/ui/gtk/tabs/tab_renderer_gtk.h +++ b/chrome/browser/ui/gtk/tabs/tab_renderer_gtk.h @@ -31,9 +31,12 @@ class Size; } // namespace gfx class CustomDrawButton; -class TabContents; class GtkThemeService; +namespace content { +class WebContents; +} + namespace ui { class SlideAnimation; class ThrobAnimation; @@ -106,10 +109,10 @@ class TabRendererGtk : public ui::AnimationDelegate, const content::NotificationSource& source, const content::NotificationDetails& details) OVERRIDE; - // TabContents. If only the loading state was updated, the loading_only flag + // WebContents. If only the loading state was updated, the loading_only flag // should be specified. If other things change, set this flag to false to // update everything. - virtual void UpdateData(TabContents* contents, bool app, bool loading_only); + void UpdateData(content::WebContents* contents, bool app, bool loading_only); // Sets the blocked state of the tab. void SetBlocked(bool pinned); diff --git a/chrome/browser/ui/gtk/tabs/tab_strip_gtk.cc b/chrome/browser/ui/gtk/tabs/tab_strip_gtk.cc index 5b15a55..64c8946 100644 --- a/chrome/browser/ui/gtk/tabs/tab_strip_gtk.cc +++ b/chrome/browser/ui/gtk/tabs/tab_strip_gtk.cc @@ -29,8 +29,8 @@ #include "chrome/browser/ui/gtk/tabs/tab_strip_menu_controller.h" #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" #include "chrome/common/chrome_notification_types.h" -#include "content/browser/tab_contents/tab_contents.h" #include "content/public/browser/notification_source.h" +#include "content/public/browser/web_contents.h" #include "grit/theme_resources.h" #include "grit/theme_resources_standard.h" #include "grit/ui_resources.h" @@ -44,6 +44,8 @@ #include "ui/gfx/image/image.h" #include "ui/gfx/point.h" +using content::WebContents; + namespace { const int kDefaultAnimationDurationMs = 100; @@ -333,7 +335,7 @@ class InsertTabAnimation : public TabStripGtk::TabAnimation { // Handles removal of a Tab from |index| class RemoveTabAnimation : public TabStripGtk::TabAnimation { public: - RemoveTabAnimation(TabStripGtk* tabstrip, int index, TabContents* contents) + RemoveTabAnimation(TabStripGtk* tabstrip, int index, WebContents* contents) : TabAnimation(tabstrip, REMOVE), index_(index) { int tab_count = tabstrip->GetTabCount(); @@ -850,9 +852,9 @@ void TabStripGtk::UpdateLoadingAnimations() { } else { TabRendererGtk::AnimationState state; TabContentsWrapper* contents = model_->GetTabContentsAt(index); - if (!contents || !contents->tab_contents()->IsLoading()) { + if (!contents || !contents->web_contents()->IsLoading()) { state = TabGtk::ANIMATION_NONE; - } else if (contents->tab_contents()->IsWaitingForResponse()) { + } else if (contents->web_contents()->IsWaitingForResponse()) { state = TabGtk::ANIMATION_WAITING; } else { state = TabGtk::ANIMATION_LOADING; @@ -983,7 +985,7 @@ void TabStripGtk::TabInsertedAt(TabContentsWrapper* contents, // again. if (IsDragSessionActive()) { tab = drag_controller_->GetDraggedTabForContents( - contents->tab_contents()); + contents->web_contents()); if (tab) { // If the Tab was detached, it would have been animated closed but not // removed, so we need to reset this property. @@ -1007,7 +1009,7 @@ void TabStripGtk::TabInsertedAt(TabContentsWrapper* contents, if (!contains_tab) { TabData d = { tab, gfx::Rect() }; tab_data_.insert(tab_data_.begin() + index, d); - tab->UpdateData(contents->tab_contents(), model_->IsAppTab(index), false); + tab->UpdateData(contents->web_contents(), model_->IsAppTab(index), false); } tab->set_mini(model_->IsMiniTab(index)); tab->set_app(model_->IsAppTab(index)); @@ -1032,7 +1034,7 @@ void TabStripGtk::TabInsertedAt(TabContentsWrapper* contents, void TabStripGtk::TabDetachedAt(TabContentsWrapper* contents, int index) { GenerateIdealBounds(); - StartRemoveTabAnimation(index, contents->tab_contents()); + StartRemoveTabAnimation(index, contents->web_contents()); // Have to do this _after_ calling StartRemoveTabAnimation, so that any // previous remove is completed fully and index is valid in sync with the // model index. @@ -1120,7 +1122,7 @@ void TabStripGtk::TabChangedAt(TabContentsWrapper* contents, int index, // We'll receive another notification of the change asynchronously. return; } - tab->UpdateData(contents->tab_contents(), + tab->UpdateData(contents->web_contents(), model_->IsAppTab(index), change_type == LOADING_ONLY); tab->UpdateFromModel(); @@ -1944,7 +1946,7 @@ void TabStripGtk::StartInsertTabAnimation(int index) { active_animation_->Start(); } -void TabStripGtk::StartRemoveTabAnimation(int index, TabContents* contents) { +void TabStripGtk::StartRemoveTabAnimation(int index, WebContents* contents) { if (active_animation_.get()) { // Some animations (e.g. MoveTabAnimation) cause there to be a Layout when // they're completed (which includes canceled). Since |tab_data_| is now diff --git a/chrome/browser/ui/gtk/tabs/tab_strip_gtk.h b/chrome/browser/ui/gtk/tabs/tab_strip_gtk.h index 8f353f8..fb72d5d 100644 --- a/chrome/browser/ui/gtk/tabs/tab_strip_gtk.h +++ b/chrome/browser/ui/gtk/tabs/tab_strip_gtk.h @@ -412,7 +412,7 @@ class TabStripGtk : public TabStripModelObserver, // Starts various types of TabStrip animations. void StartInsertTabAnimation(int index); - void StartRemoveTabAnimation(int index, TabContents* contents); + void StartRemoveTabAnimation(int index, content::WebContents* contents); void StartMoveTabAnimation(int from_index, int to_index); void StartMiniTabAnimation(int index); void StartMiniMoveTabAnimation(int from_index, diff --git a/chrome/browser/ui/panels/panel_browser_window_cocoa.mm b/chrome/browser/ui/panels/panel_browser_window_cocoa.mm index d414b22..4597ff2 100644 --- a/chrome/browser/ui/panels/panel_browser_window_cocoa.mm +++ b/chrome/browser/ui/panels/panel_browser_window_cocoa.mm @@ -305,12 +305,12 @@ int PanelBrowserWindowCocoa::TitleOnlyHeight() const { void PanelBrowserWindowCocoa::TabInsertedAt(TabContentsWrapper* contents, int index, bool foreground) { - [controller_ tabInserted:contents->tab_contents()]; + [controller_ tabInserted:contents->web_contents()]; } void PanelBrowserWindowCocoa::TabDetachedAt(TabContentsWrapper* contents, int index) { - [controller_ tabDetached:contents->tab_contents()]; + [controller_ tabDetached:contents->web_contents()]; } // NativePanelTesting implementation. diff --git a/chrome/browser/ui/panels/panel_window_controller_cocoa.h b/chrome/browser/ui/panels/panel_window_controller_cocoa.h index 1d4ea54..651f7bc 100644 --- a/chrome/browser/ui/panels/panel_window_controller_cocoa.h +++ b/chrome/browser/ui/panels/panel_window_controller_cocoa.h @@ -63,8 +63,8 @@ class PanelBrowserWindowCocoa; - (ThemedWindowStyle)themedWindowStyle; - (NSPoint)themePatternPhase; -- (void)tabInserted:(TabContents*)contents; -- (void)tabDetached:(TabContents*)contents; +- (void)tabInserted:(content::WebContents*)contents; +- (void)tabDetached:(content::WebContents*)contents; // Sometimes (when we animate the size of the window) we want to stop resizing // the TabContents' cocoa view to avoid unnecessary rendering and issues diff --git a/chrome/browser/ui/panels/panel_window_controller_cocoa.mm b/chrome/browser/ui/panels/panel_window_controller_cocoa.mm index b3d04d7..6b24cc2 100644 --- a/chrome/browser/ui/panels/panel_window_controller_cocoa.mm +++ b/chrome/browser/ui/panels/panel_window_controller_cocoa.mm @@ -40,6 +40,8 @@ #include "ui/gfx/image/image.h" #include "ui/gfx/mac/nsimage_cache.h" +using content::WebContents; + const int kMinimumWindowSize = 1; const double kBoundsAnimationSpeedPixelsPerSecond = 1000; const double kBoundsAnimationMaxDurationSeconds = 0.18; @@ -182,10 +184,10 @@ enum { // we always deactivate the controls here. If we're created as an active // panel, we'll get a NSWindowDidBecomeKeyNotification and reactivate the web // view properly. See crbug.com/97831 for more details. - TabContents* tab_contents = [contentsController_ tabContents]; + WebContents* web_contents = [contentsController_ webContents]; // RWHV may be NULL in unit tests. - if (tab_contents && tab_contents->GetRenderWidgetHostView()) - tab_contents->GetRenderWidgetHostView()->SetActive(false); + if (web_contents && web_contents->GetRenderWidgetHostView()) + web_contents->GetRenderWidgetHostView()->SetActive(false); [window setFrame:frame display:YES animate:YES]; [self enableTabContentsViewAutosizing]; @@ -249,14 +251,14 @@ enum { [findBarCocoaController positionFindBarViewAtMaxY:maxY maxWidth:maxWidth]; } -- (void)tabInserted:(TabContents*)contents { - [contentsController_ changeTabContents:contents]; +- (void)tabInserted:(WebContents*)contents { + [contentsController_ changeWebContents:contents]; DCHECK(![[contentsController_ view] isHidden]); } -- (void)tabDetached:(TabContents*)contents { - DCHECK(contents == [contentsController_ tabContents]); - [contentsController_ changeTabContents:NULL]; +- (void)tabDetached:(WebContents*)contents { + DCHECK(contents == [contentsController_ webContents]); + [contentsController_ changeWebContents:NULL]; [[contentsController_ view] setHidden:YES]; } @@ -541,7 +543,7 @@ enum { // 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 = [contentsController_ tabContents]) { + if (WebContents* contents = [contentsController_ webContents]) { if (RenderWidgetHostView* rwhv = contents->GetRenderWidgetHostView()) rwhv->SetActive(true); } @@ -569,7 +571,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 = [contentsController_ tabContents]) { + if (WebContents* contents = [contentsController_ webContents]) { if (RenderWidgetHostView* rwhv = contents->GetRenderWidgetHostView()) rwhv->SetActive(false); } diff --git a/chrome/browser/ui/toolbar/toolbar_model_unittest.cc b/chrome/browser/ui/toolbar/toolbar_model_unittest.cc index a5bc9c8..ea46d4a 100644 --- a/chrome/browser/ui/toolbar/toolbar_model_unittest.cc +++ b/chrome/browser/ui/toolbar/toolbar_model_unittest.cc @@ -8,11 +8,12 @@ #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/toolbar/toolbar_model.h" #include "chrome/test/base/browser_with_test_window_test.h" -#include "content/browser/tab_contents/tab_contents.h" +#include "content/public/browser/web_contents.h" #include "content/public/common/url_constants.h" using content::OpenURLParams; using content::Referrer; +using content::WebContents; class ToolbarModelTest : public BrowserWithTestWindowTest { public: @@ -22,7 +23,7 @@ class ToolbarModelTest : public BrowserWithTestWindowTest { void NavigateAndCheckText(const std::string& url, const std::string& expected_text, bool should_display) { - TabContents* contents = browser()->GetTabContentsAt(0); + WebContents* contents = browser()->GetWebContentsAt(0); browser()->OpenURL(OpenURLParams( GURL(url), Referrer(), CURRENT_TAB, content::PAGE_TRANSITION_TYPED, false)); 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 75a0fde..1829fed 100644 --- a/chrome/browser/ui/views/find_bar_host_interactive_uitest.cc +++ b/chrome/browser/ui/views/find_bar_host_interactive_uitest.cc @@ -15,8 +15,8 @@ #include "chrome/common/chrome_notification_types.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/test/test_server.h" #include "ui/base/clipboard/clipboard.h" #include "ui/base/keycodes/keyboard_codes.h" @@ -97,7 +97,7 @@ IN_PROC_BROWSER_TEST_F(FindInPageTest, MAYBE_CrashEscHandlers) { browser()->ActivateTabAt(0, true); // Close tab B. - browser()->CloseTabContents(browser()->GetTabContentsAt(1)); + browser()->CloseTabContents(browser()->GetWebContentsAt(1)); // Click on the location bar so that Find box loses focus. ASSERT_NO_FATAL_FAILURE(ui_test_utils::ClickOnView(browser(), 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 42527d8..45e1e1a 100644 --- a/chrome/browser/ui/views/ssl_client_certificate_selector_browsertest.cc +++ b/chrome/browser/ui/views/ssl_client_certificate_selector_browsertest.cc @@ -10,8 +10,8 @@ #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 "content/public/browser/web_contents.h" #include "net/base/cert_test_util.h" #include "net/base/x509_certificate.h" #include "net/url_request/url_request.h" @@ -142,11 +142,11 @@ class SSLClientCertificateSelectorMultiTabTest AddTabAtIndex(1, GURL("about:blank"), content::PAGE_TRANSITION_LINK); AddTabAtIndex(2, GURL("about:blank"), content::PAGE_TRANSITION_LINK); - ASSERT_TRUE(NULL != browser()->GetTabContentsAt(0)); - ASSERT_TRUE(NULL != browser()->GetTabContentsAt(1)); - ASSERT_TRUE(NULL != browser()->GetTabContentsAt(2)); - ui_test_utils::WaitForLoadStop(browser()->GetTabContentsAt(1)); - ui_test_utils::WaitForLoadStop(browser()->GetTabContentsAt(2)); + ASSERT_TRUE(NULL != browser()->GetWebContentsAt(0)); + ASSERT_TRUE(NULL != browser()->GetWebContentsAt(1)); + ASSERT_TRUE(NULL != browser()->GetWebContentsAt(2)); + ui_test_utils::WaitForLoadStop(browser()->GetWebContentsAt(1)); + ui_test_utils::WaitForLoadStop(browser()->GetWebContentsAt(2)); selector_1_ = new SSLClientCertificateSelector( browser()->GetTabContentsWrapperAt(1), diff --git a/chrome/browser/ui/views/tabs/default_tab_drag_controller.cc b/chrome/browser/ui/views/tabs/default_tab_drag_controller.cc index 554dd8b..b691495 100644 --- a/chrome/browser/ui/views/tabs/default_tab_drag_controller.cc +++ b/chrome/browser/ui/views/tabs/default_tab_drag_controller.cc @@ -20,12 +20,12 @@ #include "chrome/browser/ui/views/tabs/native_view_photobooth.h" #include "chrome/browser/ui/views/tabs/tab.h" #include "chrome/browser/ui/views/tabs/tab_strip.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/notification_source.h" #include "content/public/browser/notification_types.h" #include "content/public/browser/user_metrics.h" +#include "content/public/browser/web_contents.h" #include "grit/theme_resources.h" #include "third_party/skia/include/core/SkBitmap.h" #include "ui/base/animation/animation.h" @@ -381,14 +381,14 @@ void DefaultTabDragController::InitTabDragData(BaseTab* tab, registrar_.Add( this, content::NOTIFICATION_WEB_CONTENTS_DESTROYED, - content::Source<WebContents>(drag_data->contents->tab_contents())); + content::Source<WebContents>(drag_data->contents->web_contents())); // We need to be the delegate so we receive messages about stuff, otherwise // our dragged TabContents may be replaced and subsequently // collected/destroyed while the drag is in process, leading to nasty crashes. drag_data->original_delegate = - drag_data->contents->tab_contents()->GetDelegate(); - drag_data->contents->tab_contents()->SetDelegate(this); + drag_data->contents->web_contents()->GetDelegate(); + drag_data->contents->web_contents()->SetDelegate(this); } void DefaultTabDragController::Drag() { @@ -491,7 +491,7 @@ void DefaultTabDragController::Observe( DCHECK_EQ(type, content::NOTIFICATION_WEB_CONTENTS_DESTROYED); WebContents* destroyed_contents = content::Source<WebContents>(source).ptr(); for (size_t i = 0; i < drag_data_.size(); ++i) { - if (drag_data_[i].contents->tab_contents() == destroyed_contents) { + if (drag_data_[i].contents->web_contents() == destroyed_contents) { // One of the tabs we're dragging has been destroyed. Cancel the drag. if (destroyed_contents->GetDelegate() == this) destroyed_contents->SetDelegate(NULL); @@ -839,12 +839,12 @@ void DefaultTabDragController::Attach(TabStrip* attached_tabstrip, // Remove ourselves as the delegate now that the dragged TabContents is // being inserted back into a Browser. for (size_t i = 0; i < drag_data_.size(); ++i) { - drag_data_[i].contents->tab_contents()->SetDelegate(NULL); + drag_data_[i].contents->web_contents()->SetDelegate(NULL); drag_data_[i].original_delegate = NULL; } // Return the TabContents' to normalcy. - source_dragged_contents()->tab_contents()->SetCapturingContents(false); + source_dragged_contents()->web_contents()->SetCapturingContents(false); // Inserting counts as a move. We don't want the tabs to jitter when the // user moves the tab immediately after attaching it. @@ -899,7 +899,7 @@ void DefaultTabDragController::Attach(TabStrip* attached_tabstrip, void DefaultTabDragController::Detach() { // Prevent the TabContents' HWND from being hidden by any of the model // operations performed during the drag. - source_dragged_contents()->tab_contents()->SetCapturingContents(true); + source_dragged_contents()->web_contents()->SetCapturingContents(true); // Calculate the drag bounds. std::vector<gfx::Rect> drag_bounds; @@ -922,7 +922,7 @@ void DefaultTabDragController::Detach() { attached_model->DetachTabContentsAt(index); // Detaching resets the delegate, but we still want to be the delegate. - drag_data_[i].contents->tab_contents()->SetDelegate(this); + drag_data_[i].contents->web_contents()->SetDelegate(this); // Detaching may end up deleting the tab, drop references to it. drag_data_[i].attached_tab = NULL; @@ -1274,8 +1274,8 @@ void DefaultTabDragController::CompleteDrag() { void DefaultTabDragController::ResetDelegates() { for (size_t i = 0; i < drag_data_.size(); ++i) { if (drag_data_[i].contents && - drag_data_[i].contents->tab_contents()->GetDelegate() == this) { - drag_data_[i].contents->tab_contents()->SetDelegate( + drag_data_[i].contents->web_contents()->GetDelegate() == this) { + drag_data_[i].contents->web_contents()->SetDelegate( drag_data_[i].original_delegate); } } @@ -1292,10 +1292,10 @@ void DefaultTabDragController::CreateDraggedView( // TabContents. NativeViewPhotobooth* photobooth = NativeViewPhotobooth::Create( - source_dragged_contents()->tab_contents()->GetNativeView()); + source_dragged_contents()->web_contents()->GetNativeView()); gfx::Rect content_bounds; - source_dragged_contents()->tab_contents()->GetContainerBounds( + source_dragged_contents()->web_contents()->GetContainerBounds( &content_bounds); std::vector<views::View*> renderers; diff --git a/chrome/browser/ui/webui/net_internals_ui_browsertest.cc b/chrome/browser/ui/webui/net_internals_ui_browsertest.cc index bf25c4c..1bed68a 100644 --- a/chrome/browser/ui/webui/net_internals_ui_browsertest.cc +++ b/chrome/browser/ui/webui/net_internals_ui_browsertest.cc @@ -19,7 +19,7 @@ #include "chrome/common/url_constants.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 "content/public/browser/web_ui_message_handler.h" #include "content/test/test_browser_thread.h" #include "googleurl/src/gurl.h" @@ -259,7 +259,7 @@ void NetInternalsTest::MessageHandler::AddCacheEntry( void NetInternalsTest::MessageHandler::NavigateToPrerender( const ListValue* list_value) { - RenderViewHost* host = browser()->GetTabContentsAt(1)->GetRenderViewHost(); + RenderViewHost* host = browser()->GetWebContentsAt(1)->GetRenderViewHost(); host->ExecuteJavascriptInWebFrame(string16(), ASCIIToUTF16("Click()")); } diff --git a/chrome/browser/ui/webui/ntp/new_tab_ui_browsertest.cc b/chrome/browser/ui/webui/ntp/new_tab_ui_browsertest.cc index 810ce22..586154f 100644 --- a/chrome/browser/ui/webui/ntp/new_tab_ui_browsertest.cc +++ b/chrome/browser/ui/webui/ntp/new_tab_ui_browsertest.cc @@ -6,9 +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/notification_service.h" #include "content/public/browser/notification_types.h" +#include "content/public/browser/render_process_host.h" +#include "content/public/browser/web_contents.h" #include "googleurl/src/gurl.h" using content::OpenURLParams; @@ -29,7 +30,7 @@ IN_PROC_BROWSER_TEST_F(NewTabUIBrowserTest, ChromeInternalLoadsNTP) { ui_test_utils::NavigateToURL(browser(), GURL("chrome-internal:")); bool empty_inner_html = false; ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( - browser()->GetTabContentsAt(0)->GetRenderViewHost(), L"", + browser()->GetWebContentsAt(0)->GetRenderViewHost(), L"", L"window.domAutomationController.send(document.body.innerHTML == '')", &empty_inner_html)); ASSERT_FALSE(empty_inner_html); @@ -48,7 +49,7 @@ IN_PROC_BROWSER_TEST_F(NewTabUIBrowserTest, LoadNTPInExistingProcess) { ui_test_utils::NavigateToURLWithDisposition( browser(), GURL(chrome::kChromeUINewTabURL), NEW_FOREGROUND_TAB, ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); - EXPECT_EQ(1, browser()->GetTabContentsAt(1)->GetMaxPageID()); + EXPECT_EQ(1, browser()->GetWebContentsAt(1)->GetMaxPageID()); // Navigate that tab to another site. This allows the NTP process to exit, // but it keeps the NTP SiteInstance (and its max_page_id) alive in history. @@ -69,25 +70,25 @@ IN_PROC_BROWSER_TEST_F(NewTabUIBrowserTest, LoadNTPInExistingProcess) { ui_test_utils::NavigateToURLWithDisposition( browser(), GURL(chrome::kChromeUINewTabURL), NEW_FOREGROUND_TAB, ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); - EXPECT_EQ(1, browser()->GetTabContentsAt(2)->GetMaxPageID()); + EXPECT_EQ(1, browser()->GetWebContentsAt(2)->GetMaxPageID()); browser()->CloseTab(); // Open another Web UI page in a new tab. ui_test_utils::NavigateToURLWithDisposition( browser(), GURL(chrome::kChromeUISettingsURL), NEW_FOREGROUND_TAB, ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); - EXPECT_EQ(1, browser()->GetTabContentsAt(2)->GetMaxPageID()); + EXPECT_EQ(1, browser()->GetWebContentsAt(2)->GetMaxPageID()); // At this point, opening another NTP will use the old SiteInstance in the // existing Web UI process, but the page IDs shouldn't affect each other. ui_test_utils::NavigateToURLWithDisposition( browser(), GURL(chrome::kChromeUINewTabURL), NEW_FOREGROUND_TAB, ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); - EXPECT_EQ(1, browser()->GetTabContentsAt(3)->GetMaxPageID()); + EXPECT_EQ(1, browser()->GetWebContentsAt(3)->GetMaxPageID()); // Only navigating to the NTP in the original tab should have a higher // page ID. browser()->ActivateTabAt(1, true); ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUINewTabURL)); - EXPECT_EQ(2, browser()->GetTabContentsAt(1)->GetMaxPageID()); + EXPECT_EQ(2, browser()->GetWebContentsAt(1)->GetMaxPageID()); } |