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

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

Issue 7374008: Move download stuff from download helper back to TabContents. This is basically a revert of r8576... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix unittests Created 9 years, 5 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 92629)
+++ content/browser/tab_contents/tab_contents.cc (working copy)
@@ -13,6 +13,7 @@
#include "base/string_util.h"
#include "base/time.h"
#include "base/utf_string_conversions.h"
+#include "chrome/browser/download/download_request_limiter.h"
#include "chrome/browser/profiles/profile.h"
#include "content/browser/child_process_security_policy.h"
#include "content/browser/content_browser_client.h"
@@ -24,6 +25,7 @@
#include "content/browser/renderer_host/render_process_host.h"
#include "content/browser/renderer_host/render_view_host.h"
#include "content/browser/renderer_host/render_widget_host_view.h"
+#include "content/browser/renderer_host/resource_dispatcher_host.h"
#include "content/browser/renderer_host/resource_request_details.h"
#include "content/browser/site_instance.h"
#include "content/browser/tab_contents/interstitial_page.h"
@@ -679,6 +681,19 @@
delegate()->SetFocusToLocationBar(select_all);
}
+bool TabContents::CanDownload(int request_id) {
+ TabContentsDelegate* d = delegate();
+ if (d)
+ return d->CanDownload(this, request_id);
+ return true;
+}
+
+void TabContents::OnStartDownload(DownloadItem* download) {
+ TabContentsDelegate* d = delegate();
+ if (d)
+ d->OnStartDownload(this, download);
+}
+
void TabContents::WillClose(ConstrainedWindow* window) {
ConstrainedWindowList::iterator i(
std::find(child_windows_.begin(), child_windows_.end(), window));
@@ -1643,6 +1658,11 @@
void TabContents::OnUserGesture() {
// Notify observers.
FOR_EACH_OBSERVER(TabContentsObserver, observers_, DidGetUserGesture());
+
+ ResourceDispatcherHost* rdh =
+ content::GetContentClient()->browser()->GetResourceDispatcherHost();
+ if (rdh) // NULL in unittests.
+ rdh->download_request_limiter()->OnUserGesture(this);
}
void TabContents::OnIgnoredUIEvent() {
« 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