Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CONTENT_PUBLIC_BROWSER_DOWNLOAD_MANAGER_DELEGATE_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_DOWNLOAD_MANAGER_DELEGATE_H_ |
| 6 #define CONTENT_PUBLIC_BROWSER_DOWNLOAD_MANAGER_DELEGATE_H_ | 6 #define CONTENT_PUBLIC_BROWSER_DOWNLOAD_MANAGER_DELEGATE_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| 11 #include "base/file_path.h" | 11 #include "base/file_path.h" |
| 12 #include "base/logging.h" | |
| 12 #include "base/time.h" | 13 #include "base/time.h" |
| 13 #include "content/common/content_export.h" | 14 #include "content/common/content_export.h" |
| 14 #include "content/public/browser/save_page_type.h" | 15 #include "content/public/browser/save_page_type.h" |
| 15 | 16 |
| 16 namespace content { | 17 namespace content { |
| 17 | 18 |
| 18 class DownloadId; | 19 class DownloadId; |
| 19 class DownloadItem; | 20 class DownloadItem; |
| 20 class WebContents; | 21 class WebContents; |
| 21 | 22 |
| 22 typedef base::Callback<void(const FilePath&, content::SavePageType)> | 23 // Called by SavePackage when it creates a DownloadItem. |
| 24 typedef base::Callback<void(DownloadItem*)> | |
| 25 SaveFileDownloadCreatedCallback; | |
|
Randy Smith (Not in Mondays)
2012/04/27 18:24:04
So I had a heck of a time figuring out how this th
benjhayden
2012/04/28 19:09:03
Actually, my bp is on the low end. My doctor sugge
| |
| 26 | |
| 27 // Called by SavePackageFilePicker when the user picks a filename. | |
| 28 typedef base::Callback<void(const FilePath&, | |
| 29 content::SavePageType, | |
| 30 const SaveFileDownloadCreatedCallback&)> | |
| 23 SaveFilePathPickedCallback; | 31 SaveFilePathPickedCallback; |
| 24 | 32 |
| 25 // Browser's download manager: manages all downloads and destination view. | 33 // Browser's download manager: manages all downloads and destination view. |
| 26 class CONTENT_EXPORT DownloadManagerDelegate { | 34 class CONTENT_EXPORT DownloadManagerDelegate { |
| 27 public: | 35 public: |
| 28 virtual ~DownloadManagerDelegate() {} | 36 virtual ~DownloadManagerDelegate(); |
| 29 | 37 |
| 30 // Lets the delegate know that the download manager is shutting down. | 38 // Lets the delegate know that the download manager is shutting down. |
| 31 virtual void Shutdown() {} | 39 virtual void Shutdown() {} |
| 32 | 40 |
| 33 // Returns a new DownloadId. | 41 // Returns a new DownloadId. |
| 34 virtual DownloadId GetNextId(); | 42 virtual DownloadId GetNextId(); |
| 35 | 43 |
| 36 // Notifies the delegate that a download is starting. The delegate can return | 44 // Notifies the delegate that a download is starting. The delegate can return |
| 37 // false to delay the start of the download, in which case it should call | 45 // false to delay the start of the download, in which case it should call |
| 38 // DownloadManager::RestartDownload when it's ready. | 46 // DownloadManager::RestartDownload when it's ready. |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 102 virtual void RemoveItemsFromPersistentStoreBetween( | 110 virtual void RemoveItemsFromPersistentStoreBetween( |
| 103 base::Time remove_begin, | 111 base::Time remove_begin, |
| 104 base::Time remove_end) {} | 112 base::Time remove_end) {} |
| 105 | 113 |
| 106 // Retrieve the directories to save html pages and downloads to. | 114 // Retrieve the directories to save html pages and downloads to. |
| 107 virtual void GetSaveDir(WebContents* web_contents, | 115 virtual void GetSaveDir(WebContents* web_contents, |
| 108 FilePath* website_save_dir, | 116 FilePath* website_save_dir, |
| 109 FilePath* download_save_dir) {} | 117 FilePath* download_save_dir) {} |
| 110 | 118 |
| 111 // Asks the user for the path to save a page. The delegate calls the callback | 119 // Asks the user for the path to save a page. The delegate calls the callback |
| 112 // to give the answer, except on ChromeOS, where the saving is done by | 120 // to give the answer. |
| 113 // SavePackageFilePickerChromeOS. TODO(achuith): Move ChromeOS save | |
| 114 // functionality to SavePackage. | |
| 115 virtual void ChooseSavePath(WebContents* web_contents, | 121 virtual void ChooseSavePath(WebContents* web_contents, |
| 116 const FilePath& suggested_path, | 122 const FilePath& suggested_path, |
| 117 const FilePath::StringType& default_extension, | 123 const FilePath::StringType& default_extension, |
| 118 bool can_save_as_complete, | 124 bool can_save_as_complete, |
| 119 SaveFilePathPickedCallback callback) {} | 125 const SaveFilePathPickedCallback& callback) { |
| 126 } | |
| 120 }; | 127 }; |
| 121 | 128 |
| 122 } // namespace content | 129 } // namespace content |
| 123 | 130 |
| 124 #endif // CONTENT_PUBLIC_BROWSER_DOWNLOAD_MANAGER_DELEGATE_H_ | 131 #endif // CONTENT_PUBLIC_BROWSER_DOWNLOAD_MANAGER_DELEGATE_H_ |
| OLD | NEW |