Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2066)

Unified Diff: content/browser/tab_contents/tab_contents.cc

Issue 7035015: Revert 85504 - Move download stuff to download tab helper. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/tab_contents/tab_contents.h ('k') | content/browser/tab_contents/tab_contents_delegate.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/tab_contents/tab_contents.cc
===================================================================
--- content/browser/tab_contents/tab_contents.cc (revision 85514)
+++ content/browser/tab_contents/tab_contents.cc (working copy)
@@ -13,9 +13,11 @@
#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"
@@ -854,6 +856,26 @@
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));
@@ -1932,8 +1954,11 @@
}
void TabContents::OnUserGesture() {
- // Notify observers.
- FOR_EACH_OBSERVER(TabContentsObserver, observers_, DidGetUserGesture());
+ // See comment in RenderViewHostDelegate::OnUserGesture as to why we do this.
+ DownloadRequestLimiter* limiter =
+ g_browser_process->download_request_limiter();
+ if (limiter)
+ limiter->OnUserGesture(this);
ExternalProtocolHandler::PermitLaunchUrl();
}
« no previous file with comments | « content/browser/tab_contents/tab_contents.h ('k') | content/browser/tab_contents/tab_contents_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698