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

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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 // download_manager->GetNextIdThunk(); 127 // download_manager->GetNextIdThunk();
128 // id = next_id_thunk.Run(); 128 // id = next_id_thunk.Run();
129 typedef base::Callback<DownloadId(void)> GetNextIdThunkType; 129 typedef base::Callback<DownloadId(void)> GetNextIdThunkType;
130 GetNextIdThunkType GetNextIdThunk(); 130 GetNextIdThunkType GetNextIdThunk();
131 131
132 // Returns true if initialized properly. 132 // Returns true if initialized properly.
133 bool Init(content::BrowserContext* browser_context); 133 bool Init(content::BrowserContext* browser_context);
134 134
135 // Notifications sent from the download thread to the UI thread 135 // Notifications sent from the download thread to the UI thread
136 void StartDownload(int32 id); 136 void StartDownload(int32 id);
137 void UpdateDownload(int32 download_id, int64 size); 137 void UpdateDownload(int32 download_id, int64 size,
138 const std::string& partial_hash);
138 139
139 // |download_id| is the ID of the download. 140 // |download_id| is the ID of the download.
140 // |size| is the number of bytes that have been downloaded. 141 // |size| is the number of bytes that have been downloaded.
141 // |hash| is sha256 hash for the downloaded file. It is empty when the hash 142 // |hash| is sha256 hash for the downloaded file. It is empty when the hash
142 // is not available. 143 // is not available.
143 void OnResponseCompleted(int32 download_id, int64 size, 144 void OnResponseCompleted(int32 download_id, int64 size,
144 const std::string& hash); 145 const std::string& hash);
145 146
146 // Offthread target for cancelling a particular download. Will be a no-op 147 // Offthread target for cancelling a particular download. Will be a no-op
147 // if the download has already been cancelled. 148 // if the download has already been cancelled.
148 void CancelDownload(int32 download_id); 149 void CancelDownload(int32 download_id);
149 150
150 // Called when there is an error in the download. 151 // Called when there is an error in the download.
151 // |download_id| is the ID of the download. 152 // |download_id| is the ID of the download.
152 // |size| is the number of bytes that are currently downloaded. 153 // |size| is the number of bytes that are currently downloaded.
154 // |partial_hash| is the current hash of the data that has been downloaded.
153 // |reason| is a download interrupt reason code. 155 // |reason| is a download interrupt reason code.
154 void OnDownloadInterrupted(int32 download_id, int64 size, 156 void OnDownloadInterrupted(int32 download_id, int64 size,
157 const std::string partial_hash,
155 InterruptReason reason); 158 InterruptReason reason);
156 159
157 // Called from DownloadItem to handle the DownloadManager portion of a 160 // Called from DownloadItem to handle the DownloadManager portion of a
158 // Cancel; should not be called from other locations. 161 // Cancel; should not be called from other locations.
159 void DownloadCancelledInternal(DownloadItem* download); 162 void DownloadCancelledInternal(DownloadItem* download);
160 163
161 // Called from a view when a user clicks a UI button or link. 164 // Called from a view when a user clicks a UI button or link.
162 void RemoveDownload(int64 download_handle); 165 void RemoveDownload(int64 download_handle);
163 166
164 // Determine if the download is ready for completion, i.e. has had 167 // Determine if the download is ready for completion, i.e. has had
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 358
356 // Add a DownloadItem to history_downloads_. 359 // Add a DownloadItem to history_downloads_.
357 void AddDownloadItemToHistory(DownloadItem* item, int64 db_handle); 360 void AddDownloadItemToHistory(DownloadItem* item, int64 db_handle);
358 361
359 // Remove from internal maps. 362 // Remove from internal maps.
360 int RemoveDownloadItems(const DownloadVector& pending_deletes); 363 int RemoveDownloadItems(const DownloadVector& pending_deletes);
361 364
362 // Called when a download entry is committed to the persistent store. 365 // Called when a download entry is committed to the persistent store.
363 void OnDownloadItemAddedToPersistentStore(int32 download_id, int64 db_handle); 366 void OnDownloadItemAddedToPersistentStore(int32 download_id, int64 db_handle);
364 367
365 // Called when Save Page As entry is commited to the persistent store. 368 // Called when Save Page As entry is committed to the persistent store.
366 void OnSavePageItemAddedToPersistentStore(int32 download_id, int64 db_handle); 369 void OnSavePageItemAddedToPersistentStore(int32 download_id, int64 db_handle);
367 370
368 // |downloads_| is the owning set for all downloads known to the 371 // |downloads_| is the owning set for all downloads known to the
369 // DownloadManager. This includes downloads started by the user in 372 // DownloadManager. This includes downloads started by the user in
370 // this session, downloads initialized from the history system, and 373 // this session, downloads initialized from the history system, and
371 // "save page as" downloads. All other DownloadItem containers in 374 // "save page as" downloads. All other DownloadItem containers in
372 // the DownloadManager are maps; they do not own the DownloadItems. 375 // the DownloadManager are maps; they do not own the DownloadItems.
373 // Note that this is the only place (with any functional implications; 376 // Note that this is the only place (with any functional implications;
374 // see save_page_downloads_ below) that "save page as" downloads are 377 // see save_page_downloads_ below) that "save page as" downloads are
375 // kept, as the DownloadManager's only job is to hold onto those 378 // kept, as the DownloadManager's only job is to hold onto those
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
435 content::DownloadManagerDelegate* delegate_; 438 content::DownloadManagerDelegate* delegate_;
436 439
437 // TODO(rdsmith): Remove when http://crbug.com/85408 is fixed. 440 // TODO(rdsmith): Remove when http://crbug.com/85408 is fixed.
438 // For debugging only. 441 // For debugging only.
439 int64 largest_db_handle_in_history_; 442 int64 largest_db_handle_in_history_;
440 443
441 DISALLOW_COPY_AND_ASSIGN(DownloadManager); 444 DISALLOW_COPY_AND_ASSIGN(DownloadManager);
442 }; 445 };
443 446
444 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_H_ 447 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698