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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 // | 50 // |
51 // | 51 // |
52 // The SaveFileManager tracks saving requests, mapping from a save item id to | 52 // The SaveFileManager tracks saving requests, mapping from a save item id to |
53 // the SavePackage for the contents where the saving job was initiated. In the | 53 // the SavePackage for the contents where the saving job was initiated. In the |
54 // event of a contents closure during saving, the SavePackage will notify the | 54 // event of a contents closure during saving, the SavePackage will notify the |
55 // SaveFileManage to cancel all SaveFile jobs. | 55 // SaveFileManage to cancel all SaveFile jobs. |
56 | 56 |
57 #ifndef CONTENT_BROWSER_DOWNLOAD_SAVE_FILE_MANAGER_H_ | 57 #ifndef CONTENT_BROWSER_DOWNLOAD_SAVE_FILE_MANAGER_H_ |
58 #define CONTENT_BROWSER_DOWNLOAD_SAVE_FILE_MANAGER_H_ | 58 #define CONTENT_BROWSER_DOWNLOAD_SAVE_FILE_MANAGER_H_ |
59 | 59 |
| 60 #include <stdint.h> |
| 61 |
60 #include <string> | 62 #include <string> |
61 | 63 |
62 #include "base/basictypes.h" | |
63 #include "base/containers/hash_tables.h" | 64 #include "base/containers/hash_tables.h" |
| 65 #include "base/macros.h" |
64 #include "base/memory/ref_counted.h" | 66 #include "base/memory/ref_counted.h" |
65 #include "content/browser/download/save_types.h" | 67 #include "content/browser/download/save_types.h" |
66 #include "content/common/content_export.h" | 68 #include "content/common/content_export.h" |
67 | 69 |
68 class GURL; | 70 class GURL; |
69 | 71 |
70 namespace base { | 72 namespace base { |
71 class FilePath; | 73 class FilePath; |
72 } | 74 } |
73 | 75 |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 void SendCancelRequest(int save_item_id); | 160 void SendCancelRequest(int save_item_id); |
159 | 161 |
160 // Notifications sent from the file thread and run on the UI thread. | 162 // Notifications sent from the file thread and run on the UI thread. |
161 | 163 |
162 // Lookup the SaveManager for this WebContents' saving browser context and | 164 // Lookup the SaveManager for this WebContents' saving browser context and |
163 // inform it the saving job has been started. | 165 // inform it the saving job has been started. |
164 void OnStartSave(const SaveFileCreateInfo& info); | 166 void OnStartSave(const SaveFileCreateInfo& info); |
165 // Update the SavePackage with the current state of a started saving job. | 167 // 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. | 168 // If the SavePackage for this saving job is gone, cancel the request. |
167 void OnUpdateSaveProgress(int save_item_id, | 169 void OnUpdateSaveProgress(int save_item_id, |
168 int64 bytes_so_far, | 170 int64_t bytes_so_far, |
169 bool write_success); | 171 bool write_success); |
170 // Update the SavePackage with the finish state, and remove the request | 172 // Update the SavePackage with the finish state, and remove the request |
171 // tracking entries. | 173 // tracking entries. |
172 void OnSaveFinished(int save_item_id, int64 bytes_so_far, bool is_success); | 174 void OnSaveFinished(int save_item_id, int64_t bytes_so_far, bool is_success); |
173 // Notifies SavePackage that the whole page saving job is finished. | 175 // Notifies SavePackage that the whole page saving job is finished. |
174 void OnFinishSavePageJob(int render_process_id, | 176 void OnFinishSavePageJob(int render_process_id, |
175 int render_frame_routing_id, | 177 int render_frame_routing_id, |
176 int save_package_id); | 178 int save_package_id); |
177 | 179 |
178 // Notifications sent from the UI thread and run on the file thread. | 180 // Notifications sent from the UI thread and run on the file thread. |
179 | 181 |
180 // Deletes a specified file on the file thread. | 182 // Deletes a specified file on the file thread. |
181 void OnDeleteDirectoryOrFile(const base::FilePath& full_path, bool is_dir); | 183 void OnDeleteDirectoryOrFile(const base::FilePath& full_path, bool is_dir); |
182 | 184 |
(...skipping 20 matching lines...) Expand all Loading... |
203 // SavePackageMap maps save item ids to their SavePackage. | 205 // SavePackageMap maps save item ids to their SavePackage. |
204 typedef base::hash_map<int, SavePackage*> SavePackageMap; | 206 typedef base::hash_map<int, SavePackage*> SavePackageMap; |
205 SavePackageMap packages_; | 207 SavePackageMap packages_; |
206 | 208 |
207 DISALLOW_COPY_AND_ASSIGN(SaveFileManager); | 209 DISALLOW_COPY_AND_ASSIGN(SaveFileManager); |
208 }; | 210 }; |
209 | 211 |
210 } // namespace content | 212 } // namespace content |
211 | 213 |
212 #endif // CONTENT_BROWSER_DOWNLOAD_SAVE_FILE_MANAGER_H_ | 214 #endif // CONTENT_BROWSER_DOWNLOAD_SAVE_FILE_MANAGER_H_ |
OLD | NEW |