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

Side by Side Diff: content/browser/download/mhtml_generation_manager.cc

Issue 10069016: TabContents -> WebContentsImpl, part 9. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 #include "content/browser/download/mhtml_generation_manager.h" 5 #include "content/browser/download/mhtml_generation_manager.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/platform_file.h" 8 #include "base/platform_file.h"
9 #include "content/browser/renderer_host/render_process_host_impl.h" 9 #include "content/browser/renderer_host/render_process_host_impl.h"
10 #include "content/browser/renderer_host/render_view_host_impl.h" 10 #include "content/browser/renderer_host/render_view_host_impl.h"
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 return; 100 return;
101 } 101 }
102 102
103 Job& job = iter->second; 103 Job& job = iter->second;
104 job.browser_file = browser_file; 104 job.browser_file = browser_file;
105 job.renderer_file = renderer_file; 105 job.renderer_file = renderer_file;
106 106
107 RenderViewHostImpl* rvh = RenderViewHostImpl::FromID( 107 RenderViewHostImpl* rvh = RenderViewHostImpl::FromID(
108 job.process_id, job.routing_id); 108 job.process_id, job.routing_id);
109 if (!rvh) { 109 if (!rvh) {
110 // The tab went away. 110 // The contents went away.
111 JobFinished(job_id, -1); 111 JobFinished(job_id, -1);
112 return; 112 return;
113 } 113 }
114 114
115 rvh->Send(new ViewMsg_SavePageAsMHTML(rvh->GetRoutingID(), job_id, 115 rvh->Send(new ViewMsg_SavePageAsMHTML(rvh->GetRoutingID(), job_id,
116 renderer_file)); 116 renderer_file));
117 } 117 }
118 118
119 void MHTMLGenerationManager::JobFinished(int job_id, int64 file_size) { 119 void MHTMLGenerationManager::JobFinished(int job_id, int64 file_size) {
120 IDToJobMap::iterator iter = id_to_job_.find(job_id); 120 IDToJobMap::iterator iter = id_to_job_.find(job_id);
121 if (iter == id_to_job_.end()) { 121 if (iter == id_to_job_.end()) {
122 NOTREACHED(); 122 NOTREACHED();
123 return; 123 return;
124 } 124 }
125 125
126 Job& job = iter->second; 126 Job& job = iter->second;
127 job.callback.Run(job.file_path, file_size); 127 job.callback.Run(job.file_path, file_size);
128 128
129 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, 129 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE,
130 base::Bind(&MHTMLGenerationManager::CloseFile, base::Unretained(this), 130 base::Bind(&MHTMLGenerationManager::CloseFile, base::Unretained(this),
131 job.browser_file)); 131 job.browser_file));
132 132
133 id_to_job_.erase(job_id); 133 id_to_job_.erase(job_id);
134 } 134 }
135 135
136 void MHTMLGenerationManager::CloseFile(base::PlatformFile file) { 136 void MHTMLGenerationManager::CloseFile(base::PlatformFile file) {
137 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); 137 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
138 base::ClosePlatformFile(file); 138 base::ClosePlatformFile(file);
139 } 139 }
OLDNEW
« no previous file with comments | « content/browser/download/mhtml_generation_manager.h ('k') | content/browser/download/save_file_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698