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

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: Merged to LKGR. 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
« no previous file with comments | « chrome/browser/download/download_item.cc ('k') | chrome/browser/download/download_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 24 matching lines...) Expand all
35 35
36 #include "base/basictypes.h" 36 #include "base/basictypes.h"
37 #include "base/file_path.h" 37 #include "base/file_path.h"
38 #include "base/gtest_prod_util.h" 38 #include "base/gtest_prod_util.h"
39 #include "base/memory/ref_counted.h" 39 #include "base/memory/ref_counted.h"
40 #include "base/memory/weak_ptr.h" 40 #include "base/memory/weak_ptr.h"
41 #include "base/observer_list.h" 41 #include "base/observer_list.h"
42 #include "base/scoped_ptr.h" 42 #include "base/scoped_ptr.h"
43 #include "base/time.h" 43 #include "base/time.h"
44 #include "chrome/browser/download/download_item.h" 44 #include "chrome/browser/download/download_item.h"
45 #include "chrome/browser/download/download_request_handle.h"
45 #include "chrome/browser/download/download_status_updater_delegate.h" 46 #include "chrome/browser/download/download_status_updater_delegate.h"
46 #include "chrome/browser/download/download_process_handle.h"
47 #include "chrome/browser/ui/shell_dialogs.h" 47 #include "chrome/browser/ui/shell_dialogs.h"
48 #include "content/browser/browser_thread.h" 48 #include "content/browser/browser_thread.h"
49 49
50 class DownloadFileManager; 50 class DownloadFileManager;
51 class DownloadHistory; 51 class DownloadHistory;
52 class DownloadPrefs; 52 class DownloadPrefs;
53 class DownloadStatusUpdater; 53 class DownloadStatusUpdater;
54 class GURL; 54 class GURL;
55 class Profile; 55 class Profile;
56 class ResourceDispatcherHost; 56 class ResourceDispatcherHost;
(...skipping 60 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 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 void OnPathExistenceAvailable(int32 download_id, 291 void OnPathExistenceAvailable(int32 download_id,
293 DownloadStateInfo new_state); 292 DownloadStateInfo new_state);
294 293
295 // Called back after a target path for the file to be downloaded to has been 294 // Called back after a target path for the file to be downloaded to has been
296 // determined, either automatically based on the suggested file name, or by 295 // determined, either automatically based on the suggested file name, or by
297 // the user in a Save As dialog box. 296 // the user in a Save As dialog box.
298 void ContinueDownloadWithPath(DownloadItem* download, 297 void ContinueDownloadWithPath(DownloadItem* download,
299 const FilePath& chosen_file); 298 const FilePath& chosen_file);
300 299
301 // Download cancel helper function. 300 // Download cancel helper function.
302 // |process_handle| is passed by value because it is ultimately passed to 301 // |request_handle| is passed by value because it is ultimately passed to
303 // other threads, and this way we don't have to worry about object lifetimes. 302 // other threads, and this way we don't have to worry about object lifetimes.
304 void DownloadCancelledInternal(int download_id, 303 void DownloadCancelledInternal(int download_id,
305 DownloadProcessHandle process_handle); 304 DownloadRequestHandle request_handle);
306 305
307 // All data has been downloaded. 306 // All data has been downloaded.
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
« no previous file with comments | « chrome/browser/download/download_item.cc ('k') | chrome/browser/download/download_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698