diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-02 06:08:32 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-02 06:08:32 +0000 |
commit | fbc5e5f97c0bd570130471c85c207aee528eef4c (patch) | |
tree | 6988a8d7eb9f6995da952e08c3e806b66a394f6f /content/browser | |
parent | d270ff2dbac86886aa6a30b7fca6391b10498649 (diff) | |
download | chromium_src-fbc5e5f97c0bd570130471c85c207aee528eef4c.zip chromium_src-fbc5e5f97c0bd570130471c85c207aee528eef4c.tar.gz chromium_src-fbc5e5f97c0bd570130471c85c207aee528eef4c.tar.bz2 |
Convert chrome users of NavigationController::tab_contents() to use GetWebContents() instead.
BUG=98716
TBR=joi
Review URL: http://codereview.chromium.org/8986009
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@116086 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser')
9 files changed, 23 insertions, 18 deletions
diff --git a/content/browser/download/download_manager_impl.cc b/content/browser/download/download_manager_impl.cc index 29c8a15..309e7df 100644 --- a/content/browser/download/download_manager_impl.cc +++ b/content/browser/download/download_manager_impl.cc @@ -768,8 +768,7 @@ void DownloadManagerImpl::DownloadUrlToFile(const GURL& url, const GURL& referrer, const std::string& referrer_charset, const DownloadSaveInfo& save_info, - TabContents* tab_contents) { - DCHECK(tab_contents); + WebContents* web_contents) { ResourceDispatcherHost* resource_dispatcher_host = content::GetContentClient()->browser()->GetResourceDispatcherHost(); @@ -780,9 +779,9 @@ void DownloadManagerImpl::DownloadUrlToFile(const GURL& url, BrowserThread::IO, FROM_HERE, base::Bind(&BeginDownload, URLParams(url, referrer), save_info, resource_dispatcher_host, - RenderParams(tab_contents->GetRenderProcessHost()->GetID(), - tab_contents->GetRenderViewHost()->routing_id()), - &tab_contents->GetBrowserContext()->GetResourceContext())); + RenderParams(web_contents->GetRenderProcessHost()->GetID(), + web_contents->GetRenderViewHost()->routing_id()), + &web_contents->GetBrowserContext()->GetResourceContext())); } void DownloadManagerImpl::AddObserver(Observer* observer) { diff --git a/content/browser/download/download_manager_impl.h b/content/browser/download/download_manager_impl.h index 6966fa3..c45fe0a 100644 --- a/content/browser/download/download_manager_impl.h +++ b/content/browser/download/download_manager_impl.h @@ -70,7 +70,7 @@ class CONTENT_EXPORT DownloadManagerImpl const GURL& referrer, const std::string& referrer_encoding, const DownloadSaveInfo& save_info, - TabContents* tab_contents) OVERRIDE; + content::WebContents* web_contents) OVERRIDE; virtual void AddObserver(Observer* observer) OVERRIDE; virtual void RemoveObserver(Observer* observer) OVERRIDE; virtual void OnPersistentStoreQueryComplete( diff --git a/content/browser/download/mock_download_manager.cc b/content/browser/download/mock_download_manager.cc index b5f7142..d5f28db 100644 --- a/content/browser/download/mock_download_manager.cc +++ b/content/browser/download/mock_download_manager.cc @@ -8,6 +8,7 @@ #include "content/browser/download/download_item_impl.h" using content::DownloadItem; +using content::WebContents; MockDownloadManager::MockDownloadManager( content::DownloadManagerDelegate* delegate, @@ -101,7 +102,7 @@ void MockDownloadManager::DownloadUrlToFile( const GURL& referrer, const std::string& referrer_encoding, const DownloadSaveInfo& save_info, - TabContents* tab_contents) { + WebContents* web_contents) { } void MockDownloadManager::AddObserver(Observer* observer) { diff --git a/content/browser/download/mock_download_manager.h b/content/browser/download/mock_download_manager.h index d7a1f2b..f941572 100644 --- a/content/browser/download/mock_download_manager.h +++ b/content/browser/download/mock_download_manager.h @@ -56,7 +56,7 @@ class MockDownloadManager : public content::DownloadManager { const GURL& referrer, const std::string& referrer_encoding, const DownloadSaveInfo& save_info, - TabContents* tab_contents) OVERRIDE; + content::WebContents* web_contents) OVERRIDE; virtual void AddObserver(Observer* observer) OVERRIDE; virtual void RemoveObserver(Observer* observer) OVERRIDE; virtual void OnPersistentStoreQueryComplete( diff --git a/content/browser/tab_contents/interstitial_page.cc b/content/browser/tab_contents/interstitial_page.cc index 75369a9..6c89fcb 100644 --- a/content/browser/tab_contents/interstitial_page.cc +++ b/content/browser/tab_contents/interstitial_page.cc @@ -248,7 +248,7 @@ void InterstitialPage::Hide() { content::NotificationService::current()->Notify( content::NOTIFICATION_INTERSTITIAL_DETACHED, - content::Source<TabContents>(tab_), + content::Source<WebContents>(tab_), content::NotificationService::NoDetails()); delete this; @@ -343,7 +343,7 @@ void InterstitialPage::DidNavigate( // hiding the bookmark bar. content::NotificationService::current()->Notify( content::NOTIFICATION_INTERSTITIAL_ATTACHED, - content::Source<TabContents>(tab_), + content::Source<WebContents>(tab_), content::NotificationService::NoDetails()); RenderWidgetHostView* rwh_view = tab_->GetRenderViewHost()->view(); diff --git a/content/browser/tab_contents/navigation_controller.cc b/content/browser/tab_contents/navigation_controller.cc index 280fe99..55e6ce3 100644 --- a/content/browser/tab_contents/navigation_controller.cc +++ b/content/browser/tab_contents/navigation_controller.cc @@ -35,6 +35,7 @@ using content::GlobalRequestID; using content::NavigationEntry; using content::NavigationEntryImpl; using content::UserMetricsAction; +using content::WebContents; namespace { @@ -181,6 +182,10 @@ NavigationController::~NavigationController() { content::NotificationService::NoDetails()); } +WebContents* NavigationController::GetWebContents() const { + return tab_contents_; +} + content::BrowserContext* NavigationController::GetBrowserContext() const { return browser_context_; } diff --git a/content/browser/tab_contents/navigation_controller.h b/content/browser/tab_contents/navigation_controller.h index 0f7f687..2699d88 100644 --- a/content/browser/tab_contents/navigation_controller.h +++ b/content/browser/tab_contents/navigation_controller.h @@ -15,6 +15,7 @@ #include "content/public/browser/navigation_type.h" class SiteInstance; +class TabContents; struct ViewHostMsg_FrameNavigate_Params; namespace content { @@ -32,6 +33,7 @@ class CONTENT_EXPORT NavigationController virtual ~NavigationController(); // NavigationController implementation: + virtual content::WebContents* GetWebContents() const OVERRIDE; virtual content::BrowserContext* GetBrowserContext() const OVERRIDE; virtual void Restore( int selected_navigation, @@ -121,8 +123,6 @@ class CONTENT_EXPORT NavigationController // TabContents --------------------------------------------------------------- - // Returns the tab contents associated with this controller. Non-NULL except - // during set-up of the tab. TabContents* tab_contents() const { // This currently returns the active tab contents which should be renamed to // tab_contents. diff --git a/content/browser/tab_contents/navigation_controller_unittest.cc b/content/browser/tab_contents/navigation_controller_unittest.cc index 64e5458..b388f6d 100644 --- a/content/browser/tab_contents/navigation_controller_unittest.cc +++ b/content/browser/tab_contents/navigation_controller_unittest.cc @@ -1936,7 +1936,7 @@ TEST_F(NavigationControllerTest, CloneAndGoBack) { NavigateAndCommit(url1); NavigateAndCommit(url2); - scoped_ptr<TabContents> clone(controller().tab_contents()->Clone()); + scoped_ptr<TabContents> clone(controller().GetWebContents()->Clone()); ASSERT_EQ(2, clone->GetController().GetEntryCount()); EXPECT_TRUE(clone->GetController().NeedsReload()); @@ -1958,7 +1958,7 @@ TEST_F(NavigationControllerTest, CloneOmitsInterstitials) { interstitial_entry->set_page_type(content::PAGE_TYPE_INTERSTITIAL); controller().AddTransientEntry(interstitial_entry); - scoped_ptr<TabContents> clone(controller().tab_contents()->Clone()); + scoped_ptr<TabContents> clone(controller().GetWebContents()->Clone()); ASSERT_EQ(2, clone->GetController().GetEntryCount()); } diff --git a/content/browser/tab_contents/tab_contents.cc b/content/browser/tab_contents/tab_contents.cc index 808366a..8b26b57 100644 --- a/content/browser/tab_contents/tab_contents.cc +++ b/content/browser/tab_contents/tab_contents.cc @@ -1579,8 +1579,8 @@ void TabContents::NotifyDisconnected() { notify_disconnection_ = false; content::NotificationService::current()->Notify( - content::NOTIFICATION_TAB_CONTENTS_DISCONNECTED, - content::Source<TabContents>(this), + content::NOTIFICATION_WEB_CONTENTS_DISCONNECTED, + content::Source<WebContents>(this), content::NotificationService::NoDetails()); } @@ -1613,7 +1613,7 @@ content::ViewType TabContents::GetRenderViewType() const { void TabContents::RenderViewCreated(RenderViewHost* render_view_host) { content::NotificationService::current()->Notify( content::NOTIFICATION_RENDER_VIEW_HOST_CREATED_FOR_TAB, - content::Source<TabContents>(this), + content::Source<WebContents>(this), content::Details<RenderViewHost>(render_view_host)); NavigationEntry* entry = controller_.GetActiveEntry(); if (!entry) @@ -1898,7 +1898,7 @@ void TabContents::DocumentOnLoadCompletedInMainFrame( int32 page_id) { content::NotificationService::current()->Notify( content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME, - content::Source<TabContents>(this), + content::Source<WebContents>(this), content::Details<int>(&page_id)); } |