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

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

Issue 8404049: Added member data to classes to support download resumption. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merged with trunk. Created 9 years, 1 month 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 111
112 // Returns all non-temporary downloads matching |query|. Empty query matches 112 // Returns all non-temporary downloads matching |query|. Empty query matches
113 // everything. 113 // everything.
114 void SearchDownloads(const string16& query, DownloadVector* result); 114 void SearchDownloads(const string16& query, DownloadVector* result);
115 115
116 // Returns true if initialized properly. 116 // Returns true if initialized properly.
117 bool Init(content::BrowserContext* browser_context); 117 bool Init(content::BrowserContext* browser_context);
118 118
119 // Notifications sent from the download thread to the UI thread 119 // Notifications sent from the download thread to the UI thread
120 void StartDownload(int32 id); 120 void StartDownload(int32 id);
121 void UpdateDownload(int32 download_id, int64 size); 121 void UpdateDownload(int32 download_id, int64 size,
122 const std::string& partial_hash);
122 123
123 // |download_id| is the ID of the download. 124 // |download_id| is the ID of the download.
124 // |size| is the number of bytes that have been downloaded. 125 // |size| is the number of bytes that have been downloaded.
125 // |hash| is sha256 hash for the downloaded file. It is empty when the hash 126 // |hash| is sha256 hash for the downloaded file. It is empty when the hash
126 // is not available. 127 // is not available.
127 void OnResponseCompleted(int32 download_id, int64 size, 128 void OnResponseCompleted(int32 download_id, int64 size,
128 const std::string& hash); 129 const std::string& hash);
129 130
130 // Offthread target for cancelling a particular download. Will be a no-op 131 // Offthread target for cancelling a particular download. Will be a no-op
131 // if the download has already been cancelled. 132 // if the download has already been cancelled.
132 void CancelDownload(int32 download_id); 133 void CancelDownload(int32 download_id);
133 134
134 // Called when there is an error in the download. 135 // Called when there is an error in the download.
135 // |download_id| is the ID of the download. 136 // |download_id| is the ID of the download.
136 // |size| is the number of bytes that are currently downloaded. 137 // |size| is the number of bytes that are currently downloaded.
138 // |partial_hash| is the current hash of the data that has been downloaded.
137 // |reason| is a download interrupt reason code. 139 // |reason| is a download interrupt reason code.
138 void OnDownloadInterrupted(int32 download_id, int64 size, 140 void OnDownloadInterrupted(int32 download_id, int64 size,
141 const std::string partial_hash,
139 InterruptReason reason); 142 InterruptReason reason);
140 143
141 // Called from DownloadItem to handle the DownloadManager portion of a 144 // Called from DownloadItem to handle the DownloadManager portion of a
142 // Cancel; should not be called from other locations. 145 // Cancel; should not be called from other locations.
143 void DownloadCancelledInternal(DownloadItem* download); 146 void DownloadCancelledInternal(DownloadItem* download);
144 147
145 // Called from a view when a user clicks a UI button or link. 148 // Called from a view when a user clicks a UI button or link.
146 void RemoveDownload(int64 download_handle); 149 void RemoveDownload(int64 download_handle);
147 150
148 // Determine if the download is ready for completion, i.e. has had 151 // Determine if the download is ready for completion, i.e. has had
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 340
338 // Add a DownloadItem to history_downloads_. 341 // Add a DownloadItem to history_downloads_.
339 void AddDownloadItemToHistory(DownloadItem* item, int64 db_handle); 342 void AddDownloadItemToHistory(DownloadItem* item, int64 db_handle);
340 343
341 // Remove from internal maps. 344 // Remove from internal maps.
342 int RemoveDownloadItems(const DownloadVector& pending_deletes); 345 int RemoveDownloadItems(const DownloadVector& pending_deletes);
343 346
344 // Called when a download entry is committed to the persistent store. 347 // Called when a download entry is committed to the persistent store.
345 void OnDownloadItemAddedToPersistentStore(int32 download_id, int64 db_handle); 348 void OnDownloadItemAddedToPersistentStore(int32 download_id, int64 db_handle);
346 349
347 // Called when Save Page As entry is commited to the persistent store. 350 // Called when Save Page As entry is committed to the persistent store.
348 void OnSavePageItemAddedToPersistentStore(int32 download_id, int64 db_handle); 351 void OnSavePageItemAddedToPersistentStore(int32 download_id, int64 db_handle);
349 352
350 // |downloads_| is the owning set for all downloads known to the 353 // |downloads_| is the owning set for all downloads known to the
351 // DownloadManager. This includes downloads started by the user in 354 // DownloadManager. This includes downloads started by the user in
352 // this session, downloads initialized from the history system, and 355 // this session, downloads initialized from the history system, and
353 // "save page as" downloads. All other DownloadItem containers in 356 // "save page as" downloads. All other DownloadItem containers in
354 // the DownloadManager are maps; they do not own the DownloadItems. 357 // the DownloadManager are maps; they do not own the DownloadItems.
355 // Note that this is the only place (with any functional implications; 358 // Note that this is the only place (with any functional implications;
356 // see save_page_downloads_ below) that "save page as" downloads are 359 // see save_page_downloads_ below) that "save page as" downloads are
357 // kept, as the DownloadManager's only job is to hold onto those 360 // kept, as the DownloadManager's only job is to hold onto those
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
416 DownloadIdFactory* id_factory_; 419 DownloadIdFactory* id_factory_;
417 420
418 // TODO(rdsmith): Remove when http://crbug.com/85408 is fixed. 421 // TODO(rdsmith): Remove when http://crbug.com/85408 is fixed.
419 // For debugging only. 422 // For debugging only.
420 int64 largest_db_handle_in_history_; 423 int64 largest_db_handle_in_history_;
421 424
422 DISALLOW_COPY_AND_ASSIGN(DownloadManager); 425 DISALLOW_COPY_AND_ASSIGN(DownloadManager);
423 }; 426 };
424 427
425 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_H_ 428 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698