OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 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 | 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 #ifndef CONTENT_BROWSER_DOWNLOAD_MHTML_EXTRA_PARTS_IMPL_H_ | 5 #ifndef CONTENT_BROWSER_DOWNLOAD_MHTML_EXTRA_PARTS_IMPL_H_ |
6 #define CONTENT_BROWSER_DOWNLOAD_MHTML_EXTRA_PARTS_IMPL_H_ | 6 #define CONTENT_BROWSER_DOWNLOAD_MHTML_EXTRA_PARTS_IMPL_H_ |
7 | 7 |
8 #include "content/public/browser/mhtml_extra_parts.h" | 8 #include "content/public/browser/mhtml_extra_parts.h" |
9 | 9 |
10 namespace content { | 10 namespace content { |
11 | 11 |
12 // Data fields used to build an additional MHTML part in the output file. | 12 // Data fields used to build an additional MHTML part in the output file. |
13 struct MHTMLExtraDataPart { | 13 struct MHTMLExtraDataPart { |
14 std::string content_type; | 14 std::string content_type; |
15 std::string content_location; | 15 std::string content_location; |
| 16 std::string extra_headers; |
16 std::string body; | 17 std::string body; |
| 18 |
| 19 MHTMLExtraDataPart(); |
| 20 ~MHTMLExtraDataPart(); |
| 21 MHTMLExtraDataPart(const MHTMLExtraDataPart& other); |
17 }; | 22 }; |
18 | 23 |
19 // Class used as a data object for WebContents UserData to represent an MHTML | 24 // 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 | 25 // 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 | 26 // 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 | 27 // 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 | 28 // complete file. For instance, this might be used for gathering load time |
24 // signals in debug code for analysis. | 29 // signals in debug code for analysis. |
25 class MHTMLExtraPartsImpl : public content::MHTMLExtraParts { | 30 class MHTMLExtraPartsImpl : public content::MHTMLExtraParts { |
26 public: | 31 public: |
27 MHTMLExtraPartsImpl(); | 32 MHTMLExtraPartsImpl(); |
28 ~MHTMLExtraPartsImpl() override; | 33 ~MHTMLExtraPartsImpl() override; |
29 | 34 |
30 // Return the vector of parts to be serialized. | 35 // Return the vector of parts to be serialized. |
31 const std::vector<MHTMLExtraDataPart>& parts() const { return parts_; } | 36 const std::vector<MHTMLExtraDataPart>& parts() const { return parts_; } |
32 | 37 |
33 // Return the number of extra parts added. | 38 // Return the number of extra parts added. |
34 int64_t size() override; | 39 int64_t size() override; |
35 | 40 |
36 // Creates a MHTMLExtraDataPart and adds it to our vector of parts. | 41 // Creates a MHTMLExtraDataPart and adds it to our vector of parts. |
37 void AddExtraMHTMLPart(const std::string& content_type, | 42 void AddExtraMHTMLPart(const std::string& content_type, |
38 const std::string& content_location, | 43 const std::string& content_location, |
| 44 const std::string& extra_headers, |
39 const std::string& body) override; | 45 const std::string& body) override; |
40 | 46 |
41 private: | 47 private: |
42 std::vector<MHTMLExtraDataPart> parts_; | 48 std::vector<MHTMLExtraDataPart> parts_; |
43 }; | 49 }; |
44 | 50 |
45 } // namespace content | 51 } // namespace content |
46 | 52 |
47 #endif // CONTENT_BROWSER_DOWNLOAD_MHTML_EXTRA_PARTS_IMPL_H_ | 53 #endif // CONTENT_BROWSER_DOWNLOAD_MHTML_EXTRA_PARTS_IMPL_H_ |
OLD | NEW |