| Index: chrome/browser/download/chrome_download_manager_delegate.h
|
| diff --git a/chrome/browser/download/chrome_download_manager_delegate.h b/chrome/browser/download/chrome_download_manager_delegate.h
|
| index bec1cc974f01f50854f25d1109f98ded4ec30dfd..cc9beb91050ab0bd43ff95e291992d42302c8cb4 100644
|
| --- a/chrome/browser/download/chrome_download_manager_delegate.h
|
| +++ b/chrome/browser/download/chrome_download_manager_delegate.h
|
| @@ -56,10 +56,9 @@ class ChromeDownloadManagerDelegate
|
|
|
| virtual void Shutdown() OVERRIDE;
|
| virtual content::DownloadId GetNextId() OVERRIDE;
|
| - virtual bool ShouldStartDownload(int32 download_id) OVERRIDE;
|
| - virtual void ChooseDownloadPath(content::DownloadItem* item) OVERRIDE;
|
| - virtual FilePath GetIntermediatePath(
|
| - const content::DownloadItem& item) OVERRIDE;
|
| + virtual bool DetermineDownloadTarget(
|
| + content::DownloadItem* item,
|
| + const content::DownloadTargetCallback& callback) OVERRIDE;
|
| virtual content::WebContents*
|
| GetAlternativeWebContentsToNotifyForDownload() OVERRIDE;
|
| virtual bool ShouldOpenFileBasedOnExtension(const FilePath& path) OVERRIDE;
|
| @@ -79,6 +78,7 @@ class ChromeDownloadManagerDelegate
|
| virtual void RemoveItemsFromPersistentStoreBetween(
|
| base::Time remove_begin,
|
| base::Time remove_end) OVERRIDE;
|
| + virtual void ClearTransientState() OVERRIDE;
|
| virtual void GetSaveDir(content::WebContents* web_contents,
|
| FilePath* website_save_dir,
|
| FilePath* download_save_dir,
|
| @@ -118,7 +118,18 @@ class ChromeDownloadManagerDelegate
|
| const FilePath& target_path,
|
| const FilePath& default_download_path,
|
| bool should_uniquify_path,
|
| - const DownloadPathReservationTracker::ReservedPathCallback callback);
|
| + const DownloadPathReservationTracker::ReservedPathCallback& callback);
|
| +
|
| + // Displays the file chooser dialog to prompt the user for the download
|
| + // location for |item|. |suggested_path| will be used as the initial download
|
| + // path. Once a location is available |file_selected_callback| will be invoked
|
| + // with the selected full path. If the user cancels the dialog, then an empty
|
| + // FilePath will be passed into |file_selected_callback|. Protected virtual
|
| + // for testing.
|
| + virtual void ChooseDownloadPath(content::DownloadItem* item,
|
| + const FilePath& suggested_path,
|
| + const base::Callback<void(const FilePath&)>&
|
| + file_selected_callback);
|
|
|
| // So that test classes that inherit from this for override purposes
|
| // can call back into the DownloadManager.
|
| @@ -135,6 +146,7 @@ class ChromeDownloadManagerDelegate
|
| // Callback function after url is checked with safebrowsing service.
|
| void CheckDownloadUrlDone(
|
| int32 download_id,
|
| + const content::DownloadTargetCallback& callback,
|
| safe_browsing::DownloadProtectionService::DownloadCheckResult result);
|
|
|
| // Callback function after the DownloadProtectionService completes.
|
| @@ -148,9 +160,11 @@ class ChromeDownloadManagerDelegate
|
| // download. Invokes |DownloadPathReservationTracker::GetReservedPath| to get
|
| // a reserved path for the download. The path is then passed into
|
| // OnPathReservationAvailable().
|
| - void CheckVisitedReferrerBeforeDone(int32 download_id,
|
| - content::DownloadDangerType danger_type,
|
| - bool visited_referrer_before);
|
| + void CheckVisitedReferrerBeforeDone(
|
| + int32 download_id,
|
| + const content::DownloadTargetCallback& callback,
|
| + content::DownloadDangerType danger_type,
|
| + bool visited_referrer_before);
|
|
|
| #if defined (OS_CHROMEOS)
|
| // GDataDownloadObserver::SubstituteGDataDownloadPath callback. Calls
|
| @@ -159,21 +173,36 @@ class ChromeDownloadManagerDelegate
|
| // OnPathReservationAvailable().
|
| void SubstituteGDataDownloadPathCallback(
|
| int32 download_id,
|
| + const content::DownloadTargetCallback& callback,
|
| bool should_prompt,
|
| bool is_forced_path,
|
| content::DownloadDangerType danger_type,
|
| const FilePath& unverified_path);
|
| #endif
|
|
|
| + // Determine the intermediate path to use for |target_path|. |danger_type|
|
| + // specifies the danger level of the download.
|
| + FilePath GetIntermediatePath(const FilePath& target_path,
|
| + content::DownloadDangerType danger_type);
|
| +
|
| // Called on the UI thread once a reserved path is available. Updates the
|
| // download identified by |download_id| with the |target_path|, target
|
| // disposition and |danger_type|.
|
| void OnPathReservationAvailable(
|
| int32 download_id,
|
| + const content::DownloadTargetCallback& callback,
|
| bool should_prompt,
|
| content::DownloadDangerType danger_type,
|
| - const FilePath& target_path,
|
| - bool target_path_verified);
|
| + const FilePath& reserved_path,
|
| + bool reserved_path_verified);
|
| +
|
| + // Called on the UI thread once the final target path is available.
|
| + void OnTargetPathDetermined(
|
| + int32 download_id,
|
| + const content::DownloadTargetCallback& callback,
|
| + content::DownloadItem::TargetDisposition disposition,
|
| + content::DownloadDangerType danger_type,
|
| + const FilePath& target_path);
|
|
|
| // Callback from history system.
|
| void OnItemAddedToPersistentStore(int32 download_id, int64 db_handle);
|
| @@ -212,6 +241,10 @@ class ChromeDownloadManagerDelegate
|
| // off-record profiles, so ExtensionSystem cannot own the EDER.
|
| scoped_ptr<ExtensionDownloadsEventRouter> extension_event_router_;
|
|
|
| + // The directory most recently chosen by the user in response to a Save As
|
| + // dialog for a regular download.
|
| + FilePath last_download_path_;
|
| +
|
| DISALLOW_COPY_AND_ASSIGN(ChromeDownloadManagerDelegate);
|
| };
|
|
|
|
|