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

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

Issue 8672001: Revert 111252 - Switch MHTMLGenerationManager to use a Callback. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 1 month 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
« no previous file with comments | « content/browser/download/mhtml_generation_manager.h ('k') | content/public/browser/notification_types.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/download/mhtml_generation_manager.cc
===================================================================
--- content/browser/download/mhtml_generation_manager.cc (revision 111255)
+++ content/browser/download/mhtml_generation_manager.cc (working copy)
@@ -29,8 +29,7 @@
}
void MHTMLGenerationManager::GenerateMHTML(TabContents* tab_contents,
- const FilePath& file,
- const GenerateMHTMLCallback& callback) {
+ const FilePath& file) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
static int id_counter = 0;
@@ -39,7 +38,6 @@
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 =
@@ -111,8 +109,19 @@
}
Job& job = iter->second;
- job.callback.Run(job.file_path, file_size);
+ 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));
+ }
+
BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE,
base::Bind(&MHTMLGenerationManager::CloseFile, this, job.browser_file));
« no previous file with comments | « content/browser/download/mhtml_generation_manager.h ('k') | content/public/browser/notification_types.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698