| Index: content/browser/download/mhtml_generation_manager.h
|
| diff --git a/content/browser/download/mhtml_generation_manager.h b/content/browser/download/mhtml_generation_manager.h
|
| index e30001535b03735758e09f2734d69ce5cd1c03d7..66c9e405964355c2c92f2f30f5fdde4f68d83537 100644
|
| --- a/content/browser/download/mhtml_generation_manager.h
|
| +++ b/content/browser/download/mhtml_generation_manager.h
|
| @@ -15,7 +15,9 @@
|
| #include "base/macros.h"
|
| #include "base/memory/singleton.h"
|
| #include "base/process/process.h"
|
| +#include "base/supports_user_data.h"
|
| #include "content/common/download/mhtml_save_status.h"
|
| +#include "content/public/browser/web_contents.h"
|
| #include "content/public/common/mhtml_generation_params.h"
|
| #include "ipc/ipc_platform_file.h"
|
|
|
| @@ -34,7 +36,7 @@ class WebContents;
|
| // MHTMLGenerationManager is a singleton. Each call to SaveMHTML method creates
|
| // a new instance of MHTMLGenerationManager::Job that tracks generation of a
|
| // single MHTML file.
|
| -class MHTMLGenerationManager {
|
| +class CONTENT_EXPORT MHTMLGenerationManager {
|
| public:
|
| static MHTMLGenerationManager* GetInstance();
|
|
|
| @@ -58,6 +60,39 @@ class MHTMLGenerationManager {
|
| const std::set<std::string>& digests_of_uris_of_serialized_resources,
|
| base::TimeDelta renderer_main_thread_time);
|
|
|
| + // Contained class that represents an extra data part. With the addition of
|
| + // the MHTMLExtraData class, we can add enough information to create an extra
|
| + // MHTML part to be added into the complete file. For instance, this might
|
| + // be used for gathering load time signals in debug code for analysis, but
|
| + // the mechanism is fairly general, and could be used to add arbitrary parts.
|
| + // Specify the content type, content location, and body, and the methods in
|
| + // MHTMLExtraData will do the rest.
|
| + struct MHTMLExtraPart {
|
| + std::string content_type;
|
| + std::string content_location;
|
| + std::string body;
|
| + };
|
| +
|
| + // Helper class to put extra parts into the WebContents user data, and take
|
| + // them back out again.
|
| + class MHTMLExtraData : public base::SupportsUserData::Data {
|
| + public:
|
| + MHTMLExtraData();
|
| + ~MHTMLExtraData() override;
|
| +
|
| + // Get the data string out of the web contents. The web contents retains
|
| + // ownership of the vector. Returns nullptr if none found.
|
| + static std::vector<MHTMLExtraPart>* FromWebContents(
|
| + content::WebContents* contents);
|
| +
|
| + // Add the extra part to the data structure stored by the WebContents.
|
| + static void AddPartToWebContents(content::WebContents* contents,
|
| + MHTMLExtraPart& part);
|
| +
|
| + private:
|
| + std::vector<MHTMLExtraPart> parts_;
|
| + };
|
| +
|
| private:
|
| friend struct base::DefaultSingletonTraits<MHTMLGenerationManager>;
|
| class Job;
|
|
|