| 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 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/time.h" | 12 #include "base/time.h" |
| 13 #include "content/common/content_export.h" | 13 #include "content/common/content_export.h" |
| 14 #include "content/public/browser/download_danger_type.h" | 14 #include "content/public/browser/download_danger_type.h" |
| 15 #include "content/public/browser/download_item.h" | 15 #include "content/public/browser/download_item.h" |
| 16 #include "content/public/browser/save_page_type.h" | 16 #include "content/public/browser/save_page_type.h" |
| 17 | 17 |
| 18 namespace content { | 18 namespace content { |
| 19 | 19 |
| 20 class BrowserContext; |
| 20 class DownloadId; | 21 class DownloadId; |
| 21 class WebContents; | 22 class WebContents; |
| 22 | 23 |
| 23 // Called by SavePackage when it creates a DownloadItem. | 24 // Called by SavePackage when it creates a DownloadItem. |
| 24 typedef base::Callback<void(DownloadItem*)> | 25 typedef base::Callback<void(DownloadItem*)> |
| 25 SavePackageDownloadCreatedCallback; | 26 SavePackageDownloadCreatedCallback; |
| 26 | 27 |
| 27 // Will be called asynchronously with the results of the ChooseSavePath | 28 // Will be called asynchronously with the results of the ChooseSavePath |
| 28 // operation. If the delegate wants notification of the download item created | 29 // operation. If the delegate wants notification of the download item created |
| 29 // in response to this operation, the SavePackageDownloadCreatedCallback will be | 30 // in response to this operation, the SavePackageDownloadCreatedCallback will be |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 // Notifies the delegate that it should remove the download item from its | 122 // Notifies the delegate that it should remove the download item from its |
| 122 // persistent store. | 123 // persistent store. |
| 123 virtual void RemoveItemFromPersistentStore(DownloadItem* item) {} | 124 virtual void RemoveItemFromPersistentStore(DownloadItem* item) {} |
| 124 | 125 |
| 125 // Notifies the delegate to remove downloads from the given time range. | 126 // Notifies the delegate to remove downloads from the given time range. |
| 126 virtual void RemoveItemsFromPersistentStoreBetween( | 127 virtual void RemoveItemsFromPersistentStoreBetween( |
| 127 base::Time remove_begin, | 128 base::Time remove_begin, |
| 128 base::Time remove_end) {} | 129 base::Time remove_end) {} |
| 129 | 130 |
| 130 // Retrieve the directories to save html pages and downloads to. | 131 // Retrieve the directories to save html pages and downloads to. |
| 131 virtual void GetSaveDir(WebContents* web_contents, | 132 virtual void GetSaveDir(BrowserContext* browser_context, |
| 132 FilePath* website_save_dir, | 133 FilePath* website_save_dir, |
| 133 FilePath* download_save_dir, | 134 FilePath* download_save_dir, |
| 134 bool* skip_dir_check) {} | 135 bool* skip_dir_check) {} |
| 135 | 136 |
| 136 // Asks the user for the path to save a page. The delegate calls the callback | 137 // Asks the user for the path to save a page. The delegate calls the callback |
| 137 // to give the answer. | 138 // to give the answer. |
| 138 virtual void ChooseSavePath(WebContents* web_contents, | 139 virtual void ChooseSavePath(WebContents* web_contents, |
| 139 const FilePath& suggested_path, | 140 const FilePath& suggested_path, |
| 140 const FilePath::StringType& default_extension, | 141 const FilePath::StringType& default_extension, |
| 141 bool can_save_as_complete, | 142 bool can_save_as_complete, |
| 142 const SavePackagePathPickedCallback& callback) { | 143 const SavePackagePathPickedCallback& callback) { |
| 143 } | 144 } |
| 144 | 145 |
| 145 protected: | 146 protected: |
| 146 virtual ~DownloadManagerDelegate(); | 147 virtual ~DownloadManagerDelegate(); |
| 147 }; | 148 }; |
| 148 | 149 |
| 149 } // namespace content | 150 } // namespace content |
| 150 | 151 |
| 151 #endif // CONTENT_PUBLIC_BROWSER_DOWNLOAD_MANAGER_DELEGATE_H_ | 152 #endif // CONTENT_PUBLIC_BROWSER_DOWNLOAD_MANAGER_DELEGATE_H_ |
| OLD | NEW |