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

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

Issue 6905049: Detect removed files and reflect the state in chrome://downloads and the download shelf (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Reflect the "Removed" status to the download shelf 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 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 // Various factors are considered, such as the type of the file, whether a 229 // Various factors are considered, such as the type of the file, whether a
230 // user action initiated the download, and whether the user has explicitly 230 // user action initiated the download, and whether the user has explicitly
231 // marked the file type as "auto open". 231 // marked the file type as "auto open".
232 bool IsDangerous(const DownloadItem& download, 232 bool IsDangerous(const DownloadItem& download,
233 const DownloadStateInfo& state, 233 const DownloadStateInfo& state,
234 bool visited_referrer_before); 234 bool visited_referrer_before);
235 235
236 // Called when the user has validated the download of a dangerous file. 236 // Called when the user has validated the download of a dangerous file.
237 void DangerousDownloadValidated(DownloadItem* download); 237 void DangerousDownloadValidated(DownloadItem* download);
238 238
239 // Checks whether downloaded files still exist. Updates state of downloads
240 // that refer to removed files. The check runs in the background and may
241 // finish asynchronously after this method returns.
242 void CheckForHistoryFilesRemoval();
243
244 // Checks whether a downloaded file still exists and updates the file's state
245 // if the file is already removed. The check runs in the background and may
246 // finish asynchronously after this method returns.
247 void CheckForFileRemoval(DownloadItem* download_item);
248
239 // Callback function after url is checked with safebrowsing service. 249 // Callback function after url is checked with safebrowsing service.
240 void CheckDownloadUrlDone(int32 download_id, bool is_dangerous_url); 250 void CheckDownloadUrlDone(int32 download_id, bool is_dangerous_url);
241 251
242 // Callback function after we check whether the referrer URL has been visited 252 // Callback function after we check whether the referrer URL has been visited
243 // before today. 253 // before today.
244 void CheckVisitedReferrerBeforeDone(int32 download_id, 254 void CheckVisitedReferrerBeforeDone(int32 download_id,
245 bool visited_referrer_before); 255 bool visited_referrer_before);
246 256
247 // Callback function after download file hash is checked with safebrowsing 257 // Callback function after download file hash is checked with safebrowsing
248 // service. 258 // service.
(...skipping 24 matching lines...) Expand all
273 // The original profile's download manager. 283 // The original profile's download manager.
274 DownloadManager* observed_download_manager_; 284 DownloadManager* observed_download_manager_;
275 }; 285 };
276 286
277 friend struct BrowserThread::DeleteOnThread<BrowserThread::UI>; 287 friend struct BrowserThread::DeleteOnThread<BrowserThread::UI>;
278 friend class DeleteTask<DownloadManager>; 288 friend class DeleteTask<DownloadManager>;
279 friend class OtherDownloadManagerObserver; 289 friend class OtherDownloadManagerObserver;
280 290
281 virtual ~DownloadManager(); 291 virtual ~DownloadManager();
282 292
293 // Called on the FILE thread to check the existence of a downloaded file.
294 void CheckForFileRemovalOnFileThread(int64 db_handle, const FilePath& path);
295
296 // Called on the UI thread if the FILE thread detects the removal of
297 // the downloaded file. The UI thread updates the state of the file
298 // and then notifies this update to the file's observer.
299 void OnFileRemovalDetected(int64 db_handle);
300
283 // Called on the download thread to check whether the suggested file path 301 // Called on the download thread to check whether the suggested file path
284 // exists. We don't check if the file exists on the UI thread to avoid UI 302 // exists. We don't check if the file exists on the UI thread to avoid UI
285 // stalls from interacting with the file system. 303 // stalls from interacting with the file system.
286 void CheckIfSuggestedPathExists(int32 download_id, 304 void CheckIfSuggestedPathExists(int32 download_id,
287 DownloadStateInfo state, 305 DownloadStateInfo state,
288 const FilePath& default_path); 306 const FilePath& default_path);
289 307
290 // Called on the UI thread once the DownloadManager has determined whether the 308 // Called on the UI thread once the DownloadManager has determined whether the
291 // suggested file path exists. 309 // suggested file path exists.
292 void OnPathExistenceAvailable(int32 download_id, 310 void OnPathExistenceAvailable(int32 download_id,
(...skipping 118 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 429 // The "Save As" dialog box used to ask the user where a file should be
412 // saved. 430 // saved.
413 scoped_refptr<SelectFileDialog> select_file_dialog_; 431 scoped_refptr<SelectFileDialog> select_file_dialog_;
414 432
415 scoped_ptr<OtherDownloadManagerObserver> other_download_manager_observer_; 433 scoped_ptr<OtherDownloadManagerObserver> other_download_manager_observer_;
416 434
417 DISALLOW_COPY_AND_ASSIGN(DownloadManager); 435 DISALLOW_COPY_AND_ASSIGN(DownloadManager);
418 }; 436 };
419 437
420 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_H_ 438 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698