| 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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 class SavePackage; | 83 class SavePackage; |
| 84 struct Referrer; | 84 struct Referrer; |
| 85 | 85 |
| 86 class SaveFileManager : public base::RefCountedThreadSafe<SaveFileManager> { | 86 class SaveFileManager : public base::RefCountedThreadSafe<SaveFileManager> { |
| 87 public: | 87 public: |
| 88 SaveFileManager(); | 88 SaveFileManager(); |
| 89 | 89 |
| 90 // Lifetime management. | 90 // Lifetime management. |
| 91 CONTENT_EXPORT void Shutdown(); | 91 CONTENT_EXPORT void Shutdown(); |
| 92 | 92 |
| 93 // Save the specified URL. Called on the UI thread and forwarded to the | 93 // Save the specified URL. Caller has to guarantee that |save_package| will |
| 94 // ResourceDispatcherHostImpl on the IO thread. | 94 // be alive until the call to RemoveSaveFile. Called on the UI thread (and in |
| 95 // case of network downloads forwarded to the ResourceDispatcherHostImpl on |
| 96 // the IO thread). |
| 95 void SaveURL(SaveItemId save_item_id, | 97 void SaveURL(SaveItemId save_item_id, |
| 96 const GURL& url, | 98 const GURL& url, |
| 97 const Referrer& referrer, | 99 const Referrer& referrer, |
| 98 int render_process_host_id, | 100 int render_process_host_id, |
| 99 int render_view_routing_id, | 101 int render_view_routing_id, |
| 100 int render_frame_routing_id, | 102 int render_frame_routing_id, |
| 101 SaveFileCreateInfo::SaveFileSource save_source, | 103 SaveFileCreateInfo::SaveFileSource save_source, |
| 102 const base::FilePath& file_full_path, | 104 const base::FilePath& file_full_path, |
| 103 ResourceContext* context, | 105 ResourceContext* context, |
| 104 SavePackage* save_package); | 106 SavePackage* save_package); |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 using SavePackageMap = | 215 using SavePackageMap = |
| 214 std::unordered_map<SaveItemId, SavePackage*, SaveItemId::Hasher>; | 216 std::unordered_map<SaveItemId, SavePackage*, SaveItemId::Hasher>; |
| 215 SavePackageMap packages_; | 217 SavePackageMap packages_; |
| 216 | 218 |
| 217 DISALLOW_COPY_AND_ASSIGN(SaveFileManager); | 219 DISALLOW_COPY_AND_ASSIGN(SaveFileManager); |
| 218 }; | 220 }; |
| 219 | 221 |
| 220 } // namespace content | 222 } // namespace content |
| 221 | 223 |
| 222 #endif // CONTENT_BROWSER_DOWNLOAD_SAVE_FILE_MANAGER_H_ | 224 #endif // CONTENT_BROWSER_DOWNLOAD_SAVE_FILE_MANAGER_H_ |
| OLD | NEW |