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 #ifndef CONTENT_BROWSER_DOWNLOAD_SAVE_PACKAGE_H_ | 5 #ifndef CONTENT_BROWSER_DOWNLOAD_SAVE_PACKAGE_H_ |
6 #define CONTENT_BROWSER_DOWNLOAD_SAVE_PACKAGE_H_ | 6 #define CONTENT_BROWSER_DOWNLOAD_SAVE_PACKAGE_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 // g_browser_process on a non-UI thread can cause crashes during shutdown. | 93 // g_browser_process on a non-UI thread can cause crashes during shutdown. |
94 // |cb| will be called when the DownloadItem is created, before data is | 94 // |cb| will be called when the DownloadItem is created, before data is |
95 // written to disk. | 95 // written to disk. |
96 bool Init(const SavePackageDownloadCreatedCallback& cb); | 96 bool Init(const SavePackageDownloadCreatedCallback& cb); |
97 | 97 |
98 // Cancel all in progress request, might be called by user or internal error. | 98 // Cancel all in progress request, might be called by user or internal error. |
99 void Cancel(bool user_action, bool cancel_download_item = true); | 99 void Cancel(bool user_action, bool cancel_download_item = true); |
100 | 100 |
101 void Finish(); | 101 void Finish(); |
102 | 102 |
103 // Notifications sent from the FILE thread to the UI thread. | 103 // Notifications sent from the download sequence to the UI thread. |
104 void StartSave(const SaveFileCreateInfo* info); | 104 void StartSave(const SaveFileCreateInfo* info); |
105 bool UpdateSaveProgress(SaveItemId save_item_id, | 105 bool UpdateSaveProgress(SaveItemId save_item_id, |
106 int64_t size, | 106 int64_t size, |
107 bool write_success); | 107 bool write_success); |
108 // Called for updating end state. | 108 // Called for updating end state. |
109 void SaveFinished(SaveItemId save_item_id, int64_t size, bool is_success); | 109 void SaveFinished(SaveItemId save_item_id, int64_t size, bool is_success); |
110 void SaveCanceled(const SaveItem* save_item); | 110 void SaveCanceled(const SaveItem* save_item); |
111 | 111 |
112 // Calculate the percentage of whole save page job. | 112 // Calculate the percentage of whole save page job. |
113 // Rough percent complete, -1 means we don't know (since we didn't receive a | 113 // Rough percent complete, -1 means we don't know (since we didn't receive a |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
379 // etc. | 379 // etc. |
380 std::unordered_map<int, std::vector<SaveItem*>> | 380 std::unordered_map<int, std::vector<SaveItem*>> |
381 frame_tree_node_id_to_contained_save_items_; | 381 frame_tree_node_id_to_contained_save_items_; |
382 | 382 |
383 // Number of frames that we still need to get a response from. | 383 // Number of frames that we still need to get a response from. |
384 int number_of_frames_pending_response_ = 0; | 384 int number_of_frames_pending_response_ = 0; |
385 | 385 |
386 // Map of all saving job which are successfully saved. | 386 // Map of all saving job which are successfully saved. |
387 SaveItemIdMap saved_success_items_; | 387 SaveItemIdMap saved_success_items_; |
388 | 388 |
389 // Non-owning pointer for handling file writing on the FILE thread. | 389 // Non-owning pointer for handling file writing on the download sequence. |
390 SaveFileManager* file_manager_ = nullptr; | 390 SaveFileManager* file_manager_ = nullptr; |
391 | 391 |
392 // DownloadManager owns the DownloadItem and handles history and UI. | 392 // DownloadManager owns the DownloadItem and handles history and UI. |
393 DownloadManagerImpl* download_manager_ = nullptr; | 393 DownloadManagerImpl* download_manager_ = nullptr; |
394 DownloadItemImpl* download_ = nullptr; | 394 DownloadItemImpl* download_ = nullptr; |
395 | 395 |
396 // The URL of the page the user wants to save. | 396 // The URL of the page the user wants to save. |
397 GURL page_url_; | 397 GURL page_url_; |
398 base::FilePath saved_main_file_path_; | 398 base::FilePath saved_main_file_path_; |
399 base::FilePath saved_main_directory_path_; | 399 base::FilePath saved_main_directory_path_; |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
436 | 436 |
437 // Unique ID for this SavePackage. | 437 // Unique ID for this SavePackage. |
438 const SavePackageId unique_id_; | 438 const SavePackageId unique_id_; |
439 | 439 |
440 DISALLOW_COPY_AND_ASSIGN(SavePackage); | 440 DISALLOW_COPY_AND_ASSIGN(SavePackage); |
441 }; | 441 }; |
442 | 442 |
443 } // namespace content | 443 } // namespace content |
444 | 444 |
445 #endif // CONTENT_BROWSER_DOWNLOAD_SAVE_PACKAGE_H_ | 445 #endif // CONTENT_BROWSER_DOWNLOAD_SAVE_PACKAGE_H_ |
OLD | NEW |