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 #ifndef CONTENT_BROWSER_DOWNLOAD_MHTML_GENERATION_MANAGER_H_ | 4 #ifndef CONTENT_BROWSER_DOWNLOAD_MHTML_GENERATION_MANAGER_H_ |
5 #define CONTENT_BROWSER_DOWNLOAD_MHTML_GENERATION_MANAGER_H_ | 5 #define CONTENT_BROWSER_DOWNLOAD_MHTML_GENERATION_MANAGER_H_ |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <memory> | 10 #include <memory> |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 static base::File CreateFile(const base::FilePath& file_path); | 69 static base::File CreateFile(const base::FilePath& file_path); |
70 | 70 |
71 // Called on the UI thread when the file that should hold the MHTML data has | 71 // Called on the UI thread when the file that should hold the MHTML data has |
72 // been created. | 72 // been created. |
73 void OnFileAvailable(int job_id, base::File browser_file); | 73 void OnFileAvailable(int job_id, base::File browser_file); |
74 | 74 |
75 // Called on the UI thread when a job has been finished. | 75 // Called on the UI thread when a job has been finished. |
76 void JobFinished(Job* job, MhtmlSaveStatus save_status); | 76 void JobFinished(Job* job, MhtmlSaveStatus save_status); |
77 | 77 |
78 // Called on the UI thread after the file got finalized and we have its size. | 78 // Called on the UI thread after the file got finalized and we have its size. |
79 void OnFileClosed(int job_id, MhtmlSaveStatus save_status, int64_t file_size); | 79 void OnFileClosed(int job_id, |
| 80 std::tuple<MhtmlSaveStatus, int64_t> save_status_size); |
80 | 81 |
81 // Creates and registers a new job. | 82 // Creates and registers a new job. |
82 Job* NewJob(WebContents* web_contents, | 83 Job* NewJob(WebContents* web_contents, |
83 const MHTMLGenerationParams& params, | 84 const MHTMLGenerationParams& params, |
84 const GenerateMHTMLCallback& callback); | 85 const GenerateMHTMLCallback& callback); |
85 | 86 |
86 // Finds job by id. Returns nullptr if no job with a given id was found. | 87 // Finds job by id. Returns nullptr if no job with a given id was found. |
87 Job* FindJob(int job_id); | 88 Job* FindJob(int job_id); |
88 | 89 |
89 // Called when the render process connected to a job exits. | 90 // Called when the render process connected to a job exits. |
90 void RenderProcessExited(Job* job); | 91 void RenderProcessExited(Job* job); |
91 | 92 |
92 std::map<int, std::unique_ptr<Job>> id_to_job_; | 93 std::map<int, std::unique_ptr<Job>> id_to_job_; |
93 | 94 |
94 int next_job_id_; | 95 int next_job_id_; |
95 | 96 |
96 DISALLOW_COPY_AND_ASSIGN(MHTMLGenerationManager); | 97 DISALLOW_COPY_AND_ASSIGN(MHTMLGenerationManager); |
97 }; | 98 }; |
98 | 99 |
99 } // namespace content | 100 } // namespace content |
100 | 101 |
101 #endif // CONTENT_BROWSER_DOWNLOAD_MHTML_GENERATION_MANAGER_H_ | 102 #endif // CONTENT_BROWSER_DOWNLOAD_MHTML_GENERATION_MANAGER_H_ |
OLD | NEW |