Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | |
| 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_PARTS_IMPL_H_ | |
| 6 #define CONTENT_BROWSER_DOWNLOAD_MHTML_EXTRA_PARTS_IMPL_H_ | |
| 7 | |
| 8 #include "content/public/browser/mhtml_extra_parts.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. This allows arbitrary extra MHTML parts to be added into the | |
| 23 // complete file. For instance, this might be used for gathering load time | |
| 24 // signals in debug code for analysis. | |
| 25 class MHTMLExtraPartsImpl : public content::MHTMLExtraParts { | |
| 26 public: | |
| 27 MHTMLExtraPartsImpl(); | |
| 28 ~MHTMLExtraPartsImpl() override; | |
| 29 | |
| 30 // Return the vector of parts to be serialized. | |
| 31 std::vector<MHTMLExtraDataPart>& parts() { return parts_; } | |
|
Dmitry Titov
2017/03/29 23:26:29
It's weird to have both methods like this. There s
Pete Williamson
2017/03/31 00:29:49
The test needs the writeable version of parts(), s
Dmitry Titov
2017/03/31 18:05:53
What test is using it? I don't see.
Pete Williamson
2017/03/31 21:58:03
Ah, sorry, it looks like that test got refactored
| |
| 32 const std::vector<MHTMLExtraDataPart>& parts() const { return parts_; } | |
| 33 | |
| 34 // Creates a MHTMLExtraDataPart and adds it to our vector of parts. | |
| 35 void AddExtraMHTMLPart(const std::string& content_type, | |
| 36 const std::string& content_location, | |
| 37 const std::string& body) override; | |
| 38 | |
| 39 private: | |
| 40 std::vector<MHTMLExtraDataPart> parts_; | |
| 41 }; | |
| 42 | |
| 43 } // namespace content | |
| 44 | |
| 45 #endif // CONTENT_BROWSER_DOWNLOAD_MHTML_EXTRA_PARTS_IMPL_H_ | |
| OLD | NEW |