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 an 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 const std::vector<MHTMLExtraDataPart>& parts() const { return parts_; } |
| 32 |
| 33 // Return the number of extra parts added. |
| 34 int64_t size() override; |
| 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 |