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> | 7 #include <map> |
| 8 #include <queue> | 8 #include <queue> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 246 MhtmlSaveStatus MHTMLGenerationManager::Job::SendToNextRenderFrame() { | 246 MhtmlSaveStatus MHTMLGenerationManager::Job::SendToNextRenderFrame() { |
| 247 DCHECK(browser_file_.IsValid()); | 247 DCHECK(browser_file_.IsValid()); |
| 248 DCHECK(!pending_frame_tree_node_ids_.empty()); | 248 DCHECK(!pending_frame_tree_node_ids_.empty()); |
| 249 | 249 |
| 250 FrameMsg_SerializeAsMHTML_Params ipc_params; | 250 FrameMsg_SerializeAsMHTML_Params ipc_params; |
| 251 ipc_params.job_id = job_id_; | 251 ipc_params.job_id = job_id_; |
| 252 ipc_params.mhtml_boundary_marker = mhtml_boundary_marker_; | 252 ipc_params.mhtml_boundary_marker = mhtml_boundary_marker_; |
| 253 ipc_params.mhtml_binary_encoding = params_.use_binary_encoding; | 253 ipc_params.mhtml_binary_encoding = params_.use_binary_encoding; |
| 254 ipc_params.mhtml_cache_control_policy = params_.cache_control_policy; | 254 ipc_params.mhtml_cache_control_policy = params_.cache_control_policy; |
| 255 ipc_params.mhtml_popup_overlay_removal = params_.remove_popup_overlay; | 255 ipc_params.mhtml_popup_overlay_removal = params_.remove_popup_overlay; |
| 256 ipc_params.mhtml_problem_detection = params_.use_page_problem_detectors; | |
| 256 | 257 |
| 257 int frame_tree_node_id = pending_frame_tree_node_ids_.front(); | 258 int frame_tree_node_id = pending_frame_tree_node_ids_.front(); |
| 258 pending_frame_tree_node_ids_.pop(); | 259 pending_frame_tree_node_ids_.pop(); |
| 259 | 260 |
| 260 FrameTreeNode* ftn = FrameTreeNode::GloballyFindByID(frame_tree_node_id); | 261 FrameTreeNode* ftn = FrameTreeNode::GloballyFindByID(frame_tree_node_id); |
| 261 if (!ftn) // The contents went away. | 262 if (!ftn) // The contents went away. |
| 262 return MhtmlSaveStatus::FRAME_NO_LONGER_EXISTS; | 263 return MhtmlSaveStatus::FRAME_NO_LONGER_EXISTS; |
| 263 RenderFrameHost* rfh = ftn->current_frame_host(); | 264 RenderFrameHost* rfh = ftn->current_frame_host(); |
| 264 | 265 |
| 265 // Get notified if the target of the IPC message dies between responding. | 266 // Get notified if the target of the IPC message dies between responding. |
| (...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 601 // SECURITY NOTE: A file descriptor to the file created below will be passed | 602 // SECURITY NOTE: A file descriptor to the file created below will be passed |
| 602 // to multiple renderer processes which (in out-of-process iframes mode) can | 603 // to multiple renderer processes which (in out-of-process iframes mode) can |
| 603 // act on behalf of separate web principals. Therefore it is important to | 604 // act on behalf of separate web principals. Therefore it is important to |
| 604 // only allow writing to the file and forbid reading from the file (as this | 605 // only allow writing to the file and forbid reading from the file (as this |
| 605 // would allow reading content generated by other renderers / other web | 606 // would allow reading content generated by other renderers / other web |
| 606 // principals). | 607 // principals). |
| 607 uint32_t file_flags = base::File::FLAG_CREATE_ALWAYS | base::File::FLAG_WRITE; | 608 uint32_t file_flags = base::File::FLAG_CREATE_ALWAYS | base::File::FLAG_WRITE; |
| 608 | 609 |
| 609 base::File browser_file(file_path, file_flags); | 610 base::File browser_file(file_path, file_flags); |
| 610 if (!browser_file.IsValid()) { | 611 if (!browser_file.IsValid()) { |
| 611 LOG(ERROR) << "Failed to create file to save MHTML at: " << | 612 LOG(ERROR) << "Failed to create file to save MHTML at: " |
| 612 file_path.value(); | 613 << file_path.value(); |
|
romax
2017/05/27 01:00:04
'git cl format' change.
| |
| 613 } | 614 } |
| 614 return browser_file; | 615 return browser_file; |
| 615 } | 616 } |
| 616 | 617 |
| 617 void MHTMLGenerationManager::OnFileAvailable(int job_id, | 618 void MHTMLGenerationManager::OnFileAvailable(int job_id, |
| 618 base::File browser_file) { | 619 base::File browser_file) { |
| 619 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 620 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 620 | 621 |
| 621 Job* job = FindJob(job_id); | 622 Job* job = FindJob(job_id); |
| 622 DCHECK(job); | 623 DCHECK(job); |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 690 return iter->second.get(); | 691 return iter->second.get(); |
| 691 } | 692 } |
| 692 | 693 |
| 693 void MHTMLGenerationManager::RenderProcessExited(Job* job) { | 694 void MHTMLGenerationManager::RenderProcessExited(Job* job) { |
| 694 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 695 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 695 DCHECK(job); | 696 DCHECK(job); |
| 696 JobFinished(job, MhtmlSaveStatus::RENDER_PROCESS_EXITED); | 697 JobFinished(job, MhtmlSaveStatus::RENDER_PROCESS_EXITED); |
| 697 } | 698 } |
| 698 | 699 |
| 699 } // namespace content | 700 } // namespace content |
| OLD | NEW |