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

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

Issue 2827503002: Add extra headers argument so we don't pass headers in the body. (Closed)
Patch Set: Created 3 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
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 <map> 7 #include <map>
8 #include <queue> 8 #include <queue>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after
480 480
481 const std::vector<MHTMLExtraDataPart>& extra_data_parts(extra_parts->parts()); 481 const std::vector<MHTMLExtraDataPart>& extra_data_parts(extra_parts->parts());
482 if (extra_data_parts.empty()) 482 if (extra_data_parts.empty())
483 return true; 483 return true;
484 484
485 std::string serialized_extra_data_parts; 485 std::string serialized_extra_data_parts;
486 486
487 // For each extra part, serialize that part and add to our accumulator 487 // For each extra part, serialize that part and add to our accumulator
488 // string. 488 // string.
489 for (auto part : extra_data_parts) { 489 for (auto part : extra_data_parts) {
490 // Write a newline, then a boundary, another newline, then the content 490 // Write a newline, then a boundary, a newline, then the content
491 // location, another newline, the content type, another newline, the another 491 // location, a newline, the content type, a newline, extra_headers,
492 // newline, the extra data string, and end with a newline. 492 // two newlines, the body, and end with a newline.
493 std::string serialized_extra_data_part = base::StringPrintf( 493 std::string serialized_extra_data_part = base::StringPrintf(
494 "--%s\r\n%s%s\r\n%s%s\r\n%s\r\n", boundary.c_str(), kContentLocation, 494 "--%s\r\n%s%s\r\n%s%s\r\n%s\r\n\r\n%s\r\n", boundary.c_str(),
495 part.content_location.c_str(), kContentType, part.content_type.c_str(), 495 kContentLocation, part.content_location.c_str(), kContentType,
496 part.content_type.c_str(), part.extra_headers.c_str(),
496 part.body.c_str()); 497 part.body.c_str());
497 DCHECK(base::IsStringASCII(serialized_extra_data_part)); 498 DCHECK(base::IsStringASCII(serialized_extra_data_part));
498 499
499 serialized_extra_data_parts += serialized_extra_data_part; 500 serialized_extra_data_parts += serialized_extra_data_part;
500 } 501 }
501 502
502 // Write the string into the file. Returns false if we failed the write. 503 // Write the string into the file. Returns false if we failed the write.
503 return (file.WriteAtCurrentPos(serialized_extra_data_parts.data(), 504 return (file.WriteAtCurrentPos(serialized_extra_data_parts.data(),
504 serialized_extra_data_parts.size()) >= 0); 505 serialized_extra_data_parts.size()) >= 0);
505 } 506 }
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
689 return iter->second.get(); 690 return iter->second.get();
690 } 691 }
691 692
692 void MHTMLGenerationManager::RenderProcessExited(Job* job) { 693 void MHTMLGenerationManager::RenderProcessExited(Job* job) {
693 DCHECK_CURRENTLY_ON(BrowserThread::UI); 694 DCHECK_CURRENTLY_ON(BrowserThread::UI);
694 DCHECK(job); 695 DCHECK(job);
695 JobFinished(job, MhtmlSaveStatus::RENDER_PROCESS_EXITED); 696 JobFinished(job, MhtmlSaveStatus::RENDER_PROCESS_EXITED);
696 } 697 }
697 698
698 } // namespace content 699 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/download/mhtml_generation_browsertest.cc ('k') | content/public/browser/mhtml_extra_parts.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698