diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-25 21:37:09 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-25 21:37:09 +0000 |
commit | ea049a01f82647dc12e4001c8be03e4124faaff3 (patch) | |
tree | 0bb59450d13be2f37e404cfd2374ea27fba7461f /content/browser | |
parent | 5ca3ddf71cb1db27e206c4d048770ad21e5688c9 (diff) | |
download | chromium_src-ea049a01f82647dc12e4001c8be03e4124faaff3.zip chromium_src-ea049a01f82647dc12e4001c8be03e4124faaff3.tar.gz chromium_src-ea049a01f82647dc12e4001c8be03e4124faaff3.tar.bz2 |
Convert a bunch of WebContentsObservers to use web_contents() instead of tab_contents(), as well as all the dependent code.
BUG=98716
TBR=joi
Review URL: http://codereview.chromium.org/8982008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@115777 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser')
-rw-r--r-- | content/browser/debugger/render_view_devtools_agent_host.cc | 4 | ||||
-rw-r--r-- | content/browser/download/save_package.cc | 5 | ||||
-rw-r--r-- | content/browser/download/save_package.h | 4 | ||||
-rw-r--r-- | content/browser/tab_contents/interstitial_page.cc | 7 | ||||
-rw-r--r-- | content/browser/tab_contents/tab_contents.cc | 13 | ||||
-rw-r--r-- | content/browser/tab_contents/tab_contents.h | 4 |
6 files changed, 22 insertions, 15 deletions
diff --git a/content/browser/debugger/render_view_devtools_agent_host.cc b/content/browser/debugger/render_view_devtools_agent_host.cc index fd3574e..72ffe8f 100644 --- a/content/browser/debugger/render_view_devtools_agent_host.cc +++ b/content/browser/debugger/render_view_devtools_agent_host.cc @@ -46,13 +46,13 @@ bool DevToolsAgentHostRegistry::HasDevToolsAgentHost(RenderViewHost* rvh) { return it != g_instances.Get().end(); } -bool DevToolsAgentHostRegistry::IsDebuggerAttached(TabContents* tab_contents) { +bool DevToolsAgentHostRegistry::IsDebuggerAttached(WebContents* web_contents) { if (g_instances == NULL) return false; DevToolsManager* devtools_manager = DevToolsManager::GetInstance(); if (!devtools_manager) return false; - RenderViewHostDelegate* delegate = tab_contents; + RenderViewHostDelegate* delegate = static_cast<TabContents*>(web_contents); for (Instances::iterator it = g_instances.Get().begin(); it != g_instances.Get().end(); ++it) { if (it->first->delegate() != delegate) diff --git a/content/browser/download/save_package.cc b/content/browser/download/save_package.cc index ffc2cd7..b09be32 100644 --- a/content/browser/download/save_package.cc +++ b/content/browser/download/save_package.cc @@ -1150,6 +1150,11 @@ const FilePath::CharType* SavePackage::ExtensionForMimeType( return FILE_PATH_LITERAL(""); } +TabContents* SavePackage::tab_contents() const { + return + static_cast<TabContents*>(content::WebContentsObserver::web_contents()); +} + void SavePackage::GetSaveInfo() { // Can't use tab_contents_ in the file thread, so get the data that we need // before calling to it. diff --git a/content/browser/download/save_package.h b/content/browser/download/save_package.h index 5e36b70..e18a160 100644 --- a/content/browser/download/save_package.h +++ b/content/browser/download/save_package.h @@ -122,9 +122,7 @@ class CONTENT_EXPORT SavePackage SavePackageType save_type() const { return save_type_; } int tab_id() const { return tab_id_; } int id() const { return unique_id_; } - TabContents* tab_contents() const { - return content::WebContentsObserver::tab_contents(); - } + TabContents* tab_contents() const; void GetSaveInfo(); diff --git a/content/browser/tab_contents/interstitial_page.cc b/content/browser/tab_contents/interstitial_page.cc index 0b34ede..125d12e3 100644 --- a/content/browser/tab_contents/interstitial_page.cc +++ b/content/browser/tab_contents/interstitial_page.cc @@ -34,6 +34,7 @@ #include "net/url_request/url_request_context_getter.h" using content::BrowserThread; +using content::WebContents; using WebKit::WebDragOperation; using WebKit::WebDragOperationsMask; @@ -205,8 +206,8 @@ void InterstitialPage::Show() { render_view_host_->NavigateToURL(GURL(data_url)); notification_registrar_.Add(this, - content::NOTIFICATION_TAB_CONTENTS_DESTROYED, - content::Source<TabContents>(tab_)); + content::NOTIFICATION_WEB_CONTENTS_DESTROYED, + content::Source<WebContents>(tab_)); notification_registrar_.Add(this, content::NOTIFICATION_NAV_ENTRY_COMMITTED, content::Source<NavigationController>(&tab_->GetController())); notification_registrar_.Add(this, content::NOTIFICATION_NAV_ENTRY_PENDING, @@ -279,7 +280,7 @@ void InterstitialPage::Observe(int type, TakeActionOnResourceDispatcher(CANCEL); } break; - case content::NOTIFICATION_TAB_CONTENTS_DESTROYED: + case content::NOTIFICATION_WEB_CONTENTS_DESTROYED: case content::NOTIFICATION_NAV_ENTRY_COMMITTED: if (action_taken_ == NO_ACTION) { // We are navigating away from the interstitial or closing a tab with an diff --git a/content/browser/tab_contents/tab_contents.cc b/content/browser/tab_contents/tab_contents.cc index 3ada454..327f407 100644 --- a/content/browser/tab_contents/tab_contents.cc +++ b/content/browser/tab_contents/tab_contents.cc @@ -112,6 +112,7 @@ using content::DevToolsManagerImpl; using content::DownloadItem; using content::DownloadManager; using content::UserMetricsAction; +using content::WebContents; using content::WebContentsObserver; namespace { @@ -244,8 +245,8 @@ TabContents::~TabContents() { // Notify any observer that have a reference on this tab contents. content::NotificationService::current()->Notify( - content::NOTIFICATION_TAB_CONTENTS_DESTROYED, - content::Source<TabContents>(this), + content::NOTIFICATION_WEB_CONTENTS_DESTROYED, + content::Source<WebContents>(this), content::NotificationService::NoDetails()); // TODO(brettw) this should be moved to the view. @@ -347,6 +348,10 @@ void TabContents::SetViewType(content::ViewType type) { view_type_ = type; } +content::ViewType TabContents::GetViewType() const { + return view_type_; +} + const GURL& TabContents::GetURL() const { // We may not have a navigation entry yet NavigationEntry* entry = controller_.GetActiveEntry(); @@ -572,8 +577,8 @@ void TabContents::WasHidden() { } content::NotificationService::current()->Notify( - content::NOTIFICATION_TAB_CONTENTS_HIDDEN, - content::Source<TabContents>(this), + content::NOTIFICATION_WEB_CONTENTS_HIDDEN, + content::Source<WebContents>(this), content::NotificationService::NoDetails()); } diff --git a/content/browser/tab_contents/tab_contents.h b/content/browser/tab_contents/tab_contents.h index 26de662..04bc8fc 100644 --- a/content/browser/tab_contents/tab_contents.h +++ b/content/browser/tab_contents/tab_contents.h @@ -19,8 +19,6 @@ #include "content/browser/renderer_host/java/java_bridge_dispatcher_host_manager.h" #include "content/browser/renderer_host/render_view_host_delegate.h" #include "content/browser/tab_contents/navigation_controller.h" -#include "content/browser/tab_contents/navigation_entry.h" -#include "content/browser/tab_contents/page_navigator.h" #include "content/browser/tab_contents/render_view_host_manager.h" #include "content/common/content_export.h" #include "content/public/browser/web_contents.h" @@ -51,7 +49,6 @@ struct WebIntentData; class CONTENT_EXPORT TabContents : public NON_EXPORTED_BASE(content::WebContents), - public PageNavigator, public RenderViewHostDelegate, public RenderViewHostManager::Delegate, public content::JavaScriptDialogDelegate { @@ -136,6 +133,7 @@ class CONTENT_EXPORT TabContents virtual const NavigationController& GetController() const OVERRIDE; virtual content::BrowserContext* GetBrowserContext() const OVERRIDE; virtual void SetViewType(content::ViewType type) OVERRIDE; + virtual content::ViewType GetViewType() const OVERRIDE; virtual content::RenderProcessHost* GetRenderProcessHost() const OVERRIDE; virtual RenderViewHost* GetRenderViewHost() const OVERRIDE; virtual RenderWidgetHostView* GetRenderWidgetHostView() const OVERRIDE; |