| 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 saving files, on the file thread. | 5 // Objects that handle file operations for saving files, on the file thread. |
| 6 // | 6 // |
| 7 // The SaveFileManager owns a set of SaveFile objects, each of which connects | 7 // The SaveFileManager owns a set of SaveFile objects, each of which connects |
| 8 // with a SaveItem object which belongs to one SavePackage and runs on the file | 8 // with a SaveItem object which belongs to one SavePackage and runs on the file |
| 9 // thread for saving data in order to avoid disk activity on either network IO | 9 // thread for saving data in order to avoid disk activity on either network IO |
| 10 // thread or the UI thread. It coordinates the notifications from the network | 10 // thread or the UI thread. It coordinates the notifications from the network |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 | 108 |
| 109 // Notifications sent from the UI thread and run on the file thread. | 109 // Notifications sent from the UI thread and run on the file thread. |
| 110 // Cancel a SaveFile instance which has specified save id. | 110 // Cancel a SaveFile instance which has specified save id. |
| 111 void CancelSave(int save_id); | 111 void CancelSave(int save_id); |
| 112 | 112 |
| 113 // Called on the UI thread to remove a save package from SaveFileManager's | 113 // Called on the UI thread to remove a save package from SaveFileManager's |
| 114 // tracking map. | 114 // tracking map. |
| 115 void RemoveSaveFile(int save_id, const GURL& save_url, | 115 void RemoveSaveFile(int save_id, const GURL& save_url, |
| 116 SavePackage* package); | 116 SavePackage* package); |
| 117 | 117 |
| 118 // Handler for shell operations sent from the UI to the file thread. | 118 #if !defined(OS_MACOSX) |
| 119 // Handler for shell operations sent from the UI to the file thread. Mac OS X |
| 120 // requires opening downloads on the UI thread, so it does not use this |
| 121 // method. |
| 119 void OnShowSavedFileInShell(const FilePath full_path); | 122 void OnShowSavedFileInShell(const FilePath full_path); |
| 123 #endif |
| 120 | 124 |
| 121 // Helper function for deleting specified file. | 125 // Helper function for deleting specified file. |
| 122 void DeleteDirectoryOrFile(const FilePath& full_path, bool is_dir); | 126 void DeleteDirectoryOrFile(const FilePath& full_path, bool is_dir); |
| 123 | 127 |
| 124 // For posting notifications from the UI and IO threads. | 128 // For posting notifications from the UI and file threads. |
| 125 MessageLoop* GetSaveLoop() const { return file_loop_; } | 129 MessageLoop* ui_loop() const { return ui_loop_; } |
| 130 MessageLoop* file_loop() const { return file_loop_; } |
| 126 | 131 |
| 127 // Runs on file thread to save a file by copying from file system when | 132 // Runs on file thread to save a file by copying from file system when |
| 128 // original url is using file scheme. | 133 // original url is using file scheme. |
| 129 void SaveLocalFile(const GURL& original_file_url, | 134 void SaveLocalFile(const GURL& original_file_url, |
| 130 int save_id, | 135 int save_id, |
| 131 int render_process_id); | 136 int render_process_id); |
| 132 | 137 |
| 133 // Renames all the successfully saved files. | 138 // Renames all the successfully saved files. |
| 134 // |final_names| points to a vector which contains pairs of save ids and | 139 // |final_names| points to a vector which contains pairs of save ids and |
| 135 // final names of successfully saved files. | 140 // final names of successfully saved files. |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 254 // hashmap since it is possible to save same URL in different tab at | 259 // hashmap since it is possible to save same URL in different tab at |
| 255 // same time. | 260 // same time. |
| 256 typedef base::hash_map<std::string, SavePackage*> StartingRequestsMap; | 261 typedef base::hash_map<std::string, SavePackage*> StartingRequestsMap; |
| 257 typedef base::hash_map<int, StartingRequestsMap> TabToStartingRequestsMap; | 262 typedef base::hash_map<int, StartingRequestsMap> TabToStartingRequestsMap; |
| 258 TabToStartingRequestsMap tab_starting_requests_; | 263 TabToStartingRequestsMap tab_starting_requests_; |
| 259 | 264 |
| 260 DISALLOW_EVIL_CONSTRUCTORS(SaveFileManager); | 265 DISALLOW_EVIL_CONSTRUCTORS(SaveFileManager); |
| 261 }; | 266 }; |
| 262 | 267 |
| 263 #endif // CHROME_BROWSER_DOWNLOAD_SAVE_FILE_MANAGER_H__ | 268 #endif // CHROME_BROWSER_DOWNLOAD_SAVE_FILE_MANAGER_H__ |
| OLD | NEW |