Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2017 The Chromium Authors. All rights reserved. | |
|
fgorski
2017/03/28 17:01:12
nit: drop (c) from the whole patch.
Pete Williamson
2017/03/28 18:01:58
Done.
| |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CONTENT_BROWSER_DOWNLOAD_MHTML_EXTRA_DATA_IMPL_H_ | |
| 6 #define CONTENT_BROWSER_DOWNLOAD_MHTML_EXTRA_DATA_IMPL_H_ | |
| 7 | |
| 8 #include "content/public/browser/mhtml_extra_data.h" | |
| 9 | |
| 10 namespace content { | |
| 11 | |
| 12 // Data fields used to build an additional MHTML part in the output file. | |
| 13 struct MHTMLExtraDataPart { | |
| 14 std::string content_type; | |
| 15 std::string content_location; | |
| 16 std::string body; | |
| 17 }; | |
| 18 | |
| 19 // Class used as a data object for WebContents UserData to represent a MHTML | |
| 20 // part that we plan to write into the output MHTML file. Each MHTMLExtraPart | |
| 21 // object in the contained vector lets us hold enough information to generate | |
| 22 // one MHTML part. Arbitrary extra MHTML parts to be added into the complete | |
| 23 // file. For instance, this might be used for gathering load time signals in | |
| 24 // debug code for analysis. | |
| 25 class MHTMLExtraDataImpl : public content::MHTMLExtraData { | |
| 26 public: | |
| 27 MHTMLExtraDataImpl(); | |
| 28 ~MHTMLExtraDataImpl() override; | |
| 29 | |
| 30 // Return the vector of parts to be disassembled. | |
| 31 std::vector<MHTMLExtraDataPart>& parts() { return parts_; } | |
| 32 const std::vector<MHTMLExtraDataPart>& parts() const { return parts_; } | |
| 33 | |
| 34 // Add an extra MHTML part to the data structure stored by the WebContents. | |
| 35 // This will take care of generating the boundary line. This will also set | |
| 36 // the content-type and content-location headers to the values provided, and | |
| 37 // use the body provided. | |
| 38 void StashMHTMLPartForAdditionToPage(const std::string& content_type, | |
|
fgorski
2017/03/28 17:01:12
consider renaming to: AddExtraMHTMLPart() here and
Pete Williamson
2017/03/28 18:01:58
Done.
| |
| 39 const std::string& content_location, | |
| 40 const std::string& body) override; | |
| 41 | |
| 42 private: | |
| 43 std::vector<MHTMLExtraDataPart> parts_; | |
| 44 }; | |
| 45 | |
| 46 } // namespace content | |
| 47 | |
| 48 #endif // CONTENT_BROWSER_DOWNLOAD_MHTML_EXTRA_DATA_IMPL_H_ | |
| OLD | NEW |