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