Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(342)

Side by Side Diff: content/public/browser/download_manager.h

Issue 10704052: Download filename determination refactor (3/3) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Use a callback with DetermineDownloadTarget(). Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 // The DownloadManager object manages the process of downloading, including 5 // The DownloadManager object manages the process of downloading, including
6 // updates to the history system and providing the information for displaying 6 // updates to the history system and providing the information for displaying
7 // the downloads view in the Destinations tab. There is one DownloadManager per 7 // the downloads view in the Destinations tab. There is one DownloadManager per
8 // active browser context in Chrome. 8 // active browser context in Chrome.
9 // 9 //
10 // Download observers: 10 // Download observers:
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 class CONTENT_EXPORT Observer { 81 class CONTENT_EXPORT Observer {
82 public: 82 public:
83 // New or deleted download, observers should query us for the current set 83 // New or deleted download, observers should query us for the current set
84 // of downloads. 84 // of downloads.
85 virtual void ModelChanged(DownloadManager* manager) = 0; 85 virtual void ModelChanged(DownloadManager* manager) = 0;
86 86
87 // Called when the DownloadManager is being destroyed to prevent Observers 87 // Called when the DownloadManager is being destroyed to prevent Observers
88 // from calling back to a stale pointer. 88 // from calling back to a stale pointer.
89 virtual void ManagerGoingDown(DownloadManager* manager) {} 89 virtual void ManagerGoingDown(DownloadManager* manager) {}
90 90
91 // Called immediately after the DownloadManager puts up a select file
92 // dialog.
93 // |id| indicates which download opened the dialog.
94 virtual void SelectFileDialogDisplayed(
95 DownloadManager* manager, int32 id) {}
Randy Smith (Not in Mondays) 2012/07/10 18:33:09 The DownloadTestObserver overrides this still. No
asanka 2012/07/11 20:03:32 Yeah. I haven't reworked the tests yet.
96
97 protected: 91 protected:
98 virtual ~Observer() {} 92 virtual ~Observer() {}
99 }; 93 };
100 94
101 typedef std::vector<DownloadItem*> DownloadVector; 95 typedef std::vector<DownloadItem*> DownloadVector;
102 96
103 // If |dir_path| is empty, appends all temporary downloads to |*result|. 97 // If |dir_path| is empty, appends all temporary downloads to |*result|.
104 // Otherwise, appends all temporary downloads that reside in |dir_path| to 98 // Otherwise, appends all temporary downloads that reside in |dir_path| to
105 // |*result|. 99 // |*result|.
106 virtual void GetTemporaryDownloads(const FilePath& dir_path, 100 virtual void GetTemporaryDownloads(const FilePath& dir_path,
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 // Called by the embedder, in response to 183 // Called by the embedder, in response to
190 // DownloadManagerDelegate::AddItemToPersistentStore. 184 // DownloadManagerDelegate::AddItemToPersistentStore.
191 virtual void OnItemAddedToPersistentStore(int32 download_id, 185 virtual void OnItemAddedToPersistentStore(int32 download_id,
192 int64 db_handle) = 0; 186 int64 db_handle) = 0;
193 187
194 // The number of in progress (including paused) downloads. 188 // The number of in progress (including paused) downloads.
195 virtual int InProgressCount() const = 0; 189 virtual int InProgressCount() const = 0;
196 190
197 virtual BrowserContext* GetBrowserContext() const = 0; 191 virtual BrowserContext* GetBrowserContext() const = 0;
198 192
199 virtual FilePath LastDownloadPath() = 0;
200
201 // Creates the download item. Must be called on the UI thread. 193 // Creates the download item. Must be called on the UI thread.
202 // Returns the |BoundNetLog| used by the |DownloadItem|. 194 // Returns the |BoundNetLog| used by the |DownloadItem|.
203 virtual net::BoundNetLog CreateDownloadItem(DownloadCreateInfo* info) = 0; 195 virtual net::BoundNetLog CreateDownloadItem(DownloadCreateInfo* info) = 0;
204 196
205 // Creates a download item for the SavePackage system. 197 // Creates a download item for the SavePackage system.
206 // Must be called on the UI thread. Note that the DownloadManager 198 // Must be called on the UI thread. Note that the DownloadManager
207 // retains ownership. 199 // retains ownership.
208 virtual DownloadItem* CreateSavePackageDownloadItem( 200 virtual DownloadItem* CreateSavePackageDownloadItem(
209 const FilePath& main_file_path, 201 const FilePath& main_file_path,
210 const GURL& page_url, 202 const GURL& page_url,
211 bool is_otr, 203 bool is_otr,
212 const std::string& mime_type, 204 const std::string& mime_type,
213 DownloadItem::Observer* observer) = 0; 205 DownloadItem::Observer* observer) = 0;
214 206
215 // Clears the last download path, used to initialize "save as" dialogs. 207 // Clears transient state. Invoked when the user wants to clear history
216 virtual void ClearLastDownloadPath() = 0; 208 // including transient state.
217 209 virtual void ClearTransientState() = 0;
218 // Called by the delegate after the save as dialog is closed.
219 virtual void FileSelected(const FilePath& path, int32 download_id) = 0;
220 virtual void FileSelectionCanceled(int32 download_id) = 0;
221
222 // Called by the delegate if it delayed the download in
223 // DownloadManagerDelegate::ShouldStartDownload and now is ready.
224 virtual void RestartDownload(int32 download_id) = 0;
225 210
226 // Checks whether downloaded files still exist. Updates state of downloads 211 // Checks whether downloaded files still exist. Updates state of downloads
227 // that refer to removed files. The check runs in the background and may 212 // that refer to removed files. The check runs in the background and may
228 // finish asynchronously after this method returns. 213 // finish asynchronously after this method returns.
229 virtual void CheckForHistoryFilesRemoval() = 0; 214 virtual void CheckForHistoryFilesRemoval() = 0;
230 215
231 // Get the download item from the history map. Useful after the item has 216 // Get the download item from the history map. Useful after the item has
232 // been removed from the active map, or was retrieved from the history DB. 217 // been removed from the active map, or was retrieved from the history DB.
233 virtual DownloadItem* GetDownloadItem(int id) = 0; 218 virtual DownloadItem* GetDownloadItem(int id) = 0;
234 219
(...skipping 13 matching lines...) Expand all
248 protected: 233 protected:
249 virtual ~DownloadManager() {} 234 virtual ~DownloadManager() {}
250 235
251 private: 236 private:
252 friend class base::RefCountedThreadSafe<DownloadManager>; 237 friend class base::RefCountedThreadSafe<DownloadManager>;
253 }; 238 };
254 239
255 } // namespace content 240 } // namespace content
256 241
257 #endif // CONTENT_PUBLIC_BROWSER_DOWNLOAD_MANAGER_H_ 242 #endif // CONTENT_PUBLIC_BROWSER_DOWNLOAD_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698