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

Unified Diff: third_party/WebKit/Source/web/WebFrameSerializer.cpp

Issue 2841223002: Add UMA for popup overlays removed from saved MHTML page (Closed)
Patch Set: Rebase Created 3 years, 8 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: third_party/WebKit/Source/web/WebFrameSerializer.cpp
diff --git a/third_party/WebKit/Source/web/WebFrameSerializer.cpp b/third_party/WebKit/Source/web/WebFrameSerializer.cpp
index 8dd4fd826ff07edc13d1bf0c8f2067da67d865fd..e5a0d1fce3f19fe0b1b51f532f1119134e0e52e5 100644
--- a/third_party/WebKit/Source/web/WebFrameSerializer.cpp
+++ b/third_party/WebKit/Source/web/WebFrameSerializer.cpp
@@ -87,6 +87,7 @@ class MHTMLFrameSerializerDelegate final : public FrameSerializer::Delegate {
public:
explicit MHTMLFrameSerializerDelegate(
WebFrameSerializer::MHTMLPartsGenerationDelegate&);
+ ~MHTMLFrameSerializerDelegate() override;
bool ShouldIgnoreElement(const Element&) override;
bool ShouldIgnoreAttribute(const Element&, const Attribute&) override;
bool RewriteLink(const Element&, String& rewritten_link) override;
@@ -105,11 +106,20 @@ class MHTMLFrameSerializerDelegate final : public FrameSerializer::Delegate {
Vector<Attribute>*);
WebFrameSerializer::MHTMLPartsGenerationDelegate& web_delegate_;
+ bool popup_overlays_skipped_;
};
MHTMLFrameSerializerDelegate::MHTMLFrameSerializerDelegate(
WebFrameSerializer::MHTMLPartsGenerationDelegate& web_delegate)
- : web_delegate_(web_delegate) {}
+ : web_delegate_(web_delegate), popup_overlays_skipped_(false) {}
+
+MHTMLFrameSerializerDelegate::~MHTMLFrameSerializerDelegate() {
+ if (web_delegate_.RemovePopupOverlay()) {
+ UMA_HISTOGRAM_BOOLEAN(
+ "PageSerialization.MhtmlGeneration.PopupOverlaySkipped",
+ popup_overlays_skipped_);
+ }
+}
bool MHTMLFrameSerializerDelegate::ShouldIgnoreElement(const Element& element) {
if (ShouldIgnoreHiddenElement(element))
@@ -170,6 +180,8 @@ bool MHTMLFrameSerializerDelegate::ShouldIgnorePopupOverlayElement(
if (box->Style()->ZIndex() < kPopupOverlayZIndexThreshold)
return false;
+ popup_overlays_skipped_ = true;
+
return true;
}
« no previous file with comments | « third_party/WebKit/Source/core/frame/FrameSerializer.h ('k') | third_party/WebKit/Source/web/tests/WebFrameSerializerTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698