Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 <map> | |
| 8 #include <queue> | |
| 9 | |
| 7 #include "base/bind.h" | 10 #include "base/bind.h" |
| 8 #include "base/files/file.h" | 11 #include "base/files/file.h" |
| 12 #include "base/guid.h" | |
| 13 #include "base/rand_util.h" | |
| 9 #include "base/scoped_observer.h" | 14 #include "base/scoped_observer.h" |
| 10 #include "base/stl_util.h" | 15 #include "base/stl_util.h" |
| 11 #include "content/browser/renderer_host/render_view_host_impl.h" | 16 #include "base/strings/string_number_conversions.h" |
| 17 #include "base/strings/stringprintf.h" | |
| 18 #include "content/browser/frame_host/frame_tree_node.h" | |
| 19 #include "content/common/frame_messages.h" | |
| 12 #include "content/public/browser/browser_thread.h" | 20 #include "content/public/browser/browser_thread.h" |
| 13 #include "content/public/browser/render_frame_host.h" | 21 #include "content/public/browser/render_frame_host.h" |
| 14 #include "content/public/browser/render_process_host.h" | 22 #include "content/public/browser/render_process_host.h" |
| 15 #include "content/public/browser/render_process_host_observer.h" | 23 #include "content/public/browser/render_process_host_observer.h" |
| 16 #include "content/public/browser/web_contents.h" | 24 #include "content/public/browser/web_contents.h" |
| 17 #include "content/common/view_messages.h" | |
| 18 | 25 |
| 19 namespace content { | 26 namespace content { |
| 20 | 27 |
| 21 // The class and all of its members live on the UI thread. Only static methods | 28 // The class and all of its members live on the UI thread. Only static methods |
| 22 // are executed on other threads. | 29 // are executed on other threads. |
| 23 class MHTMLGenerationManager::Job : public RenderProcessHostObserver { | 30 class MHTMLGenerationManager::Job : public RenderProcessHostObserver { |
| 24 public: | 31 public: |
| 25 Job(int job_id, WebContents* web_contents, GenerateMHTMLCallback callback); | 32 Job(int job_id, WebContents* web_contents, GenerateMHTMLCallback callback); |
| 26 ~Job() override; | 33 ~Job() override; |
| 27 | 34 |
| 28 void set_browser_file(base::File file) { browser_file_ = file.Pass(); } | 35 void set_browser_file(base::File file) { browser_file_ = file.Pass(); } |
| 29 | 36 |
| 30 GenerateMHTMLCallback callback() const { return callback_; } | 37 GenerateMHTMLCallback callback() const { return callback_; } |
| 31 | 38 |
| 32 // Sends IPC to the renderer, asking for MHTML generation. | 39 // Sends IPC to the renderer, asking for MHTML generation of the next frame. |
| 40 // | |
| 33 // Returns true if the message was sent successfully; false otherwise. | 41 // Returns true if the message was sent successfully; false otherwise. |
| 34 bool SendToRenderView(); | 42 bool SendToNextRenderFrame(); |
| 43 | |
| 44 // Indicates if more calls to SendToNextRenderFrame are needed. | |
| 45 bool HasMoreFramesToProcess() const { | |
| 46 return !pending_frame_tree_node_ids_.empty(); | |
| 47 } | |
| 35 | 48 |
| 36 // Close the file on the file thread and respond back on the UI thread with | 49 // Close the file on the file thread and respond back on the UI thread with |
| 37 // file size. | 50 // file size. |
| 38 void CloseFile(base::Callback<void(int64 file_size)> callback); | 51 void CloseFile(base::Callback<void(int64 file_size)> callback); |
| 39 | 52 |
| 40 // RenderProcessHostObserver: | 53 // RenderProcessHostObserver: |
| 41 void RenderProcessExited(RenderProcessHost* host, | 54 void RenderProcessExited(RenderProcessHost* host, |
| 42 base::TerminationStatus status, | 55 base::TerminationStatus status, |
| 43 int exit_code) override; | 56 int exit_code) override; |
| 44 void RenderProcessHostDestroyed(RenderProcessHost* host) override; | 57 void RenderProcessHostDestroyed(RenderProcessHost* host) override; |
| 45 | 58 |
| 46 private: | 59 private: |
| 60 static std::string GenerateMHTMLBoundaryMarker(); | |
| 47 static int64 CloseFileOnFileThread(base::File file); | 61 static int64 CloseFileOnFileThread(base::File file); |
| 62 void AddFrame(RenderFrameHost* render_frame_host); | |
| 63 | |
| 64 // Translates |frame_tree_node_to_content_id_| into | |
| 65 // a |site_instance|-specific, routing-id-based map. | |
|
Randy Smith (Not in Mondays)
2015/12/10 23:07:55
nit: My impression from reading the code is the pr
lukasza
2015/12/11 00:29:03
I've tried rewording the comment to make it cleare
Randy Smith (Not in Mondays)
2015/12/14 02:47:04
Yeah, I think I was mis-understanding the function
| |
| 66 std::map<int, std::string> CreateFrameRoutingIdToContentId( | |
| 67 SiteInstance* site_instance); | |
| 48 | 68 |
| 49 // Id used to map renderer responses to jobs. | 69 // Id used to map renderer responses to jobs. |
| 50 // See also MHTMLGenerationManager::id_to_job_ map. | 70 // See also MHTMLGenerationManager::id_to_job_ map. |
| 51 int job_id_; | 71 int job_id_; |
| 52 | 72 |
| 53 // The handle to the file the MHTML is saved to for the browser process. | 73 // The handle to the file the MHTML is saved to for the browser process. |
| 54 base::File browser_file_; | 74 base::File browser_file_; |
| 55 | 75 |
| 56 // The IDs mapping to a specific contents. | 76 // The IDs of frames we still need to process. |
| 57 int process_id_; | 77 std::queue<int> pending_frame_tree_node_ids_; |
| 58 int routing_id_; | 78 |
| 79 // Map from frames into content ids (see WebPageSerializer::generateMHTMLParts | |
| 80 // for more details about what "content ids" are and how they are used). | |
| 81 std::map<int, std::string> frame_tree_node_to_content_id_; | |
| 82 | |
| 83 // MIME multipart boundary to use in the MHTML doc. | |
| 84 std::string mhtml_boundary_marker_; | |
| 59 | 85 |
| 60 // The callback to call once generation is complete. | 86 // The callback to call once generation is complete. |
| 61 GenerateMHTMLCallback callback_; | 87 GenerateMHTMLCallback callback_; |
| 62 | 88 |
| 63 // RAII helper for registering this Job as a RenderProcessHost observer. | 89 // RAII helper for registering this Job as a RenderProcessHost observer. |
| 64 ScopedObserver<RenderProcessHost, MHTMLGenerationManager::Job> | 90 ScopedObserver<RenderProcessHost, MHTMLGenerationManager::Job> |
| 65 observed_renderer_process_host_; | 91 observed_renderer_process_host_; |
| 66 | 92 |
| 67 DISALLOW_COPY_AND_ASSIGN(Job); | 93 DISALLOW_COPY_AND_ASSIGN(Job); |
| 68 }; | 94 }; |
| 69 | 95 |
| 70 MHTMLGenerationManager::Job::Job(int job_id, | 96 MHTMLGenerationManager::Job::Job(int job_id, |
| 71 WebContents* web_contents, | 97 WebContents* web_contents, |
| 72 GenerateMHTMLCallback callback) | 98 GenerateMHTMLCallback callback) |
| 73 : job_id_(job_id), | 99 : job_id_(job_id), |
| 74 process_id_(web_contents->GetRenderProcessHost()->GetID()), | 100 mhtml_boundary_marker_(GenerateMHTMLBoundaryMarker()), |
| 75 routing_id_(web_contents->GetRenderViewHost()->GetRoutingID()), | |
| 76 callback_(callback), | 101 callback_(callback), |
| 77 observed_renderer_process_host_(this) { | 102 observed_renderer_process_host_(this) { |
| 78 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 103 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 104 web_contents->ForEachFrame(base::Bind( | |
| 105 &MHTMLGenerationManager::Job::AddFrame, | |
| 106 base::Unretained(this))); // Safe because ForEachFrame is synchronous. | |
| 107 | |
| 108 // Main frame needs to be processed first. | |
| 109 DCHECK(!pending_frame_tree_node_ids_.empty()); | |
| 110 DCHECK(FrameTreeNode::GloballyFindByID(pending_frame_tree_node_ids_.front()) | |
| 111 ->parent() == nullptr); | |
| 79 } | 112 } |
| 80 | 113 |
| 81 MHTMLGenerationManager::Job::~Job() { | 114 MHTMLGenerationManager::Job::~Job() { |
| 82 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 115 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 83 } | 116 } |
| 84 | 117 |
| 85 bool MHTMLGenerationManager::Job::SendToRenderView() { | 118 std::map<int, std::string> |
| 86 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 119 MHTMLGenerationManager::Job::CreateFrameRoutingIdToContentId( |
| 120 SiteInstance* site_instance) { | |
|
Randy Smith (Not in Mondays)
2015/12/10 23:07:55
nit, suggestion: The only place in this file that
lukasza
2015/12/11 00:29:03
There are 2 frames: frame_A and frame_B. We want
Randy Smith (Not in Mondays)
2015/12/14 02:47:04
Yeah, I think I didn't have a full appreciation of
| |
| 121 std::map<int, std::string> result; | |
| 122 for (const auto& it : frame_tree_node_to_content_id_) { | |
| 123 int ftn_id = it.first; | |
| 124 const std::string& content_id = it.second; | |
| 125 | |
| 126 FrameTreeNode* ftn = FrameTreeNode::GloballyFindByID(ftn_id); | |
| 127 if (!ftn) | |
| 128 continue; | |
| 129 | |
| 130 int routing_id = | |
| 131 ftn->render_manager()->GetRoutingIdForSiteInstance(site_instance); | |
| 132 if (routing_id == MSG_ROUTING_NONE) | |
| 133 continue; | |
| 134 | |
| 135 result[routing_id] = content_id; | |
| 136 } | |
| 137 return result; | |
| 138 } | |
| 139 | |
| 140 bool MHTMLGenerationManager::Job::SendToNextRenderFrame() { | |
| 87 DCHECK(browser_file_.IsValid()); | 141 DCHECK(browser_file_.IsValid()); |
| 142 DCHECK_LT(0u, pending_frame_tree_node_ids_.size()); | |
| 88 | 143 |
| 89 RenderViewHost* rvh = RenderViewHost::FromID(process_id_, routing_id_); | 144 int frame_tree_node_id = pending_frame_tree_node_ids_.front(); |
| 90 if (!rvh) { // The contents went away. | 145 pending_frame_tree_node_ids_.pop(); |
| 146 bool is_last_frame = pending_frame_tree_node_ids_.empty(); | |
| 147 | |
| 148 FrameTreeNode* ftn = FrameTreeNode::GloballyFindByID(frame_tree_node_id); | |
| 149 if (!ftn) // The contents went away. | |
| 91 return false; | 150 return false; |
| 92 } | 151 RenderFrameHost* rfh = ftn->current_frame_host(); |
| 93 | 152 |
| 94 observed_renderer_process_host_.Add(rvh->GetMainFrame()->GetProcess()); | 153 // Get notified if the target of the IPC message dies between responding. |
| 154 observed_renderer_process_host_.RemoveAll(); | |
| 155 observed_renderer_process_host_.Add(rfh->GetProcess()); | |
| 95 | 156 |
| 96 IPC::PlatformFileForTransit renderer_file = IPC::GetFileHandleForProcess( | 157 IPC::PlatformFileForTransit renderer_file = IPC::GetFileHandleForProcess( |
| 97 browser_file_.GetPlatformFile(), rvh->GetProcess()->GetHandle(), | 158 browser_file_.GetPlatformFile(), rfh->GetProcess()->GetHandle(), |
| 98 false); // |close_source_handle|. | 159 false); // |close_source_handle|. |
| 99 rvh->Send( | 160 rfh->Send(new FrameMsg_SerializeAsMHTML( |
| 100 new ViewMsg_SavePageAsMHTML(rvh->GetRoutingID(), job_id_, renderer_file)); | 161 rfh->GetRoutingID(), job_id_, renderer_file, mhtml_boundary_marker_, |
| 162 CreateFrameRoutingIdToContentId(rfh->GetSiteInstance()), is_last_frame)); | |
| 101 return true; | 163 return true; |
| 102 } | 164 } |
| 103 | 165 |
| 104 void MHTMLGenerationManager::Job::RenderProcessExited( | 166 void MHTMLGenerationManager::Job::RenderProcessExited( |
| 105 RenderProcessHost* host, | 167 RenderProcessHost* host, |
| 106 base::TerminationStatus status, | 168 base::TerminationStatus status, |
| 107 int exit_code) { | 169 int exit_code) { |
| 108 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 170 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 109 MHTMLGenerationManager::GetInstance()->RenderProcessExited(this); | 171 MHTMLGenerationManager::GetInstance()->RenderProcessExited(this); |
| 110 } | 172 } |
| 111 | 173 |
| 174 void MHTMLGenerationManager::Job::AddFrame(RenderFrameHost* render_frame_host) { | |
| 175 auto* rfhi = static_cast<RenderFrameHostImpl*>(render_frame_host); | |
|
Randy Smith (Not in Mondays)
2015/12/10 23:07:55
I just want to confirm that someone familiar with
lukasza
2015/12/11 00:29:02
Yup - that would be nick@. AFAIK the cast is ok w
| |
| 176 int frame_tree_node_id = rfhi->frame_tree_node()->frame_tree_node_id(); | |
| 177 pending_frame_tree_node_ids_.push(frame_tree_node_id); | |
| 178 | |
| 179 std::string guid = base::GenerateGUID(); | |
| 180 std::string content_id = base::StringPrintf("<frame-%d-%s@mhtml.blink>", | |
| 181 frame_tree_node_id, guid.c_str()); | |
| 182 frame_tree_node_to_content_id_[frame_tree_node_id] = content_id; | |
| 183 } | |
| 184 | |
| 112 void MHTMLGenerationManager::Job::RenderProcessHostDestroyed( | 185 void MHTMLGenerationManager::Job::RenderProcessHostDestroyed( |
| 113 RenderProcessHost* host) { | 186 RenderProcessHost* host) { |
| 114 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 187 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 115 observed_renderer_process_host_.Remove(host); | 188 observed_renderer_process_host_.Remove(host); |
| 116 } | 189 } |
| 117 | 190 |
| 118 void MHTMLGenerationManager::Job::CloseFile( | 191 void MHTMLGenerationManager::Job::CloseFile( |
| 119 base::Callback<void(int64)> callback) { | 192 base::Callback<void(int64)> callback) { |
| 120 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 193 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 121 | 194 |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 133 | 206 |
| 134 // static | 207 // static |
| 135 int64 MHTMLGenerationManager::Job::CloseFileOnFileThread(base::File file) { | 208 int64 MHTMLGenerationManager::Job::CloseFileOnFileThread(base::File file) { |
| 136 DCHECK_CURRENTLY_ON(BrowserThread::FILE); | 209 DCHECK_CURRENTLY_ON(BrowserThread::FILE); |
| 137 DCHECK(file.IsValid()); | 210 DCHECK(file.IsValid()); |
| 138 int64 file_size = file.GetLength(); | 211 int64 file_size = file.GetLength(); |
| 139 file.Close(); | 212 file.Close(); |
| 140 return file_size; | 213 return file_size; |
| 141 } | 214 } |
| 142 | 215 |
| 216 // static | |
| 217 std::string MHTMLGenerationManager::Job::GenerateMHTMLBoundaryMarker() { | |
|
Randy Smith (Not in Mondays)
2015/12/10 23:07:55
Do you need me to learn enough about MIME/MHTML to
lukasza
2015/12/11 00:29:03
I think this is fine as-is:
1. I copied it from th
| |
| 218 // TODO(lukasza): Introduce and use a shared helper function in | |
| 219 // net/base/mime_util.h instead of having the ad-hoc code below. | |
| 220 | |
| 221 // Trying to generate random boundaries similar to IE/UnMHT | |
| 222 // (ex: ----=_NextPart_000_001B_01CC157B.96F808A0). | |
| 223 uint8_t random_values[10]; | |
| 224 base::RandBytes(&random_values, sizeof(random_values)); | |
| 225 | |
| 226 std::string result("----=_NextPart_000_"); | |
| 227 result += base::HexEncode(random_values + 0, 2); | |
| 228 result += '_'; | |
| 229 result += base::HexEncode(random_values + 2, 4); | |
| 230 result += '.'; | |
| 231 result += base::HexEncode(random_values + 6, 4); | |
| 232 return result; | |
| 233 } | |
| 234 | |
| 143 MHTMLGenerationManager* MHTMLGenerationManager::GetInstance() { | 235 MHTMLGenerationManager* MHTMLGenerationManager::GetInstance() { |
| 144 return base::Singleton<MHTMLGenerationManager>::get(); | 236 return base::Singleton<MHTMLGenerationManager>::get(); |
| 145 } | 237 } |
| 146 | 238 |
| 147 MHTMLGenerationManager::MHTMLGenerationManager() : next_job_id_(0) {} | 239 MHTMLGenerationManager::MHTMLGenerationManager() : next_job_id_(0) {} |
| 148 | 240 |
| 149 MHTMLGenerationManager::~MHTMLGenerationManager() { | 241 MHTMLGenerationManager::~MHTMLGenerationManager() { |
| 150 STLDeleteValues(&id_to_job_); | 242 STLDeleteValues(&id_to_job_); |
| 151 } | 243 } |
| 152 | 244 |
| 153 void MHTMLGenerationManager::SaveMHTML(WebContents* web_contents, | 245 void MHTMLGenerationManager::SaveMHTML(WebContents* web_contents, |
| 154 const base::FilePath& file_path, | 246 const base::FilePath& file_path, |
| 155 const GenerateMHTMLCallback& callback) { | 247 const GenerateMHTMLCallback& callback) { |
| 156 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 248 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 157 | 249 |
| 158 int job_id = NewJob(web_contents, callback); | 250 int job_id = NewJob(web_contents, callback); |
| 159 | 251 |
| 160 BrowserThread::PostTaskAndReplyWithResult( | 252 BrowserThread::PostTaskAndReplyWithResult( |
| 161 BrowserThread::FILE, FROM_HERE, | 253 BrowserThread::FILE, FROM_HERE, |
| 162 base::Bind(&MHTMLGenerationManager::CreateFile, file_path), | 254 base::Bind(&MHTMLGenerationManager::CreateFile, file_path), |
| 163 base::Bind(&MHTMLGenerationManager::OnFileAvailable, | 255 base::Bind(&MHTMLGenerationManager::OnFileAvailable, |
| 164 base::Unretained(this), // Safe b/c |this| is a singleton. | 256 base::Unretained(this), // Safe b/c |this| is a singleton. |
| 165 job_id)); | 257 job_id)); |
| 166 } | 258 } |
| 167 | 259 |
| 168 void MHTMLGenerationManager::OnSavedPageAsMHTML( | 260 void MHTMLGenerationManager::OnSavedPageAsMHTML( |
|
Randy Smith (Not in Mondays)
2015/12/10 23:07:55
Hmmm. Given this change, I'm uncomfortable with t
lukasza
2015/12/11 00:29:02
Good catch. Yes - it should be "frame", not "page
| |
| 169 int job_id, | 261 int job_id, |
| 170 bool mhtml_generation_in_renderer_succeeded) { | 262 bool mhtml_generation_in_renderer_succeeded) { |
| 171 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 263 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 172 JobStatus job_status = mhtml_generation_in_renderer_succeeded | 264 |
| 173 ? JobStatus::SUCCESS | 265 if (!mhtml_generation_in_renderer_succeeded) { |
| 174 : JobStatus::FAILURE; | 266 JobFinished(job_id, JobStatus::FAILURE); |
| 175 JobFinished(job_id, job_status); | 267 return; |
| 268 } | |
| 269 | |
| 270 Job* job = FindJob(job_id); | |
| 271 if (!job) | |
| 272 return; | |
| 273 | |
| 274 if (job->HasMoreFramesToProcess()) { | |
| 275 if (!job->SendToNextRenderFrame()) { | |
| 276 JobFinished(job_id, JobStatus::FAILURE); | |
| 277 } | |
| 278 return; | |
| 279 } | |
| 280 | |
| 281 JobFinished(job_id, JobStatus::SUCCESS); | |
| 176 } | 282 } |
| 177 | 283 |
| 178 // static | 284 // static |
| 179 base::File MHTMLGenerationManager::CreateFile(const base::FilePath& file_path) { | 285 base::File MHTMLGenerationManager::CreateFile(const base::FilePath& file_path) { |
| 180 DCHECK_CURRENTLY_ON(BrowserThread::FILE); | 286 DCHECK_CURRENTLY_ON(BrowserThread::FILE); |
| 181 base::File browser_file( | 287 |
| 182 file_path, base::File::FLAG_CREATE_ALWAYS | base::File::FLAG_WRITE); | 288 // SECURITY NOTE: A file descriptor to the file created below will be passed |
| 289 // to multiple renderer processes which (in out-of-process iframes mode) can | |
| 290 // act on behalf of separate web principals. Therefore it is important to | |
| 291 // only allow writing to the file and forbid reading from the file (as this | |
| 292 // would allow reading content generated by other renderers / other web | |
| 293 // principals). | |
| 294 uint32 file_flags = base::File::FLAG_CREATE_ALWAYS | base::File::FLAG_WRITE; | |
|
Randy Smith (Not in Mondays)
2015/12/10 23:07:55
Can the renderer seek in the file? If it can, tha
lukasza
2015/12/11 00:29:02
Thank you for catching this. It does seem that ba
Randy Smith (Not in Mondays)
2015/12/14 02:47:04
Sounds good; I'm happy to leave that to you. I do
Łukasz Anforowicz
2015/12/14 18:08:42
I've removed FLAG_APPEND in the latest patchset.
| |
| 295 | |
| 296 base::File browser_file(file_path, file_flags); | |
| 183 if (!browser_file.IsValid()) { | 297 if (!browser_file.IsValid()) { |
| 184 LOG(ERROR) << "Failed to create file to save MHTML at: " << | 298 LOG(ERROR) << "Failed to create file to save MHTML at: " << |
| 185 file_path.value(); | 299 file_path.value(); |
| 186 } | 300 } |
| 187 return browser_file.Pass(); | 301 return browser_file.Pass(); |
| 188 } | 302 } |
| 189 | 303 |
| 190 void MHTMLGenerationManager::OnFileAvailable(int job_id, | 304 void MHTMLGenerationManager::OnFileAvailable(int job_id, |
| 191 base::File browser_file) { | 305 base::File browser_file) { |
| 192 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 306 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 193 | 307 |
| 194 if (!browser_file.IsValid()) { | 308 if (!browser_file.IsValid()) { |
| 195 LOG(ERROR) << "Failed to create file"; | 309 LOG(ERROR) << "Failed to create file"; |
| 196 JobFinished(job_id, JobStatus::FAILURE); | 310 JobFinished(job_id, JobStatus::FAILURE); |
| 197 return; | 311 return; |
| 198 } | 312 } |
| 199 | 313 |
| 200 Job* job = FindJob(job_id); | 314 Job* job = FindJob(job_id); |
| 201 if (!job) | 315 if (!job) |
| 202 return; | 316 return; |
| 203 | 317 |
| 204 job->set_browser_file(browser_file.Pass()); | 318 job->set_browser_file(browser_file.Pass()); |
| 205 | 319 |
| 206 if (!job->SendToRenderView()) { | 320 if (!job->SendToNextRenderFrame()) { |
| 207 JobFinished(job_id, JobStatus::FAILURE); | 321 JobFinished(job_id, JobStatus::FAILURE); |
| 208 } | 322 } |
| 209 } | 323 } |
| 210 | 324 |
| 211 void MHTMLGenerationManager::JobFinished(int job_id, JobStatus job_status) { | 325 void MHTMLGenerationManager::JobFinished(int job_id, JobStatus job_status) { |
| 212 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 326 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 213 | 327 |
| 214 Job* job = FindJob(job_id); | 328 Job* job = FindJob(job_id); |
| 215 if (!job) | 329 if (!job) |
| 216 return; | 330 return; |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 263 ++it) { | 377 ++it) { |
| 264 if (it->second == job) { | 378 if (it->second == job) { |
| 265 JobFinished(it->first, JobStatus::FAILURE); | 379 JobFinished(it->first, JobStatus::FAILURE); |
| 266 return; | 380 return; |
| 267 } | 381 } |
| 268 } | 382 } |
| 269 NOTREACHED(); | 383 NOTREACHED(); |
| 270 } | 384 } |
| 271 | 385 |
| 272 } // namespace content | 386 } // namespace content |
| OLD | NEW |