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" |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 // Allows the delegate to override opening the download. If this function | 93 // Allows the delegate to override opening the download. If this function |
94 // returns false, the delegate needs to call | 94 // returns false, the delegate needs to call |
95 // DownloadItem::DelayedDownloadOpened when it's done with the item, | 95 // DownloadItem::DelayedDownloadOpened when it's done with the item, |
96 // and is responsible for opening it. This function is called | 96 // and is responsible for opening it. This function is called |
97 // after the final rename, but before the download state is set to COMPLETED. | 97 // after the final rename, but before the download state is set to COMPLETED. |
98 virtual bool ShouldOpenDownload(DownloadItem* item); | 98 virtual bool ShouldOpenDownload(DownloadItem* item); |
99 | 99 |
100 // Returns true if we need to generate a binary hash for downloads. | 100 // Returns true if we need to generate a binary hash for downloads. |
101 virtual bool GenerateFileHash(); | 101 virtual bool GenerateFileHash(); |
102 | 102 |
103 // Notifies the delegate that a new download item is created. The | |
104 // DownloadManager waits for the delegate to add information about this | |
105 // download to its persistent store. When the delegate is done, it calls | |
106 // DownloadManager::OnDownloadItemAddedToPersistentStore. | |
107 virtual void AddItemToPersistentStore(DownloadItem* item) {} | |
108 | |
109 // Notifies the delegate that information about the given download has change, | |
110 // so that it can update its persistent store. | |
111 // Does not update |url|, |start_time|, |total_bytes|; uses |db_handle| only | |
112 // to select the row in the database table to update. | |
113 virtual void UpdateItemInPersistentStore(DownloadItem* item) {} | |
114 | |
115 // Notifies the delegate that path for the download item has changed, so that | |
116 // it can update its persistent store. | |
117 virtual void UpdatePathForItemInPersistentStore( | |
118 DownloadItem* item, | |
119 const FilePath& new_path) {} | |
120 | |
121 // Notifies the delegate that it should remove the download item from its | |
122 // persistent store. | |
123 virtual void RemoveItemFromPersistentStore(DownloadItem* item) {} | |
124 | |
125 // Notifies the delegate to remove downloads from the given time range. | |
126 virtual void RemoveItemsFromPersistentStoreBetween( | |
127 base::Time remove_begin, | |
128 base::Time remove_end) {} | |
129 | |
130 // Retrieve the directories to save html pages and downloads to. | 103 // Retrieve the directories to save html pages and downloads to. |
131 virtual void GetSaveDir(WebContents* web_contents, | 104 virtual void GetSaveDir(WebContents* web_contents, |
132 FilePath* website_save_dir, | 105 FilePath* website_save_dir, |
133 FilePath* download_save_dir, | 106 FilePath* download_save_dir, |
134 bool* skip_dir_check) {} | 107 bool* skip_dir_check) {} |
135 | 108 |
136 // Asks the user for the path to save a page. The delegate calls the callback | 109 // Asks the user for the path to save a page. The delegate calls the callback |
137 // to give the answer. | 110 // to give the answer. |
138 virtual void ChooseSavePath(WebContents* web_contents, | 111 virtual void ChooseSavePath(WebContents* web_contents, |
139 const FilePath& suggested_path, | 112 const FilePath& suggested_path, |
140 const FilePath::StringType& default_extension, | 113 const FilePath::StringType& default_extension, |
141 bool can_save_as_complete, | 114 bool can_save_as_complete, |
142 const SavePackagePathPickedCallback& callback) { | 115 const SavePackagePathPickedCallback& callback) { |
143 } | 116 } |
144 | 117 |
145 protected: | 118 protected: |
146 virtual ~DownloadManagerDelegate(); | 119 virtual ~DownloadManagerDelegate(); |
147 }; | 120 }; |
148 | 121 |
149 } // namespace content | 122 } // namespace content |
150 | 123 |
151 #endif // CONTENT_PUBLIC_BROWSER_DOWNLOAD_MANAGER_DELEGATE_H_ | 124 #endif // CONTENT_PUBLIC_BROWSER_DOWNLOAD_MANAGER_DELEGATE_H_ |
OLD | NEW |