Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1054)

Unified Diff: content/browser/download/mhtml_extra_data_impl.h

Issue 2683493002: Get signals working in the EXTRA_DATA section of MHTML (Closed)
Patch Set: CR Feedback per FGorski Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/download/mhtml_extra_data_impl.h
diff --git a/content/browser/download/mhtml_extra_data_impl.h b/content/browser/download/mhtml_extra_data_impl.h
new file mode 100644
index 0000000000000000000000000000000000000000..f971cdede9cd86bd96bee227977f0323d3ff8172
--- /dev/null
+++ b/content/browser/download/mhtml_extra_data_impl.h
@@ -0,0 +1,44 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CONTENT_BROWSER_DOWNLOAD_MHTML_EXTRA_DATA_IMPL_H_
+#define CONTENT_BROWSER_DOWNLOAD_MHTML_EXTRA_DATA_IMPL_H_
+
+#include "content/public/browser/mhtml_extra_data.h"
+
+namespace content {
+
+// Data fields used to build an additional MHTML part in the output file.
+struct MHTMLExtraDataPart {
+ std::string content_type;
+ std::string content_location;
+ std::string body;
+};
+
+// Class used as a data object for WebContents UserData to represent a MHTML
+// part that we plan to write into the output MHTML file. Each MHTMLExtraPart
+// object in the contained vector lets us hold enough information to generate
+// one MHTML part. Arbitrary extra MHTML parts to be added into the complete
Dmitry Titov 2017/03/29 18:53:06 incomplete sentence...
Pete Williamson 2017/03/29 22:05:42 Done.
+// file. For instance, this might be used for gathering load time signals in
+// debug code for analysis.
+class MHTMLExtraDataImpl : public content::MHTMLExtraData {
+ public:
+ MHTMLExtraDataImpl();
+ ~MHTMLExtraDataImpl() override;
+
+ // Return the vector of parts to be disassembled.
Dmitry Titov 2017/03/29 18:53:06 disassembled?
Pete Williamson 2017/03/29 22:05:42 Oops, serialized. Fixed.
+ std::vector<MHTMLExtraDataPart>& parts() { return parts_; }
+ const std::vector<MHTMLExtraDataPart>& parts() const { return parts_; }
+
+ void AddExtraMHTMLPart(const std::string& content_type,
Dmitry Titov 2017/03/29 18:53:06 This shoudl have a comment saying it's implementat
Pete Williamson 2017/03/29 22:05:42 I don't think I understood your suggestion, but I
+ const std::string& content_location,
+ const std::string& body) override;
+
+ private:
+ std::vector<MHTMLExtraDataPart> parts_;
+};
+
+} // namespace content
+
+#endif // CONTENT_BROWSER_DOWNLOAD_MHTML_EXTRA_DATA_IMPL_H_

Powered by Google App Engine
This is Rietveld 408576698