OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
11 #include "base/platform_file.h" | 11 #include "base/platform_file.h" |
12 #include "base/process.h" | 12 #include "base/process.h" |
13 #include "content/common/content_export.h" | 13 #include "content/common/content_export.h" |
14 #include "content/public/browser/browser_thread.h" | 14 #include "content/public/browser/browser_thread.h" |
15 #include "ipc/ipc_platform_file.h" | 15 #include "ipc/ipc_platform_file.h" |
16 | 16 |
17 class FilePath; | 17 class FilePath; |
18 class TabContents; | 18 |
| 19 namespace content { |
| 20 class WebContents; |
| 21 } |
19 | 22 |
20 class CONTENT_EXPORT MHTMLGenerationManager | 23 class CONTENT_EXPORT MHTMLGenerationManager |
21 : public base::RefCountedThreadSafe< | 24 : public base::RefCountedThreadSafe< |
22 MHTMLGenerationManager, content::BrowserThread::DeleteOnUIThread> { | 25 MHTMLGenerationManager, content::BrowserThread::DeleteOnUIThread> { |
23 public: | 26 public: |
24 MHTMLGenerationManager(); | 27 MHTMLGenerationManager(); |
25 ~MHTMLGenerationManager(); | 28 ~MHTMLGenerationManager(); |
26 | 29 |
27 typedef base::Callback<void(const FilePath& /* path to the MHTML file */, | 30 typedef base::Callback<void(const FilePath& /* path to the MHTML file */, |
28 int64 /* size of the file */)> GenerateMHTMLCallback; | 31 int64 /* size of the file */)> GenerateMHTMLCallback; |
29 | 32 |
30 // Instructs the render view to generate a MHTML representation of the current | 33 // Instructs the render view to generate a MHTML representation of the current |
31 // page for |tab_contents|. | 34 // page for |web_contents|. |
32 void GenerateMHTML(TabContents* tab_contents, | 35 void GenerateMHTML(content::WebContents* web_contents, |
33 const FilePath& file, | 36 const FilePath& file, |
34 const GenerateMHTMLCallback& callback); | 37 const GenerateMHTMLCallback& callback); |
35 | 38 |
36 // Notification from the renderer that the MHTML generation finished. | 39 // Notification from the renderer that the MHTML generation finished. |
37 // |mhtml_data_size| contains the size in bytes of the generated MHTML data, | 40 // |mhtml_data_size| contains the size in bytes of the generated MHTML data, |
38 // or -1 in case of failure. | 41 // or -1 in case of failure. |
39 void MHTMLGenerated(int job_id, int64 mhtml_data_size); | 42 void MHTMLGenerated(int job_id, int64 mhtml_data_size); |
40 | 43 |
41 private: | 44 private: |
42 struct Job{ | 45 struct Job{ |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 // |mhtml_data_size| is -1 if the MHTML generation failed. | 82 // |mhtml_data_size| is -1 if the MHTML generation failed. |
80 void JobFinished(int job_id, int64 mhtml_data_size); | 83 void JobFinished(int job_id, int64 mhtml_data_size); |
81 | 84 |
82 typedef std::map<int, Job> IDToJobMap; | 85 typedef std::map<int, Job> IDToJobMap; |
83 IDToJobMap id_to_job_; | 86 IDToJobMap id_to_job_; |
84 | 87 |
85 DISALLOW_COPY_AND_ASSIGN(MHTMLGenerationManager); | 88 DISALLOW_COPY_AND_ASSIGN(MHTMLGenerationManager); |
86 }; | 89 }; |
87 | 90 |
88 #endif // CONTENT_BROWSER_DOWNLOAD_MHTML_GENERATION_MANAGER_H_ | 91 #endif // CONTENT_BROWSER_DOWNLOAD_MHTML_GENERATION_MANAGER_H_ |
OLD | NEW |