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

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

Issue 7112011: Change DownloadProcessHandle to be more of an encapsulated class. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Get rid of cancel code in download_util. Created 9 years, 6 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 // 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 profile in Chrome. 8 // active profile in Chrome.
9 // 9 //
10 // Download observers: 10 // Download observers:
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 // Notifications sent from the download thread to the UI thread 117 // Notifications sent from the download thread to the UI thread
118 void StartDownload(int32 id); 118 void StartDownload(int32 id);
119 void UpdateDownload(int32 download_id, int64 size); 119 void UpdateDownload(int32 download_id, int64 size);
120 // |hash| is sha256 hash for the downloaded file. It is empty when the hash 120 // |hash| is sha256 hash for the downloaded file. It is empty when the hash
121 // is not available. 121 // is not available.
122 void OnResponseCompleted(int32 download_id, int64 size, int os_error, 122 void OnResponseCompleted(int32 download_id, int64 size, int os_error,
123 const std::string& hash); 123 const std::string& hash);
124 124
125 // Called from a view when a user clicks a UI button or link. 125 // Called from a view when a user clicks a UI button or link.
126 void DownloadCancelled(int32 download_id); 126 void DownloadCancelled(int32 download_id);
127 void PauseDownload(int32 download_id, bool pause);
128 void RemoveDownload(int64 download_handle); 127 void RemoveDownload(int64 download_handle);
129 128
130 // Determine if the download is ready for completion, i.e. has had 129 // Determine if the download is ready for completion, i.e. has had
131 // all data saved, and completed the filename determination and 130 // all data saved, and completed the filename determination and
132 // history insertion. 131 // history insertion.
133 bool IsDownloadReadyForCompletion(DownloadItem* download); 132 bool IsDownloadReadyForCompletion(DownloadItem* download);
134 133
135 // If all pre-requisites have been met, complete download processing, i.e. 134 // If all pre-requisites have been met, complete download processing, i.e.
136 // do internal cleanup, file rename, and potentially auto-open. 135 // do internal cleanup, file rename, and potentially auto-open.
137 // (Dangerous downloads still may block on user acceptance after this 136 // (Dangerous downloads still may block on user acceptance after this
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 // |hash| is sha256 hash for the downloaded file. It is empty when the hash 307 // |hash| is sha256 hash for the downloaded file. It is empty when the hash
309 // is not available. 308 // is not available.
310 void OnAllDataSaved(int32 download_id, int64 size, const std::string& hash); 309 void OnAllDataSaved(int32 download_id, int64 size, const std::string& hash);
311 310
312 // An error occurred in the download. 311 // An error occurred in the download.
313 void OnDownloadError(int32 download_id, int64 size, int os_error); 312 void OnDownloadError(int32 download_id, int64 size, int os_error);
314 313
315 // Updates the app icon about the overall download progress. 314 // Updates the app icon about the overall download progress.
316 void UpdateAppIcon(); 315 void UpdateAppIcon();
317 316
318 // Makes the ResourceDispatcherHost pause/un-pause a download request.
319 // Called on the IO thread.
320 // |process_handle| is passed by value because this is called from other
321 // threads, and this way we don't have to worry about object lifetimes.
322 void PauseDownloadRequest(ResourceDispatcherHost* rdh,
323 DownloadProcessHandle process_handle,
324 bool pause);
325
326 // Inform observers that the model has changed. 317 // Inform observers that the model has changed.
327 void NotifyModelChanged(); 318 void NotifyModelChanged();
328 319
329 // Get the download item from the history map. Useful after the item has 320 // Get the download item from the history map. Useful after the item has
330 // been removed from the active map, or was retrieved from the history DB. 321 // been removed from the active map, or was retrieved from the history DB.
331 DownloadItem* GetDownloadItem(int id); 322 DownloadItem* GetDownloadItem(int id);
332 323
333 // Get the download item from the active map. Useful when the item is not 324 // Get the download item from the active map. Useful when the item is not
334 // yet in the history map. 325 // yet in the history map.
335 DownloadItem* GetActiveDownloadItem(int id); 326 DownloadItem* GetActiveDownloadItem(int id);
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 // The "Save As" dialog box used to ask the user where a file should be 402 // The "Save As" dialog box used to ask the user where a file should be
412 // saved. 403 // saved.
413 scoped_refptr<SelectFileDialog> select_file_dialog_; 404 scoped_refptr<SelectFileDialog> select_file_dialog_;
414 405
415 scoped_ptr<OtherDownloadManagerObserver> other_download_manager_observer_; 406 scoped_ptr<OtherDownloadManagerObserver> other_download_manager_observer_;
416 407
417 DISALLOW_COPY_AND_ASSIGN(DownloadManager); 408 DISALLOW_COPY_AND_ASSIGN(DownloadManager);
418 }; 409 };
419 410
420 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_H_ 411 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698