summaryrefslogtreecommitdiffstats
path: root/chrome/browser/download/download_manager.h
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/download/download_manager.h')
-rw-r--r--chrome/browser/download/download_manager.h37
1 files changed, 26 insertions, 11 deletions
diff --git a/chrome/browser/download/download_manager.h b/chrome/browser/download/download_manager.h
index 5cc4e0e..f01cb62 100644
--- a/chrome/browser/download/download_manager.h
+++ b/chrome/browser/download/download_manager.h
@@ -41,6 +41,7 @@
#include "base/observer_list.h"
#include "base/scoped_ptr.h"
#include "base/time.h"
+#include "chrome/browser/download/download_item.h"
#include "chrome/browser/download/download_status_updater_delegate.h"
#include "chrome/browser/download/download_process_handle.h"
#include "chrome/browser/ui/shell_dialogs.h"
@@ -48,7 +49,6 @@
class DownloadFileManager;
class DownloadHistory;
-class DownloadItem;
class DownloadPrefs;
class DownloadStatusUpdater;
class GURL;
@@ -56,6 +56,7 @@ class Profile;
class ResourceDispatcherHost;
class TabContents;
struct DownloadCreateInfo;
+struct DownloadHistoryInfo;
struct DownloadSaveInfo;
// Browser's download manager: manages all downloads and destination view.
@@ -114,7 +115,7 @@ class DownloadManager
bool Init(Profile* profile);
// Notifications sent from the download thread to the UI thread
- void StartDownload(DownloadCreateInfo* info);
+ void StartDownload(int32 id);
void UpdateDownload(int32 download_id, int64 size);
// |hash| is sha256 hash for the downloaded file. It is empty when the hash
// is not available.
@@ -190,13 +191,11 @@ class DownloadManager
// Methods called on completion of a query sent to the history system.
void OnQueryDownloadEntriesComplete(
- std::vector<DownloadCreateInfo>* entries);
- void OnCreateDownloadEntryComplete(
- DownloadCreateInfo info, int64 db_handle);
+ std::vector<DownloadHistoryInfo>* entries);
+ void OnCreateDownloadEntryComplete(int32 download_id, int64 db_handle);
// Display a new download in the appropriate browser UI.
- void ShowDownloadInBrowser(DownloadProcessHandle* process_handle,
- DownloadItem* download);
+ void ShowDownloadInBrowser(DownloadItem* download);
// The number of in progress (including paused) downloads.
int in_progress_count() const {
@@ -228,11 +227,18 @@ class DownloadManager
virtual void FileSelected(const FilePath& path, int index, void* params);
virtual void FileSelectionCanceled(void* params);
+ // Returns true if this download should show the "dangerous file" warning.
+ // Various factors are considered, such as the type of the file, whether a
+ // user action initiated the download, and whether the user has explicitly
+ // marked the file type as "auto open".
+ bool IsDangerous(const DownloadItem& download,
+ const DownloadStateInfo& state);
+
// Called when the user has validated the download of a dangerous file.
void DangerousDownloadValidated(DownloadItem* download);
// Callback function after url is checked with safebrowsing service.
- void CheckDownloadUrlDone(DownloadCreateInfo* info, bool is_dangerous_url);
+ void CheckDownloadUrlDone(int32 download_id, bool is_dangerous_url);
// Callback function after download file hash is checked with safebrowsing
// service.
@@ -273,17 +279,20 @@ class DownloadManager
// Called on the download thread to check whether the suggested file path
// exists. We don't check if the file exists on the UI thread to avoid UI
// stalls from interacting with the file system.
- void CheckIfSuggestedPathExists(DownloadCreateInfo* info,
+ void CheckIfSuggestedPathExists(int32 download_id,
+ DownloadStateInfo state,
const FilePath& default_path);
// Called on the UI thread once the DownloadManager has determined whether the
// suggested file path exists.
- void OnPathExistenceAvailable(DownloadCreateInfo* info);
+ void OnPathExistenceAvailable(int32 download_id,
+ DownloadStateInfo new_state);
// Called back after a target path for the file to be downloaded to has been
// determined, either automatically based on the suggested file name, or by
// the user in a Save As dialog box.
- void AttachDownloadItem(DownloadCreateInfo* info);
+ void ContinueDownloadWithPath(DownloadItem* download,
+ const FilePath& chosen_file);
// Download cancel helper function.
// |process_handle| is passed by value because it is ultimately passed to
@@ -313,8 +322,14 @@ class DownloadManager
// Inform observers that the model has changed.
void NotifyModelChanged();
+ // Get the download item from the history map. Useful after the item has
+ // been removed from the active map, or was retrieved from the history DB.
DownloadItem* GetDownloadItem(int id);
+ // Get the download item from the active map. Useful when the item is not
+ // yet in the history map.
+ DownloadItem* GetActiveDownloadItem(int id);
+
// Debugging routine to confirm relationship between below
// containers; no-op if NDEBUG.
void AssertContainersConsistent() const;