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

Unified Diff: chrome/browser/ui/download/download_tab_helper.cc

Issue 6871020: Added functionality to use "SaveAs..." from PDF plugin. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 8 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/ui/download/download_tab_helper.h ('k') | chrome/common/render_messages.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/download/download_tab_helper.cc
===================================================================
--- chrome/browser/ui/download/download_tab_helper.cc (revision 81782)
+++ chrome/browser/ui/download/download_tab_helper.cc (working copy)
@@ -7,11 +7,13 @@
#include "chrome/browser/download/download_manager.h"
#include "chrome/browser/download/download_util.h"
#include "chrome/browser/profiles/profile.h"
+#include "chrome/common/render_messages.h"
#include "content/browser/tab_contents/tab_contents.h"
+#include "content/common/view_messages.h"
DownloadTabHelper::DownloadTabHelper(TabContents* tab_contents)
- : tab_contents_(tab_contents) {
- DCHECK(tab_contents_);
+ : TabContentsObserver(tab_contents) {
+ DCHECK(tab_contents);
}
DownloadTabHelper::~DownloadTabHelper() {
@@ -19,23 +21,23 @@
void DownloadTabHelper::OnSavePage() {
// If we can not save the page, try to download it.
- if (!SavePackage::IsSavableContents(tab_contents_->contents_mime_type())) {
- DownloadManager* dlm = tab_contents_->profile()->GetDownloadManager();
- const GURL& current_page_url = tab_contents_->GetURL();
+ if (!SavePackage::IsSavableContents(tab_contents()->contents_mime_type())) {
+ DownloadManager* dlm = tab_contents()->profile()->GetDownloadManager();
+ const GURL& current_page_url = tab_contents()->GetURL();
if (dlm && current_page_url.is_valid()) {
- dlm->DownloadUrl(current_page_url, GURL(), "", tab_contents_);
+ dlm->DownloadUrl(current_page_url, GURL(), "", tab_contents());
download_util::RecordDownloadCount(
download_util::INITIATED_BY_SAVE_PACKAGE_FAILURE_COUNT);
}
return;
}
- tab_contents_->Stop();
+ tab_contents()->Stop();
// Create the save package and possibly prompt the user for the name to save
// the page as. The user prompt is an asynchronous operation that runs on
// another thread.
- save_package_ = new SavePackage(tab_contents_);
+ save_package_ = new SavePackage(tab_contents());
save_package_->GetSaveInfo();
}
@@ -46,9 +48,20 @@
const FilePath& dir_path,
SavePackage::SavePackageType save_type) {
// Stop the page from navigating.
- tab_contents_->Stop();
+ tab_contents()->Stop();
save_package_ =
- new SavePackage(tab_contents_, save_type, main_file, dir_path);
+ new SavePackage(tab_contents(), save_type, main_file, dir_path);
return save_package_->Init();
}
+
+bool DownloadTabHelper::OnMessageReceived(const IPC::Message& message) {
+ bool handled = true;
+ IPC_BEGIN_MESSAGE_MAP(DownloadTabHelper, message)
+ IPC_MESSAGE_HANDLER(ViewHostMsg_SaveAs, OnSavePage)
+ IPC_MESSAGE_UNHANDLED(handled = false)
+ IPC_END_MESSAGE_MAP()
+
+ return handled;
+}
+
« no previous file with comments | « chrome/browser/ui/download/download_tab_helper.h ('k') | chrome/common/render_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698