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

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

Issue 7796014: Make cancel remove cancelled download from active queues at time of cancel. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix to try to get past main waterfall failure. Created 9 years, 3 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) 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 // Each download is represented by a DownloadItem, and all DownloadItems 5 // Each download is represented by a DownloadItem, and all DownloadItems
6 // are owned by the DownloadManager which maintains a global list of all 6 // are owned by the DownloadManager which maintains a global list of all
7 // downloads. DownloadItems are created when a user initiates a download, 7 // downloads. DownloadItems are created when a user initiates a download,
8 // and exist for the duration of the browser life time. 8 // and exist for the duration of the browser life time.
9 // 9 //
10 // Download observers: 10 // Download observers:
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 150
151 // Show the download via the OS shell. 151 // Show the download via the OS shell.
152 void ShowDownloadInShell(); 152 void ShowDownloadInShell();
153 153
154 // Called when the user has validated the download of a dangerous file. 154 // Called when the user has validated the download of a dangerous file.
155 void DangerousDownloadValidated(); 155 void DangerousDownloadValidated();
156 156
157 // Received a new chunk of data 157 // Received a new chunk of data
158 void Update(int64 bytes_so_far); 158 void Update(int64 bytes_so_far);
159 159
160 // Cancel the download operation. We need to distinguish between cancels at 160 // Cancel the download operation. This may be called at any time; if
161 // exit (DownloadManager destructor) from user interface initiated cancels 161 // it is called before all download attributes have been finalized and
162 // because at exit, the history system may not exist, and any updates to it 162 // the download entered into the history, it will remove the download from
163 // require AddRef'ing the DownloadManager in the destructor which results in 163 // the system.
164 // a DCHECK failure. Set 'update_history' to false when canceling from at 164 void Cancel();
165 // exit to prevent this crash. This may result in a difference between the
166 // downloaded file's size on disk, and what the history system's last record
167 // of it is. At worst, we'll end up re-downloading a small portion of the file
168 // when resuming a download (assuming the server supports byte ranges).
169 void Cancel(bool update_history);
170 165
171 // Called by external code (SavePackage) using the DownloadItem interface 166 // Called by external code (SavePackage) using the DownloadItem interface
172 // to display progress when the DownloadItem should be considered complete. 167 // to display progress when the DownloadItem should be considered complete.
173 void MarkAsComplete(); 168 void MarkAsComplete();
174 169
175 // Called by the delegate after it delayed completing the download in 170 // Called by the delegate after it delayed completing the download in
176 // DownloadManagerDelegate::ShouldCompleteDownload. 171 // DownloadManagerDelegate::ShouldCompleteDownload.
177 void CompleteDelayedDownload(); 172 void CompleteDelayedDownload();
178 173
179 // Called when all data has been saved. Only has display effects. 174 // Called when all data has been saved. Only has display effects.
180 void OnAllDataSaved(int64 size); 175 void OnAllDataSaved(int64 size);
181 176
182 // Called when the downloaded file is removed. 177 // Called when the downloaded file is removed.
183 void OnDownloadedFileRemoved(); 178 void OnDownloadedFileRemoved();
184 179
185 // Download operation had an error. 180 // Download operation had an error; call to interrupt the processing.
186 // |size| is the amount of data received at interruption. 181 // Note that if the download attributes haven't yet been finalized and
187 // |error| is the network error code that the operation received. 182 // the download entered into the history (which implies that it hasn't
188 void Interrupted(int64 size, net::Error error); 183 // yet been made visible in the UI), this call will remove the
184 // download from the system.
185 // |size| is the amount of data received so far, and |net_error| is the
186 // error code that the operation received.
187 void Interrupt(int64 size, net::Error net_error);
189 188
190 // Deletes the file from disk and removes the download from the views and 189 // Deletes the file from disk and removes the download from the views and
191 // history. |user| should be true if this is the result of the user clicking 190 // history. |user| should be true if this is the result of the user clicking
192 // the discard button, and false if it is being deleted for other reasons like 191 // the discard button, and false if it is being deleted for other reasons like
193 // browser shutdown. 192 // browser shutdown.
194 void Delete(DeleteReason reason); 193 void Delete(DeleteReason reason);
195 194
196 // Removes the download from the views and history. 195 // Removes the download from the views and history.
197 void Remove(); 196 void Remove();
198 197
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 void UpdateSize(int64 size); 349 void UpdateSize(int64 size);
351 350
352 // Called when the entire download operation (including renaming etc) 351 // Called when the entire download operation (including renaming etc)
353 // is completed. 352 // is completed.
354 void Completed(); 353 void Completed();
355 354
356 // Start/stop sending periodic updates to our observers 355 // Start/stop sending periodic updates to our observers
357 void StartProgressTimer(); 356 void StartProgressTimer();
358 void StopProgressTimer(); 357 void StopProgressTimer();
359 358
360 // Call to transition state; all state transitions should go through this. 359 // Does the actual work of transition state; all state
360 // transitions should go through this.
361 void TransitionTo(DownloadState new_state); 361 void TransitionTo(DownloadState new_state);
362 362
363 // Called when safety_state_ should be recomputed from is_dangerous_file 363 // Called when safety_state_ should be recomputed from is_dangerous_file
364 // and is_dangerous_url. 364 // and is_dangerous_url.
365 void UpdateSafetyState(); 365 void UpdateSafetyState();
366 366
367 // Helper function to recompute |state_info_.target_name| when 367 // Helper function to recompute |state_info_.target_name| when
368 // it may have changed. (If it's non-null it should be left alone, 368 // it may have changed. (If it's non-null it should be left alone,
369 // otherwise updated from |full_path_|.) 369 // otherwise updated from |full_path_|.)
370 void UpdateTarget(); 370 void UpdateTarget();
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
479 // only. 479 // only.
480 bool open_enabled_; 480 bool open_enabled_;
481 481
482 // Did the delegate delay calling Complete on this download? 482 // Did the delegate delay calling Complete on this download?
483 bool delegate_delayed_complete_; 483 bool delegate_delayed_complete_;
484 484
485 DISALLOW_COPY_AND_ASSIGN(DownloadItem); 485 DISALLOW_COPY_AND_ASSIGN(DownloadItem);
486 }; 486 };
487 487
488 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_H_ 488 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_H_
OLDNEW
« no previous file with comments | « chrome/test/data/download-dangerous.jar.mock-http-headers ('k') | content/browser/download/download_item.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698