| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 // Each download is represented by a DownloadItem, and all DownloadItems | 10 // Each download is represented by a DownloadItem, and all DownloadItems |
| (...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 359 void ShowDownloadInShell(const DownloadItem* download); | 359 void ShowDownloadInShell(const DownloadItem* download); |
| 360 void OpenDownloadInShell(const DownloadItem* download, HWND parent_window); | 360 void OpenDownloadInShell(const DownloadItem* download, HWND parent_window); |
| 361 | 361 |
| 362 // The number of in progress (including paused) downloads. | 362 // The number of in progress (including paused) downloads. |
| 363 int in_progress_count() const { | 363 int in_progress_count() const { |
| 364 return static_cast<int>(in_progress_.size()); | 364 return static_cast<int>(in_progress_.size()); |
| 365 } | 365 } |
| 366 | 366 |
| 367 std::wstring download_path() { return *download_path_; } | 367 std::wstring download_path() { return *download_path_; } |
| 368 | 368 |
| 369 // Clears the last download path, used to initialize "save as" dialogs. |
| 370 void ClearLastDownloadPath(); |
| 371 |
| 369 // Registers this file extension for automatic opening upon download | 372 // Registers this file extension for automatic opening upon download |
| 370 // completion if 'open' is true, or prevents the extension from automatic | 373 // completion if 'open' is true, or prevents the extension from automatic |
| 371 // opening if 'open' is false. | 374 // opening if 'open' is false. |
| 372 void OpenFilesOfExtension(const std::wstring& extension, bool open); | 375 void OpenFilesOfExtension(const std::wstring& extension, bool open); |
| 373 | 376 |
| 374 // Tests if a file type should be opened automatically. | 377 // Tests if a file type should be opened automatically. |
| 375 bool ShouldOpenFileExtension(const std::wstring& extension); | 378 bool ShouldOpenFileExtension(const std::wstring& extension); |
| 376 | 379 |
| 377 // Tests if we think the server means for this mime_type to be executable. | 380 // Tests if we think the server means for this mime_type to be executable. |
| 378 static bool IsExecutableMimeType(const std::string& mime_type); | 381 static bool IsExecutableMimeType(const std::string& mime_type); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 394 // Deletes the specified path on the file thread. | 397 // Deletes the specified path on the file thread. |
| 395 void DeleteDownload(const std::wstring& path); | 398 void DeleteDownload(const std::wstring& path); |
| 396 | 399 |
| 397 // Called when the user has validated the donwload of a dangerous file. | 400 // Called when the user has validated the donwload of a dangerous file. |
| 398 void DangerousDownloadValidated(DownloadItem* download); | 401 void DangerousDownloadValidated(DownloadItem* download); |
| 399 | 402 |
| 400 private: | 403 private: |
| 401 // Shutdown the download manager. This call is needed only after Init. | 404 // Shutdown the download manager. This call is needed only after Init. |
| 402 void Shutdown(); | 405 void Shutdown(); |
| 403 | 406 |
| 407 // Determines whether the "save as" dialog should be displayed to the user |
| 408 // when downloading a file. |
| 409 bool ShouldDisplaySaveAsDialog(const DownloadCreateInfo* info); |
| 410 |
| 404 // Called on the download thread to check whether the suggested file path | 411 // Called on the download thread to check whether the suggested file path |
| 405 // exists. We don't check if the file exists on the UI thread to avoid UI | 412 // exists. We don't check if the file exists on the UI thread to avoid UI |
| 406 // stalls from interacting with the file system. | 413 // stalls from interacting with the file system. |
| 407 void CheckIfSuggestedPathExists(DownloadCreateInfo* info); | 414 void CheckIfSuggestedPathExists(DownloadCreateInfo* info); |
| 408 | 415 |
| 409 // Called on the UI thread once the DownloadManager has determined whether the | 416 // Called on the UI thread once the DownloadManager has determined whether the |
| 410 // suggested file path exists. | 417 // suggested file path exists. |
| 411 void OnPathExistenceAvailable(DownloadCreateInfo* info); | 418 void OnPathExistenceAvailable(DownloadCreateInfo* info); |
| 412 | 419 |
| 413 // Called back after a target path for the file to be downloaded to has been | 420 // Called back after a target path for the file to be downloaded to has been |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 551 | 558 |
| 552 // The "Save As" dialog box used to ask the user where a file should be | 559 // The "Save As" dialog box used to ask the user where a file should be |
| 553 // saved. | 560 // saved. |
| 554 scoped_refptr<SelectFileDialog> select_file_dialog_; | 561 scoped_refptr<SelectFileDialog> select_file_dialog_; |
| 555 | 562 |
| 556 DISALLOW_EVIL_CONSTRUCTORS(DownloadManager); | 563 DISALLOW_EVIL_CONSTRUCTORS(DownloadManager); |
| 557 }; | 564 }; |
| 558 | 565 |
| 559 | 566 |
| 560 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_H__ | 567 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_H__ |
| OLD | NEW |