Index: content/browser/download/mhtml_generation_manager.cc |
diff --git a/content/browser/download/mhtml_generation_manager.cc b/content/browser/download/mhtml_generation_manager.cc |
index 7a63009f02381eb67da0d1a8623d4a11c8462a07..2251c1f595fe863c1194986a02cc38bf369ac652 100644 |
--- a/content/browser/download/mhtml_generation_manager.cc |
+++ b/content/browser/download/mhtml_generation_manager.cc |
@@ -22,6 +22,9 @@ MHTMLGenerationManager::Job::Job() |
routing_id(-1) { |
} |
+MHTMLGenerationManager::Job::~Job() { |
+} |
+ |
MHTMLGenerationManager::MHTMLGenerationManager() { |
} |
@@ -29,7 +32,8 @@ MHTMLGenerationManager::~MHTMLGenerationManager() { |
} |
void MHTMLGenerationManager::GenerateMHTML(TabContents* tab_contents, |
- const FilePath& file) { |
+ const FilePath& file, |
+ const GenerateMHTMLCallback& callback) { |
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
static int id_counter = 0; |
@@ -38,6 +42,7 @@ void MHTMLGenerationManager::GenerateMHTML(TabContents* tab_contents, |
job.file_path = file; |
job.process_id = tab_contents->GetRenderProcessHost()->GetID(); |
job.routing_id = tab_contents->render_view_host()->routing_id(); |
+ job.callback = callback; |
id_to_job_[job_id] = job; |
base::ProcessHandle renderer_process = |
@@ -109,18 +114,7 @@ void MHTMLGenerationManager::JobFinished(int job_id, int64 file_size) { |
} |
Job& job = iter->second; |
- |
- RenderViewHost* rvh = RenderViewHost::FromID(job.process_id, job.routing_id); |
- if (rvh) { |
- NotificationDetails details; |
- details.file_path = job.file_path; |
- details.file_size = file_size; |
- |
- content::NotificationService::current()->Notify( |
- content::NOTIFICATION_MHTML_GENERATED, |
- content::Source<RenderViewHost>(rvh), |
- content::Details<NotificationDetails>(&details)); |
- } |
+ job.callback.Run(job.file_path, file_size); |
BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, |
base::Bind(&MHTMLGenerationManager::CloseFile, this, job.browser_file)); |