Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(98)

Unified Diff: content/browser/download/mhtml_generation_manager.h

Issue 22920005: Refactor MHTMLGenerator to allow getting sending the data to a file descriptor. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/download/mhtml_generation_manager.h
diff --git a/content/browser/download/mhtml_generation_manager.h b/content/browser/download/mhtml_generation_manager.h
index 0c9ec619557eca79637c4430775b50f38c5de9f0..5525d99b812cfffc359b83fc9745f21c04594fb4 100644
--- a/content/browser/download/mhtml_generation_manager.h
+++ b/content/browser/download/mhtml_generation_manager.h
@@ -25,14 +25,20 @@ class MHTMLGenerationManager : public NotificationObserver {
public:
static MHTMLGenerationManager* GetInstance();
- typedef base::Callback<void(const base::FilePath& /* path to the MHTML file */,
- int64 /* size of the file */)> GenerateMHTMLCallback;
+ typedef base::Callback<void(int64 /* size of the file */)>
+ GenerateMHTMLCallback;
// Instructs the render view to generate a MHTML representation of the current
// page for |web_contents|.
- void GenerateMHTML(WebContents* web_contents,
- const base::FilePath& file,
- const GenerateMHTMLCallback& callback);
+ void SaveMHTML(WebContents* web_contents,
+ const base::FilePath& file,
+ const GenerateMHTMLCallback& callback);
+
+ // Instructs the render view to generate a MHTML representation of the current
+ // page for |web_contents|.
+ void StreamMHTML(WebContents* web_contents,
+ const base::PlatformFile file,
+ const GenerateMHTMLCallback& callback);
// Notification from the renderer that the MHTML generation finished.
// |mhtml_data_size| contains the size in bytes of the generated MHTML data,
@@ -46,8 +52,6 @@ class MHTMLGenerationManager : public NotificationObserver {
Job();
~Job();
- base::FilePath file_path;
-
// The handles to file the MHTML is saved to, for the browser and renderer
// processes.
base::PlatformFile browser_file;
@@ -73,9 +77,9 @@ class MHTMLGenerationManager : public NotificationObserver {
// been created. This returns a handle to that file for the browser process
// and one for the renderer process. These handles are
// kInvalidPlatformFileValue if the file could not be opened.
- void FileCreated(int job_id,
- base::PlatformFile browser_file,
- IPC::PlatformFileForTransit renderer_file);
+ void FileHandleAvailable(int job_id,
+ base::PlatformFile browser_file,
+ IPC::PlatformFileForTransit renderer_file);
// Called on the file thread to close the file the MHTML was saved to.
void CloseFile(base::PlatformFile file);
@@ -85,6 +89,9 @@ class MHTMLGenerationManager : public NotificationObserver {
// |mhtml_data_size| is -1 if the MHTML generation failed.
void JobFinished(int job_id, int64 mhtml_data_size);
+ // Creates an register a new job.
+ int NewJob(WebContents* web_contents, const GenerateMHTMLCallback& callback);
+
// Implementation of NotificationObserver.
virtual void Observe(int type,
const NotificationSource& source,

Powered by Google App Engine
This is Rietveld 408576698