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

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: Correct typo Created 9 years, 7 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 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 virtual int64 GetReceivedDownloadBytes(); 224 virtual int64 GetReceivedDownloadBytes();
225 virtual int64 GetTotalDownloadBytes(); 225 virtual int64 GetTotalDownloadBytes();
226 226
227 // Overridden from SelectFileDialog::Listener: 227 // Overridden from SelectFileDialog::Listener:
228 virtual void FileSelected(const FilePath& path, int index, void* params); 228 virtual void FileSelected(const FilePath& path, int index, void* params);
229 virtual void FileSelectionCanceled(void* params); 229 virtual void FileSelectionCanceled(void* params);
230 230
231 // Called when the user has validated the download of a dangerous file. 231 // Called when the user has validated the download of a dangerous file.
232 void DangerousDownloadValidated(DownloadItem* download); 232 void DangerousDownloadValidated(DownloadItem* download);
233 233
234 // Checks whether downloaded files still exist. Updates state of downloads
235 // that refer to removed files. The check runs in the background and may
236 // finish asynchronously after this method returns.
237 void CheckForHistoryFilesRemoval();
238
239 // Checks whether a downloaded file still exists and updates the file's state
240 // if the file is already removed. The check runs in the background and may
241 // finish asynchronously after this method returns.
242 void CheckForFileRemoval(DownloadItem* download_item);
243
234 // Callback function after url is checked with safebrowsing service. 244 // Callback function after url is checked with safebrowsing service.
235 void CheckDownloadUrlDone(DownloadCreateInfo* info, bool is_dangerous_url); 245 void CheckDownloadUrlDone(DownloadCreateInfo* info, bool is_dangerous_url);
236 246
237 // Callback function after download file hash is checked with safebrowsing 247 // Callback function after download file hash is checked with safebrowsing
238 // service. 248 // service.
239 void CheckDownloadHashDone(int32 download_id, bool is_dangerous_hash); 249 void CheckDownloadHashDone(int32 download_id, bool is_dangerous_hash);
240 250
241 private: 251 private:
242 // For testing. 252 // For testing.
243 friend class DownloadManagerTest; 253 friend class DownloadManagerTest;
(...skipping 19 matching lines...) Expand all
263 // The original profile's download manager. 273 // The original profile's download manager.
264 DownloadManager* observed_download_manager_; 274 DownloadManager* observed_download_manager_;
265 }; 275 };
266 276
267 friend struct BrowserThread::DeleteOnThread<BrowserThread::UI>; 277 friend struct BrowserThread::DeleteOnThread<BrowserThread::UI>;
268 friend class DeleteTask<DownloadManager>; 278 friend class DeleteTask<DownloadManager>;
269 friend class OtherDownloadManagerObserver; 279 friend class OtherDownloadManagerObserver;
270 280
271 ~DownloadManager(); 281 ~DownloadManager();
272 282
283 // Called on the FILE thread to check the existence of a downloaded file.
284 void CheckForFileRemovalOnFileThread(int64 db_handle, const FilePath& path);
285
286 // Called on the UI thread if the FILE thread detects the removal of
287 // the downloaded file. The UI thread updates the state of the file
288 // and then notifies this update to the file's observer.
289 void OnFileRemovalDetected(int64 db_handle);
290
273 // Called on the download thread to check whether the suggested file path 291 // Called on the download thread to check whether the suggested file path
274 // exists. We don't check if the file exists on the UI thread to avoid UI 292 // exists. We don't check if the file exists on the UI thread to avoid UI
275 // stalls from interacting with the file system. 293 // stalls from interacting with the file system.
276 void CheckIfSuggestedPathExists(DownloadCreateInfo* info, 294 void CheckIfSuggestedPathExists(DownloadCreateInfo* info,
277 const FilePath& default_path); 295 const FilePath& default_path);
278 296
279 // Called on the UI thread once the DownloadManager has determined whether the 297 // Called on the UI thread once the DownloadManager has determined whether the
280 // suggested file path exists. 298 // suggested file path exists.
281 void OnPathExistenceAvailable(DownloadCreateInfo* info); 299 void OnPathExistenceAvailable(DownloadCreateInfo* info);
282 300
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 // The "Save As" dialog box used to ask the user where a file should be 410 // The "Save As" dialog box used to ask the user where a file should be
393 // saved. 411 // saved.
394 scoped_refptr<SelectFileDialog> select_file_dialog_; 412 scoped_refptr<SelectFileDialog> select_file_dialog_;
395 413
396 scoped_ptr<OtherDownloadManagerObserver> other_download_manager_observer_; 414 scoped_ptr<OtherDownloadManagerObserver> other_download_manager_observer_;
397 415
398 DISALLOW_COPY_AND_ASSIGN(DownloadManager); 416 DISALLOW_COPY_AND_ASSIGN(DownloadManager);
399 }; 417 };
400 418
401 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_H_ 419 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698