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

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

Issue 6096003: Put history insertion for downloads processing inline. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Incorporated Pawel's comments. Created 9 years, 11 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 // Notifications sent from the download thread to the UI thread 118 // Notifications sent from the download thread to the UI thread
119 void StartDownload(DownloadCreateInfo* info); 119 void StartDownload(DownloadCreateInfo* info);
120 void UpdateDownload(int32 download_id, int64 size); 120 void UpdateDownload(int32 download_id, int64 size);
121 void OnAllDataSaved(int32 download_id, int64 size); 121 void OnAllDataSaved(int32 download_id, int64 size);
122 122
123 // Called from a view when a user clicks a UI button or link. 123 // Called from a view when a user clicks a UI button or link.
124 void DownloadCancelled(int32 download_id); 124 void DownloadCancelled(int32 download_id);
125 void PauseDownload(int32 download_id, bool pause); 125 void PauseDownload(int32 download_id, bool pause);
126 void RemoveDownload(int64 download_handle); 126 void RemoveDownload(int64 download_handle);
127 127
128 // Determine if the download is ready for completion, i.e. has had
129 // all data received, and completed the filename determination and
130 // history insertion.
131 bool IsDownloadReadyForCompletion(DownloadItem* download);
132
133 // If all pre-requisites have been met, complete download processing, i.e.
134 // do internal cleanup, file rename, and potentially auto-open.
135 // (Dangerous downloads still may block on user acceptance after this
136 // point.)
137 void MaybeCompleteDownload(DownloadItem* download);
138
128 // Called when the download is renamed to its final name. 139 // Called when the download is renamed to its final name.
129 void DownloadRenamedToFinalName(int download_id, const FilePath& full_path); 140 void DownloadRenamedToFinalName(int download_id, const FilePath& full_path);
130 141
131 // Remove downloads after remove_begin (inclusive) and before remove_end 142 // Remove downloads after remove_begin (inclusive) and before remove_end
132 // (exclusive). You may pass in null Time values to do an unbounded delete 143 // (exclusive). You may pass in null Time values to do an unbounded delete
133 // in either direction. 144 // in either direction.
134 int RemoveDownloadsBetween(const base::Time remove_begin, 145 int RemoveDownloadsBetween(const base::Time remove_begin,
135 const base::Time remove_end); 146 const base::Time remove_end);
136 147
137 // Remove downloads will delete all downloads that have a timestamp that is 148 // Remove downloads will delete all downloads that have a timestamp that is
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 // Non-owning pointer for handling file writing on the download_thread_. 373 // Non-owning pointer for handling file writing on the download_thread_.
363 DownloadFileManager* file_manager_; 374 DownloadFileManager* file_manager_;
364 375
365 // Non-owning pointer for updating the download status. 376 // Non-owning pointer for updating the download status.
366 base::WeakPtr<DownloadStatusUpdater> status_updater_; 377 base::WeakPtr<DownloadStatusUpdater> status_updater_;
367 378
368 // The user's last choice for download directory. This is only used when the 379 // The user's last choice for download directory. This is only used when the
369 // user wants us to prompt for a save location for each download. 380 // user wants us to prompt for a save location for each download.
370 FilePath last_download_path_; 381 FilePath last_download_path_;
371 382
372 // Keep track of downloads that are completed before the user selects the
373 // destination, so that observers are appropriately notified of completion
374 // after this determination is made.
375 // The map is of download_id->remaining size (bytes), both of which are
376 // required when calling OnAllDataSaved.
377 typedef std::map<int32, int64> PendingFinishedMap;
378 PendingFinishedMap pending_finished_downloads_;
379
380 // The "Save As" dialog box used to ask the user where a file should be 383 // The "Save As" dialog box used to ask the user where a file should be
381 // saved. 384 // saved.
382 scoped_refptr<SelectFileDialog> select_file_dialog_; 385 scoped_refptr<SelectFileDialog> select_file_dialog_;
383 386
384 scoped_ptr<OtherDownloadManagerObserver> other_download_manager_observer_; 387 scoped_ptr<OtherDownloadManagerObserver> other_download_manager_observer_;
385 388
386 DISALLOW_COPY_AND_ASSIGN(DownloadManager); 389 DISALLOW_COPY_AND_ASSIGN(DownloadManager);
387 }; 390 };
388 391
389 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_H_ 392 #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