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