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

Unified Diff: content/browser/download/save_package.h

Issue 7277073: Support for adding save page download items into downloads history. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' 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
Index: content/browser/download/save_package.h
===================================================================
--- content/browser/download/save_package.h (revision 94123)
+++ content/browser/download/save_package.h (working copy)
@@ -17,11 +17,10 @@
#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
#include "base/task.h"
+#include "chrome/browser/download/download_manager.h"
#include "content/browser/tab_contents/tab_contents_observer.h"
#include "googleurl/src/gurl.h"
-class DownloadItem;
-class DownloadManager;
class GURL;
class MessageLoop;
class PrefService;
@@ -53,6 +52,7 @@
// saving job, and exist for the duration of one tab's life time.
class SavePackage : public base::RefCountedThreadSafe<SavePackage>,
public TabContentsObserver,
+ public DownloadItem::Observer,
public base::SupportsWeakPtr<SavePackage> {
public:
enum SavePackageType {
@@ -160,8 +160,18 @@
void DoSavingProcess();
// TabContentsObserver implementation.
- virtual bool OnMessageReceived(const IPC::Message& message);
+ virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
+ // DownloadItem::Observer implementation.
+ virtual void OnDownloadUpdated(DownloadItem* download) OVERRIDE;
+ virtual void OnDownloadOpened(DownloadItem* download) OVERRIDE {}
+
+ // Update the download history of this item upon completion.
+ void FinalizeDownloadEntry();
+
+ // Detach from DownloadManager.
+ void StopObservation();
+
// Return max length of a path for a specific base directory.
// This is needed on POSIX, which restrict the length of file names in
// addition to the restriction on the length of path names.
@@ -265,8 +275,8 @@
// Non-owning pointer for handling file writing on the file thread.
SaveFileManager* file_manager_;
- // We use a fake DownloadItem here in order to reuse the DownloadItemView.
- // This class owns the pointer.
+ // DownloadManager owns the DownloadItem and handles history and UI.
+ DownloadManager* download_manager_;
DownloadItem* download_;
// The URL of the page the user wants to save.

Powered by Google App Engine
This is Rietveld 408576698