| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 // Look up one in-progress saving item according to save item id. | 154 // Look up one in-progress saving item according to save item id. |
| 155 SaveFile* LookupSaveFile(int save_item_id); | 155 SaveFile* LookupSaveFile(int save_item_id); |
| 156 | 156 |
| 157 // Help function for sending notification of canceling specific request. | 157 // Help function for sending notification of canceling specific request. |
| 158 void SendCancelRequest(int save_item_id); | 158 void SendCancelRequest(int save_item_id); |
| 159 | 159 |
| 160 // Notifications sent from the file thread and run on the UI thread. | 160 // Notifications sent from the file thread and run on the UI thread. |
| 161 | 161 |
| 162 // Lookup the SaveManager for this WebContents' saving browser context and | 162 // Lookup the SaveManager for this WebContents' saving browser context and |
| 163 // inform it the saving job has been started. | 163 // inform it the saving job has been started. |
| 164 void OnStartSave(const SaveFileCreateInfo* info); | 164 void OnStartSave(const SaveFileCreateInfo info); |
| 165 // Update the SavePackage with the current state of a started saving job. | 165 // Update the SavePackage with the current state of a started saving job. |
| 166 // If the SavePackage for this saving job is gone, cancel the request. | 166 // If the SavePackage for this saving job is gone, cancel the request. |
| 167 void OnUpdateSaveProgress(int save_item_id, | 167 void OnUpdateSaveProgress(int save_item_id, |
| 168 int64 bytes_so_far, | 168 int64 bytes_so_far, |
| 169 bool write_success); | 169 bool write_success); |
| 170 // Update the SavePackage with the finish state, and remove the request | 170 // Update the SavePackage with the finish state, and remove the request |
| 171 // tracking entries. | 171 // tracking entries. |
| 172 void OnSaveFinished(int save_item_id, int64 bytes_so_far, bool is_success); | 172 void OnSaveFinished(int save_item_id, int64 bytes_so_far, bool is_success); |
| 173 // Notifies SavePackage that the whole page saving job is finished. | 173 // Notifies SavePackage that the whole page saving job is finished. |
| 174 void OnFinishSavePageJob(int render_process_id, | 174 void OnFinishSavePageJob(int render_process_id, |
| (...skipping 28 matching lines...) Expand all Loading... |
| 203 // SavePackageMap maps save item ids to their SavePackage. | 203 // SavePackageMap maps save item ids to their SavePackage. |
| 204 typedef base::hash_map<int, SavePackage*> SavePackageMap; | 204 typedef base::hash_map<int, SavePackage*> SavePackageMap; |
| 205 SavePackageMap packages_; | 205 SavePackageMap packages_; |
| 206 | 206 |
| 207 DISALLOW_COPY_AND_ASSIGN(SaveFileManager); | 207 DISALLOW_COPY_AND_ASSIGN(SaveFileManager); |
| 208 }; | 208 }; |
| 209 | 209 |
| 210 } // namespace content | 210 } // namespace content |
| 211 | 211 |
| 212 #endif // CONTENT_BROWSER_DOWNLOAD_SAVE_FILE_MANAGER_H_ | 212 #endif // CONTENT_BROWSER_DOWNLOAD_SAVE_FILE_MANAGER_H_ |
| OLD | NEW |