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_PUBLIC_BROWSER_MHTML_EXTRA_PARTS_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_MHTML_EXTRA_PARTS_H_ |
6 #define CONTENT_PUBLIC_BROWSER_MHTML_EXTRA_PARTS_H_ | 6 #define CONTENT_PUBLIC_BROWSER_MHTML_EXTRA_PARTS_H_ |
7 | 7 |
8 #include "base/supports_user_data.h" | 8 #include "base/supports_user_data.h" |
9 #include "content/public/browser/web_contents.h" | 9 #include "content/public/browser/web_contents.h" |
10 | 10 |
11 namespace content { | 11 namespace content { |
12 | 12 |
13 // Interface class for adding an extra part to MHTML when doing MHTML | 13 // Interface class for adding an extra part to MHTML when doing MHTML |
14 // generation. To use it, get it from the web contents with FromWebContents, | 14 // generation. To use it, get it from the web contents with FromWebContents, |
15 // then call AddExtraMHTMLPart to add a new part. | 15 // then call AddExtraMHTMLPart to add a new part. |
16 class CONTENT_EXPORT MHTMLExtraParts : public base::SupportsUserData::Data { | 16 class CONTENT_EXPORT MHTMLExtraParts : public base::SupportsUserData::Data { |
17 public: | 17 public: |
18 // Retrieves the extra data from the web contents. | 18 // Retrieves the extra data from the web contents. |
19 static MHTMLExtraParts* FromWebContents(WebContents* contents); | 19 static MHTMLExtraParts* FromWebContents(WebContents* contents); |
20 | 20 |
21 // Add an extra MHTML part to the data structure stored by the WebContents. | 21 // Add an extra MHTML part to the data structure stored by the WebContents. |
22 // This will take care of generating the boundary line. This will also set | 22 // This will take care of generating the boundary line. This will also set |
23 // the content-type and content-location headers to the values provided, and | 23 // the content-type and content-location headers to the values provided, and |
24 // use the body provided. | 24 // use the body provided. |
25 virtual void AddExtraMHTMLPart(const std::string& content_type, | 25 virtual void AddExtraMHTMLPart(const std::string& content_type, |
26 const std::string& content_location, | 26 const std::string& content_location, |
| 27 const std::string& extra_headers, |
27 const std::string& body) = 0; | 28 const std::string& body) = 0; |
28 | 29 |
29 // Returns the number of extra parts added. | 30 // Returns the number of extra parts added. |
30 virtual int64_t size() = 0; | 31 virtual int64_t size() = 0; |
31 }; | 32 }; |
32 | 33 |
33 } // namespace content | 34 } // namespace content |
34 | 35 |
35 #endif // CONTENT_PUBLIC_BROWSER_MHTML_EXTRA_DATA_H_ | 36 #endif // CONTENT_PUBLIC_BROWSER_MHTML_EXTRA_DATA_H_ |
OLD | NEW |