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

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

Issue 10912173: Replace the DownloadFileManager with direct ownership of DownloadFileImpl (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Incorporated comments and sync'd to r158560 Created 8 years, 2 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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 virtual bool Init(BrowserContext* browser_context) = 0; 112 virtual bool Init(BrowserContext* browser_context) = 0;
113 113
114 // Called by a download source (Currently DownloadResourceHandler) 114 // Called by a download source (Currently DownloadResourceHandler)
115 // to initiate the non-source portions of a download. 115 // to initiate the non-source portions of a download.
116 // Returns the id assigned to the download. If the DownloadCreateInfo 116 // Returns the id assigned to the download. If the DownloadCreateInfo
117 // specifies an id, that id will be used. 117 // specifies an id, that id will be used.
118 virtual DownloadId StartDownload( 118 virtual DownloadId StartDownload(
119 scoped_ptr<DownloadCreateInfo> info, 119 scoped_ptr<DownloadCreateInfo> info,
120 scoped_ptr<ByteStreamReader> stream) = 0; 120 scoped_ptr<ByteStreamReader> stream) = 0;
121 121
122 // Notifications sent from the download thread to the UI thread
123 virtual void UpdateDownload(int32 download_id,
124 int64 bytes_so_far,
125 int64 bytes_per_sec,
126 const std::string& hash_state) = 0;
127
128 // |download_id| is the ID of the download.
129 // |size| is the number of bytes that have been downloaded.
130 // |hash| is sha256 hash for the downloaded file. It is empty when the hash
131 // is not available.
132 virtual void OnResponseCompleted(int32 download_id, int64 size,
133 const std::string& hash) = 0;
134
135 // Offthread target for cancelling a particular download. Will be a no-op 122 // Offthread target for cancelling a particular download. Will be a no-op
136 // if the download has already been cancelled. 123 // if the download has already been cancelled.
137 virtual void CancelDownload(int32 download_id) = 0; 124 virtual void CancelDownload(int32 download_id) = 0;
138 125
139 // Called when there is an error in the download.
140 // |download_id| is the ID of the download.
141 // |size| is the number of bytes that are currently downloaded.
142 // |hash_state| is the current state of the hash of the data that has been
143 // downloaded.
144 // |reason| is a download interrupt reason code.
145 virtual void OnDownloadInterrupted(
146 int32 download_id,
147 DownloadInterruptReason reason) = 0;
148
149 // Remove downloads after remove_begin (inclusive) and before remove_end 126 // Remove downloads after remove_begin (inclusive) and before remove_end
150 // (exclusive). You may pass in null Time values to do an unbounded delete 127 // (exclusive). You may pass in null Time values to do an unbounded delete
151 // in either direction. 128 // in either direction.
152 virtual int RemoveDownloadsBetween(base::Time remove_begin, 129 virtual int RemoveDownloadsBetween(base::Time remove_begin,
153 base::Time remove_end) = 0; 130 base::Time remove_end) = 0;
154 131
155 // Remove downloads will delete all downloads that have a timestamp that is 132 // Remove downloads will delete all downloads that have a timestamp that is
156 // the same or more recent than |remove_begin|. The number of downloads 133 // the same or more recent than |remove_begin|. The number of downloads
157 // deleted is returned back to the caller. 134 // deleted is returned back to the caller.
158 virtual int RemoveDownloads(base::Time remove_begin) = 0; 135 virtual int RemoveDownloads(base::Time remove_begin) = 0;
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 protected: 185 protected:
209 virtual ~DownloadManager() {} 186 virtual ~DownloadManager() {}
210 187
211 private: 188 private:
212 friend class base::RefCountedThreadSafe<DownloadManager>; 189 friend class base::RefCountedThreadSafe<DownloadManager>;
213 }; 190 };
214 191
215 } // namespace content 192 } // namespace content
216 193
217 #endif // CONTENT_PUBLIC_BROWSER_DOWNLOAD_MANAGER_H_ 194 #endif // CONTENT_PUBLIC_BROWSER_DOWNLOAD_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698