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

Unified Diff: chrome/browser/instant/instant_loader.cc

Issue 6973035: Move download stuff to download tab helper. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Oops, forgot to add tab watcher as delegate with CF. 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 | « chrome/browser/external_tab_container_win.cc ('k') | chrome/browser/ui/browser.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/instant/instant_loader.cc
diff --git a/chrome/browser/instant/instant_loader.cc b/chrome/browser/instant/instant_loader.cc
index ca99beac3556954c330a2352f58296c0a4739eeb..f686ecb88928eca1229c996078012340a2a1c702 100644
--- a/chrome/browser/instant/instant_loader.cc
+++ b/chrome/browser/instant/instant_loader.cc
@@ -21,6 +21,8 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/search_engines/template_url.h"
#include "chrome/browser/ui/blocked_content/blocked_content_tab_helper.h"
+#include "chrome/browser/ui/download/download_tab_helper.h"
+#include "chrome/browser/ui/download/download_tab_helper_delegate.h"
#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/render_messages.h"
@@ -142,7 +144,8 @@ void InstantLoader::FrameLoadObserver::Observe(
class InstantLoader::TabContentsDelegateImpl
: public TabContentsDelegate,
public NotificationObserver,
- public TabContentsObserver {
+ public TabContentsObserver,
+ public DownloadTabHelperDelegate {
public:
explicit TabContentsDelegateImpl(InstantLoader* loader);
@@ -208,7 +211,6 @@ class InstantLoader::TabContentsDelegateImpl
// instant result when the drag ends, so that during the drag the page won't
// move around.
virtual void DragEnded() OVERRIDE;
- virtual bool CanDownload(int request_id) OVERRIDE;
virtual void HandleMouseUp() OVERRIDE;
virtual void HandleMouseActivate() OVERRIDE;
virtual bool OnGoToEntryOffset(int offset) OVERRIDE;
@@ -220,6 +222,11 @@ class InstantLoader::TabContentsDelegateImpl
// TabContentsObserver:
virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
+ // DownloadTabHelperDelegate:
+ virtual bool CanDownload(int request_id) OVERRIDE;
+ virtual void OnStartDownload(DownloadItem* download,
+ TabContentsWrapper* tab) OVERRIDE;
+
private:
typedef std::vector<scoped_refptr<history::HistoryAddPageArgs> >
AddPageVector;
@@ -511,11 +518,6 @@ void InstantLoader::TabContentsDelegateImpl::DragEnded() {
CommitFromMouseReleaseIfNecessary();
}
-bool InstantLoader::TabContentsDelegateImpl::CanDownload(int request_id) {
- // Downloads are disabled.
- return false;
-}
-
void InstantLoader::TabContentsDelegateImpl::HandleMouseUp() {
CommitFromMouseReleaseIfNecessary();
}
@@ -560,6 +562,16 @@ bool InstantLoader::TabContentsDelegateImpl::OnMessageReceived(
return handled;
}
+bool InstantLoader::TabContentsDelegateImpl::CanDownload(int request_id) {
+ // Downloads are disabled.
+ return false;
+}
+
+void InstantLoader::TabContentsDelegateImpl::OnStartDownload(
+ DownloadItem* download, TabContentsWrapper* tab) {
+ // Downloads are disabled.
+}
+
void InstantLoader::TabContentsDelegateImpl::OnSetSuggestions(
int32 page_id,
const std::vector<std::string>& suggestions,
@@ -810,6 +822,7 @@ TabContentsWrapper* InstantLoader::ReleasePreviewContents(
#endif
}
preview_contents_->tab_contents()->set_delegate(NULL);
+ preview_contents_->download_tab_helper()->set_delegate(NULL);
ready_ = false;
}
update_bounds_timer_.Stop();
@@ -972,7 +985,7 @@ void InstantLoader::SendBoundsToPage(bool force_if_waiting) {
if (preview_contents_.get() && is_showing_instant() &&
(force_if_waiting || !is_waiting_for_load())) {
last_omnibox_bounds_ = omnibox_bounds_;
- RenderViewHost*host = preview_contents_->render_view_host();
+ RenderViewHost* host = preview_contents_->render_view_host();
host->Send(new ViewMsg_SearchBoxResize(
host->routing_id(), GetOmniboxBoundsInTermsOfPreview()));
}
@@ -993,6 +1006,8 @@ void InstantLoader::CreatePreviewContents(TabContentsWrapper* tab_contents) {
preview_tab_contents_delegate_.reset(new TabContentsDelegateImpl(this));
new_contents->set_delegate(preview_tab_contents_delegate_.get());
+ preview_contents_->download_tab_helper()->set_delegate(
+ preview_tab_contents_delegate_.get());
gfx::Rect tab_bounds;
tab_contents->view()->GetContainerBounds(&tab_bounds);
« no previous file with comments | « chrome/browser/external_tab_container_win.cc ('k') | chrome/browser/ui/browser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698