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 | |
|
fgorski
2017/04/05 18:59:12
nit: an MHTML
Pete Williamson
2017/04/05 22:11:30
Done.
| |
| 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 const std::vector<MHTMLExtraDataPart>& parts() const { return parts_; } | |
| 32 | |
| 33 // Return the number of extra parts added. | |
| 34 int64_t size() override; | |
|
fgorski
2017/04/05 18:59:12
Could you make this one const as well? Here and in
Pete Williamson
2017/04/05 22:11:30
Changing this to const produces a build error:
er
fgorski
2017/04/05 22:42:38
Acknowledged. Good point. I blanked on return type
| |
| 35 | |
| 36 // Creates a MHTMLExtraDataPart and adds it to our vector of parts. | |
| 37 void AddExtraMHTMLPart(const std::string& content_type, | |
| 38 const std::string& content_location, | |
| 39 const std::string& body) override; | |
| 40 | |
| 41 private: | |
| 42 std::vector<MHTMLExtraDataPart> parts_; | |
| 43 }; | |
| 44 | |
| 45 } // namespace content | |
| 46 | |
| 47 #endif // CONTENT_BROWSER_DOWNLOAD_MHTML_EXTRA_PARTS_IMPL_H_ | |
| OLD | NEW |