| 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 // Objects that handle file operations for downloads, on the download thread. | 5 // Objects that handle file operations for downloads, on the download thread. |
| 6 // | 6 // |
| 7 // The DownloadFileManager owns a set of DownloadFile objects, each of which | 7 // The DownloadFileManager owns a set of DownloadFile objects, each of which |
| 8 // represent one in progress download and performs the disk IO for that | 8 // represent one in progress download and performs the disk IO for that |
| 9 // download. The DownloadFileManager itself is a singleton object owned by the | 9 // download. The DownloadFileManager itself is a singleton object owned by the |
| 10 // ResourceDispatcherHost. | 10 // ResourceDispatcherHost. |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 // appropriate DownloadManager. In progress downloads are cancelled for a | 38 // appropriate DownloadManager. In progress downloads are cancelled for a |
| 39 // DownloadManager that exits (such as when closing a profile). | 39 // DownloadManager that exits (such as when closing a profile). |
| 40 | 40 |
| 41 #ifndef CHROME_BROWSER_DOWNLOAD_DOWNLOAD_FILE_H__ | 41 #ifndef CHROME_BROWSER_DOWNLOAD_DOWNLOAD_FILE_H__ |
| 42 #define CHROME_BROWSER_DOWNLOAD_DOWNLOAD_FILE_H__ | 42 #define CHROME_BROWSER_DOWNLOAD_DOWNLOAD_FILE_H__ |
| 43 | 43 |
| 44 #include <string> | 44 #include <string> |
| 45 #include <vector> | 45 #include <vector> |
| 46 | 46 |
| 47 #include "base/basictypes.h" | 47 #include "base/basictypes.h" |
| 48 #include "base/gfx/native_widget_types.h" |
| 48 #include "base/hash_tables.h" | 49 #include "base/hash_tables.h" |
| 49 #include "base/lock.h" | 50 #include "base/lock.h" |
| 50 #include "base/ref_counted.h" | 51 #include "base/ref_counted.h" |
| 51 #include "base/thread.h" | 52 #include "base/thread.h" |
| 52 #include "base/timer.h" | 53 #include "base/timer.h" |
| 53 #include "chrome/browser/history/download_types.h" | 54 #include "chrome/browser/history/download_types.h" |
| 54 | 55 |
| 55 class DownloadManager; | 56 class DownloadManager; |
| 56 class FilePath; | 57 class FilePath; |
| 57 class GURL; | 58 class GURL; |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 URLRequestContext* request_context); | 190 URLRequestContext* request_context); |
| 190 | 191 |
| 191 // Called on the UI thread to remove a download item or manager. | 192 // Called on the UI thread to remove a download item or manager. |
| 192 void RemoveDownloadManager(DownloadManager* manager); | 193 void RemoveDownloadManager(DownloadManager* manager); |
| 193 void RemoveDownload(int id, DownloadManager* manager); | 194 void RemoveDownload(int id, DownloadManager* manager); |
| 194 | 195 |
| 195 // Handler for shell operations sent from the UI to the download thread. | 196 // Handler for shell operations sent from the UI to the download thread. |
| 196 void OnShowDownloadInShell(const FilePath& full_path); | 197 void OnShowDownloadInShell(const FilePath& full_path); |
| 197 // Handler to open or execute a downloaded file. | 198 // Handler to open or execute a downloaded file. |
| 198 void OnOpenDownloadInShell(const FilePath& full_path, | 199 void OnOpenDownloadInShell(const FilePath& full_path, |
| 199 const std::wstring& url, HWND parent_window); | 200 const std::wstring& url, |
| 201 gfx::NativeView parent_window); |
| 200 | 202 |
| 201 // The download manager has provided a final name for a download. Sent from | 203 // The download manager has provided a final name for a download. Sent from |
| 202 // the UI thread and run on the download thread. | 204 // the UI thread and run on the download thread. |
| 203 void OnFinalDownloadName(int id, const FilePath& full_path); | 205 void OnFinalDownloadName(int id, const FilePath& full_path); |
| 204 | 206 |
| 205 // Timer notifications. | 207 // Timer notifications. |
| 206 void UpdateInProgressDownloads(); | 208 void UpdateInProgressDownloads(); |
| 207 | 209 |
| 208 MessageLoop* file_loop() const { return file_loop_; } | 210 MessageLoop* file_loop() const { return file_loop_; } |
| 209 | 211 |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 // Used for progress updates on the UI thread, mapping download->id() to bytes | 266 // Used for progress updates on the UI thread, mapping download->id() to bytes |
| 265 // received so far. Written to by the file thread and read by the UI thread. | 267 // received so far. Written to by the file thread and read by the UI thread. |
| 266 typedef base::hash_map<int, int64> ProgressMap; | 268 typedef base::hash_map<int, int64> ProgressMap; |
| 267 ProgressMap ui_progress_; | 269 ProgressMap ui_progress_; |
| 268 Lock progress_lock_; | 270 Lock progress_lock_; |
| 269 | 271 |
| 270 DISALLOW_EVIL_CONSTRUCTORS(DownloadFileManager); | 272 DISALLOW_EVIL_CONSTRUCTORS(DownloadFileManager); |
| 271 }; | 273 }; |
| 272 | 274 |
| 273 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_FILE_H__ | 275 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_FILE_H__ |
| OLD | NEW |