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

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

Issue 14593012: BrowserContext should simply own DownloadManager (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 7 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
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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 class BrowserContext; 49 class BrowserContext;
50 class ByteStreamReader; 50 class ByteStreamReader;
51 class DownloadManagerDelegate; 51 class DownloadManagerDelegate;
52 class DownloadQuery; 52 class DownloadQuery;
53 class DownloadRequestHandle; 53 class DownloadRequestHandle;
54 class DownloadUrlParameters; 54 class DownloadUrlParameters;
55 struct DownloadCreateInfo; 55 struct DownloadCreateInfo;
56 struct DownloadRetrieveInfo; 56 struct DownloadRetrieveInfo;
57 57
58 // Browser's download manager: manages all downloads and destination view. 58 // Browser's download manager: manages all downloads and destination view.
59 class CONTENT_EXPORT DownloadManager 59 class CONTENT_EXPORT DownloadManager : public base::SupportsUserData::Data {
60 : public base::RefCountedThreadSafe<DownloadManager> {
61 public: 60 public:
61 virtual ~DownloadManager() {}
62
62 // Sets/Gets the delegate for this DownloadManager. The delegate has to live 63 // Sets/Gets the delegate for this DownloadManager. The delegate has to live
63 // past its Shutdown method being called (by the DownloadManager). 64 // past its Shutdown method being called (by the DownloadManager).
64 virtual void SetDelegate(DownloadManagerDelegate* delegate) = 0; 65 virtual void SetDelegate(DownloadManagerDelegate* delegate) = 0;
65 virtual DownloadManagerDelegate* GetDelegate() const = 0; 66 virtual DownloadManagerDelegate* GetDelegate() const = 0;
66 67
67 // Shutdown the download manager. Content calls this when BrowserContext is 68 // Shutdown the download manager. Content calls this when BrowserContext is
68 // being destructed. If the embedder needs this to be called earlier, it can 69 // being destructed. If the embedder needs this to be called earlier, it can
69 // call it. In that case, the delegate's Shutdown() method will only be called 70 // call it. In that case, the delegate's Shutdown() method will only be called
70 // once. 71 // once.
71 virtual void Shutdown() = 0; 72 virtual void Shutdown() = 0;
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 virtual BrowserContext* GetBrowserContext() const = 0; 163 virtual BrowserContext* GetBrowserContext() const = 0;
163 164
164 // Checks whether downloaded files still exist. Updates state of downloads 165 // Checks whether downloaded files still exist. Updates state of downloads
165 // that refer to removed files. The check runs in the background and may 166 // that refer to removed files. The check runs in the background and may
166 // finish asynchronously after this method returns. 167 // finish asynchronously after this method returns.
167 virtual void CheckForHistoryFilesRemoval() = 0; 168 virtual void CheckForHistoryFilesRemoval() = 0;
168 169
169 // Get the download item for |id| if present, no matter what type of download 170 // Get the download item for |id| if present, no matter what type of download
170 // it is or state it's in. 171 // it is or state it's in.
171 virtual DownloadItem* GetDownload(int id) = 0; 172 virtual DownloadItem* GetDownload(int id) = 0;
172
173 protected:
174 virtual ~DownloadManager() {}
175
176 private:
177 friend class base::RefCountedThreadSafe<DownloadManager>;
178 }; 173 };
179 174
180 } // namespace content 175 } // namespace content
181 176
182 #endif // CONTENT_PUBLIC_BROWSER_DOWNLOAD_MANAGER_H_ 177 #endif // CONTENT_PUBLIC_BROWSER_DOWNLOAD_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698