diff options
author | avi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-16 18:36:46 +0000 |
---|---|---|
committer | avi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-16 18:36:46 +0000 |
commit | 487053c8c4adbf66a005566e2b1719c515bc08cc (patch) | |
tree | 737e6d1acc82a175df9b416429e6ecd428537152 /content | |
parent | aab6a33baa61a3680f4cea67a63e6d4bd824c402 (diff) | |
download | chromium_src-487053c8c4adbf66a005566e2b1719c515bc08cc.zip chromium_src-487053c8c4adbf66a005566e2b1719c515bc08cc.tar.gz chromium_src-487053c8c4adbf66a005566e2b1719c515bc08cc.tar.bz2 |
Move download stuff to download tab helper.
BUG=71097
TEST=zero visible change in how the download system works
Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=85486
Review URL: http://codereview.chromium.org/6973035
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@85504 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
6 files changed, 9 insertions, 51 deletions
diff --git a/content/browser/tab_contents/tab_contents.cc b/content/browser/tab_contents/tab_contents.cc index d51e63e..b4aee7c 100644 --- a/content/browser/tab_contents/tab_contents.cc +++ b/content/browser/tab_contents/tab_contents.cc @@ -13,11 +13,9 @@ #include "base/string_util.h" #include "base/time.h" #include "base/utf_string_conversions.h" -#include "chrome/browser/browser_process.h" #include "chrome/browser/browser_shutdown.h" #include "chrome/browser/debugger/devtools_manager.h" #include "chrome/browser/defaults.h" -#include "chrome/browser/download/download_request_limiter.h" #include "chrome/browser/external_protocol_handler.h" #include "chrome/browser/history/history.h" #include "chrome/browser/load_from_memory_cache_details.h" @@ -856,26 +854,6 @@ bool TabContents::ShouldShowBookmarkBar() { false : render_manager_.web_ui()->force_bookmark_bar_visible(); } -bool TabContents::CanDownload(int request_id) { - TabContentsDelegate* d = delegate(); - if (d) - return d->CanDownload(request_id); - return true; -} - -void TabContents::OnStartDownload(DownloadItem* download) { - DCHECK(download); - - if (!delegate()) - return; - - // Download in a constrained popup is shown in the tab that opened it. - TabContents* tab_contents = delegate()->GetConstrainingContents(this); - - if (tab_contents && tab_contents->delegate()) - tab_contents->delegate()->OnStartDownload(download, this); -} - void TabContents::WillClose(ConstrainedWindow* window) { ConstrainedWindowList::iterator i( std::find(child_windows_.begin(), child_windows_.end(), window)); @@ -1954,11 +1932,8 @@ WebPreferences TabContents::GetWebkitPrefs() { } void TabContents::OnUserGesture() { - // See comment in RenderViewHostDelegate::OnUserGesture as to why we do this. - DownloadRequestLimiter* limiter = - g_browser_process->download_request_limiter(); - if (limiter) - limiter->OnUserGesture(this); + // Notify observers. + FOR_EACH_OBSERVER(TabContentsObserver, observers_, DidGetUserGesture()); ExternalProtocolHandler::PermitLaunchUrl(); } diff --git a/content/browser/tab_contents/tab_contents.h b/content/browser/tab_contents/tab_contents.h index f38ca63..99c25cf 100644 --- a/content/browser/tab_contents/tab_contents.h +++ b/content/browser/tab_contents/tab_contents.h @@ -44,13 +44,12 @@ namespace history { class HistoryAddPageArgs; } -class WebUI; -class DownloadItem; class Extension; class InfoBarDelegate; class LoadNotificationDetails; class PluginObserver; class Profile; +struct RendererPreferences; class RenderViewHost; class SessionStorageNamespace; class SiteInstance; @@ -59,11 +58,11 @@ class TabContentsDelegate; class TabContentsObserver; class TabContentsSSLHelper; class TabContentsView; -class URLPattern; -struct RendererPreferences; struct ThumbnailScore; +class URLPattern; struct ViewHostMsg_FrameNavigate_Params; struct WebPreferences; +class WebUI; // Describes what goes in the main content area of a tab. TabContents is // the only type of TabContents, and these should be merged together. @@ -389,13 +388,6 @@ class TabContents : public PageNavigator, // Returns true if a Bookmark Bar should be shown for this tab. virtual bool ShouldShowBookmarkBar(); - // Notifies the delegate that a download is about to be started. - // This notification is fired before a local temporary file has been created. - bool CanDownload(int request_id); - - // Notifies the delegate that a download started. - void OnStartDownload(DownloadItem* download); - // Called when a ConstrainedWindow we own is about to be closed. void WillClose(ConstrainedWindow* window); diff --git a/content/browser/tab_contents/tab_contents_delegate.cc b/content/browser/tab_contents/tab_contents_delegate.cc index 378c48e..27f94e1 100644 --- a/content/browser/tab_contents/tab_contents_delegate.cc +++ b/content/browser/tab_contents/tab_contents_delegate.cc @@ -93,14 +93,6 @@ int TabContentsDelegate::GetExtraRenderViewHeight() const { return 0; } -bool TabContentsDelegate::CanDownload(int request_id) { - return true; -} - -void TabContentsDelegate::OnStartDownload(DownloadItem* download, - TabContents* tab) { -} - bool TabContentsDelegate::HandleContextMenu(const ContextMenuParams& params) { return false; } diff --git a/content/browser/tab_contents/tab_contents_delegate.h b/content/browser/tab_contents/tab_contents_delegate.h index e0c95ac..fc9d4e4 100644 --- a/content/browser/tab_contents/tab_contents_delegate.h +++ b/content/browser/tab_contents/tab_contents_delegate.h @@ -26,7 +26,6 @@ class HistoryAddPageArgs; } struct ContextMenuParams; -class DownloadItem; class GURL; class HtmlDialogUIDelegate; struct NativeWebKeyboardEvent; @@ -202,10 +201,6 @@ class TabContentsDelegate { // This is used to make painting look smoother. virtual int GetExtraRenderViewHeight() const; - virtual bool CanDownload(int request_id); - - virtual void OnStartDownload(DownloadItem* download, TabContents* tab); - // Returns true if the context menu operation was handled by the delegate. virtual bool HandleContextMenu(const ContextMenuParams& params); diff --git a/content/browser/tab_contents/tab_contents_observer.cc b/content/browser/tab_contents/tab_contents_observer.cc index 3056608..4342aa1 100644 --- a/content/browser/tab_contents/tab_contents_observer.cc +++ b/content/browser/tab_contents/tab_contents_observer.cc @@ -70,6 +70,9 @@ void TabContentsObserver::DocumentLoadedInFrame(int64 frame_id) { void TabContentsObserver::DidFinishLoad(int64 frame_id) { } +void TabContentsObserver::DidGetUserGesture() { +} + void TabContentsObserver::DidStartLoading() { } diff --git a/content/browser/tab_contents/tab_contents_observer.h b/content/browser/tab_contents/tab_contents_observer.h index cc73b4f..d8598c7 100644 --- a/content/browser/tab_contents/tab_contents_observer.h +++ b/content/browser/tab_contents/tab_contents_observer.h @@ -68,6 +68,7 @@ class TabContentsObserver : public IPC::Channel::Listener, int error_code); virtual void DocumentLoadedInFrame(int64 frame_id); virtual void DidFinishLoad(int64 frame_id); + virtual void DidGetUserGesture(); virtual void DidStartLoading(); virtual void DidStopLoading(); |