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

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: Sync'd to LKGR (r162700) 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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 virtual bool Init(BrowserContext* browser_context) = 0; 108 virtual bool Init(BrowserContext* browser_context) = 0;
109 109
110 // Called by a download source (Currently DownloadResourceHandler) 110 // Called by a download source (Currently DownloadResourceHandler)
111 // to initiate the non-source portions of a download. 111 // to initiate the non-source portions of a download.
112 // Returns the id assigned to the download. If the DownloadCreateInfo 112 // Returns the id assigned to the download. If the DownloadCreateInfo
113 // specifies an id, that id will be used. 113 // specifies an id, that id will be used.
114 virtual DownloadItem* StartDownload( 114 virtual DownloadItem* StartDownload(
115 scoped_ptr<DownloadCreateInfo> info, 115 scoped_ptr<DownloadCreateInfo> info,
116 scoped_ptr<ByteStreamReader> stream) = 0; 116 scoped_ptr<ByteStreamReader> stream) = 0;
117 117
118 // Notifications sent from the download thread to the UI thread
119 virtual void UpdateDownload(int32 download_id,
120 int64 bytes_so_far,
121 int64 bytes_per_sec,
122 const std::string& hash_state) = 0;
123
124 // |download_id| is the ID of the download.
125 // |size| is the number of bytes that have been downloaded.
126 // |hash| is sha256 hash for the downloaded file. It is empty when the hash
127 // is not available.
128 virtual void OnResponseCompleted(int32 download_id, int64 size,
129 const std::string& hash) = 0;
130
131 // Offthread target for cancelling a particular download. Will be a no-op 118 // Offthread target for cancelling a particular download. Will be a no-op
132 // if the download has already been cancelled. 119 // if the download has already been cancelled.
133 virtual void CancelDownload(int32 download_id) = 0; 120 virtual void CancelDownload(int32 download_id) = 0;
134 121
135 // Called when there is an error in the download.
136 // |download_id| is the ID of the download.
137 // |size| is the number of bytes that are currently downloaded.
138 // |hash_state| is the current state of the hash of the data that has been
139 // downloaded.
140 // |reason| is a download interrupt reason code.
141 virtual void OnDownloadInterrupted(
142 int32 download_id,
143 DownloadInterruptReason reason) = 0;
144
145 // Remove downloads after remove_begin (inclusive) and before remove_end 122 // Remove downloads after remove_begin (inclusive) and before remove_end
146 // (exclusive). You may pass in null Time values to do an unbounded delete 123 // (exclusive). You may pass in null Time values to do an unbounded delete
147 // in either direction. 124 // in either direction.
148 virtual int RemoveDownloadsBetween(base::Time remove_begin, 125 virtual int RemoveDownloadsBetween(base::Time remove_begin,
149 base::Time remove_end) = 0; 126 base::Time remove_end) = 0;
150 127
151 // Remove downloads will delete all downloads that have a timestamp that is 128 // Remove downloads will delete all downloads that have a timestamp that is
152 // the same or more recent than |remove_begin|. The number of downloads 129 // the same or more recent than |remove_begin|. The number of downloads
153 // deleted is returned back to the caller. 130 // deleted is returned back to the caller.
154 virtual int RemoveDownloads(base::Time remove_begin) = 0; 131 virtual int RemoveDownloads(base::Time remove_begin) = 0;
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 protected: 173 protected:
197 virtual ~DownloadManager() {} 174 virtual ~DownloadManager() {}
198 175
199 private: 176 private:
200 friend class base::RefCountedThreadSafe<DownloadManager>; 177 friend class base::RefCountedThreadSafe<DownloadManager>;
201 }; 178 };
202 179
203 } // namespace content 180 } // namespace content
204 181
205 #endif // CONTENT_PUBLIC_BROWSER_DOWNLOAD_MANAGER_H_ 182 #endif // CONTENT_PUBLIC_BROWSER_DOWNLOAD_MANAGER_H_
OLDNEW
« no previous file with comments | « content/public/browser/download_destination_observer.h ('k') | content/public/test/mock_download_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698