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

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

Issue 10535026: Move creation and ownership of DownloadManager from the embedder to content. This matches all the o… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix cros compile Created 8 years, 6 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 53
54 class BrowserContext; 54 class BrowserContext;
55 class DownloadManagerDelegate; 55 class DownloadManagerDelegate;
56 class DownloadQuery; 56 class DownloadQuery;
57 class DownloadUrlParameters; 57 class DownloadUrlParameters;
58 58
59 // Browser's download manager: manages all downloads and destination view. 59 // Browser's download manager: manages all downloads and destination view.
60 class CONTENT_EXPORT DownloadManager 60 class CONTENT_EXPORT DownloadManager
61 : public base::RefCountedThreadSafe<DownloadManager> { 61 : public base::RefCountedThreadSafe<DownloadManager> {
62 public: 62 public:
63 static DownloadManager* Create(
64 DownloadManagerDelegate* delegate,
65 net::NetLog* net_log);
66
67 // A method that can be used in tests to ensure that all the internal download 63 // A method that can be used in tests to ensure that all the internal download
68 // classes have no pending downloads. 64 // classes have no pending downloads.
69 static bool EnsureNoPendingDownloadsForTesting(); 65 static bool EnsureNoPendingDownloadsForTesting();
70 66
71 // Shutdown the download manager. Must be called before destruction. 67 // Sets the delegate for this DownloadManager. The delegate has to live past
68 // its Shutdown method being called.
Randy Smith (Not in Mondays) 2012/06/06 15:51:59 Which is under the control of the DownloadManager?
jam 2012/06/06 16:06:15 I've clarified the comment to say that Shutdown is
69 virtual void SetDelegate(DownloadManagerDelegate* delegate) = 0;
tfarina 2012/06/06 15:44:15 There is already a SetDownloadManagerDelegate in t
jam 2012/06/06 15:53:05 thanks, I'll remove SetDownloadManagerDelegate
70
71 // Shutdown the download manager. Called by content before destruction.
72 virtual void Shutdown() = 0; 72 virtual void Shutdown() = 0;
73 73
74 // Interface to implement for observers that wish to be informed of changes 74 // Interface to implement for observers that wish to be informed of changes
75 // to the DownloadManager's collection of downloads. 75 // to the DownloadManager's collection of downloads.
76 class CONTENT_EXPORT Observer { 76 class CONTENT_EXPORT Observer {
77 public: 77 public:
78 // New or deleted download, observers should query us for the current set 78 // New or deleted download, observers should query us for the current set
79 // of downloads. 79 // of downloads.
80 virtual void ModelChanged(DownloadManager* manager) = 0; 80 virtual void ModelChanged(DownloadManager* manager) = 0;
81 81
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 224
225 // Called when Save Page download is done. 225 // Called when Save Page download is done.
226 virtual void SavePageDownloadFinished(DownloadItem* download) = 0; 226 virtual void SavePageDownloadFinished(DownloadItem* download) = 0;
227 227
228 // Get the download item from the active map. Useful when the item is not 228 // Get the download item from the active map. Useful when the item is not
229 // yet in the history map. 229 // yet in the history map.
230 virtual DownloadItem* GetActiveDownloadItem(int id) = 0; 230 virtual DownloadItem* GetActiveDownloadItem(int id) = 0;
231 231
232 virtual bool GenerateFileHash() = 0; 232 virtual bool GenerateFileHash() = 0;
233 233
234 virtual DownloadManagerDelegate* delegate() const = 0; 234 virtual DownloadManagerDelegate* delegate() const = 0;
tfarina 2012/06/06 15:44:15 nit: s/delegate/GetDelegate
235 235
236 // For testing only. May be called from tests indirectly (through 236 // For testing only. May be called from tests indirectly (through
237 // other for testing only methods). 237 // other for testing only methods).
238 virtual void SetDownloadManagerDelegate( 238 virtual void SetDownloadManagerDelegate(
239 DownloadManagerDelegate* delegate) = 0; 239 DownloadManagerDelegate* delegate) = 0;
240 240
241 protected: 241 protected:
242 virtual ~DownloadManager() {} 242 virtual ~DownloadManager() {}
243 243
244 private: 244 private:
245 friend class base::RefCountedThreadSafe<DownloadManager>; 245 friend class base::RefCountedThreadSafe<DownloadManager>;
246 }; 246 };
247 247
248 } // namespace content 248 } // namespace content
249 249
250 #endif // CONTENT_PUBLIC_BROWSER_DOWNLOAD_MANAGER_H_ 250 #endif // CONTENT_PUBLIC_BROWSER_DOWNLOAD_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698