| 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_MHTML_GENERATION_MANAGER_H_ | 5 #ifndef CONTENT_BROWSER_DOWNLOAD_MHTML_GENERATION_MANAGER_H_ |
| 6 #define CONTENT_BROWSER_DOWNLOAD_MHTML_GENERATION_MANAGER_H_ | 6 #define CONTENT_BROWSER_DOWNLOAD_MHTML_GENERATION_MANAGER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 | 9 |
| 10 #include "base/files/file.h" | 10 #include "base/files/file.h" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 // generation. On success |file_size| indicates the size of the | 30 // generation. On success |file_size| indicates the size of the |
| 31 // generated file. On failure |file_size| is -1. | 31 // generated file. On failure |file_size| is -1. |
| 32 typedef base::Callback<void(int64 file_size)> GenerateMHTMLCallback; | 32 typedef base::Callback<void(int64 file_size)> GenerateMHTMLCallback; |
| 33 | 33 |
| 34 // Instructs the render view to generate a MHTML representation of the current | 34 // Instructs the render view to generate a MHTML representation of the current |
| 35 // page for |web_contents|. | 35 // page for |web_contents|. |
| 36 void SaveMHTML(WebContents* web_contents, | 36 void SaveMHTML(WebContents* web_contents, |
| 37 const base::FilePath& file_path, | 37 const base::FilePath& file_path, |
| 38 const GenerateMHTMLCallback& callback); | 38 const GenerateMHTMLCallback& callback); |
| 39 | 39 |
| 40 // Handler for ViewHostMsg_SavedPageAsMHTML (a notification from the renderer | 40 // Handler for FrameHostMsg_SerializeAsMHTMLResponse (a notification from the |
| 41 // that the MHTML generation finished). | 41 // renderer that the MHTML generation finished for a single frame). |
| 42 void OnSavedPageAsMHTML(int job_id, | 42 void OnSavedFrameAsMHTML(int job_id, |
| 43 bool mhtml_generation_in_renderer_succeeded); | 43 bool mhtml_generation_in_renderer_succeeded); |
| 44 | 44 |
| 45 private: | 45 private: |
| 46 friend struct base::DefaultSingletonTraits<MHTMLGenerationManager>; | 46 friend struct base::DefaultSingletonTraits<MHTMLGenerationManager>; |
| 47 class Job; | 47 class Job; |
| 48 enum class JobStatus { SUCCESS, FAILURE }; | 48 enum class JobStatus { SUCCESS, FAILURE }; |
| 49 | 49 |
| 50 MHTMLGenerationManager(); | 50 MHTMLGenerationManager(); |
| 51 virtual ~MHTMLGenerationManager(); | 51 virtual ~MHTMLGenerationManager(); |
| 52 | 52 |
| 53 // Called on the file thread to create |file|. | 53 // Called on the file thread to create |file|. |
| (...skipping 22 matching lines...) Expand all Loading... |
| 76 IDToJobMap id_to_job_; | 76 IDToJobMap id_to_job_; |
| 77 | 77 |
| 78 int next_job_id_; | 78 int next_job_id_; |
| 79 | 79 |
| 80 DISALLOW_COPY_AND_ASSIGN(MHTMLGenerationManager); | 80 DISALLOW_COPY_AND_ASSIGN(MHTMLGenerationManager); |
| 81 }; | 81 }; |
| 82 | 82 |
| 83 } // namespace content | 83 } // namespace content |
| 84 | 84 |
| 85 #endif // CONTENT_BROWSER_DOWNLOAD_MHTML_GENERATION_MANAGER_H_ | 85 #endif // CONTENT_BROWSER_DOWNLOAD_MHTML_GENERATION_MANAGER_H_ |
| OLD | NEW |