Chromium Code Reviews| 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 706ed048be0bc05b8896f53f55c6d5bbc47dca72..8f906def4b0022d18f32f1a9ba200a6bc4dfb99d 100644 |
| --- a/third_party/WebKit/Source/web/WebFrameSerializer.cpp |
| +++ b/third_party/WebKit/Source/web/WebFrameSerializer.cpp |
| @@ -60,6 +60,7 @@ |
| #include "platform/wtf/HashMap.h" |
| #include "platform/wtf/HashSet.h" |
| #include "platform/wtf/Noncopyable.h" |
| +#include "platform/wtf/PtrUtil.h" |
| #include "platform/wtf/Vector.h" |
| #include "platform/wtf/text/StringConcatenate.h" |
| #include "public/platform/WebString.h" |
| @@ -73,6 +74,7 @@ |
| #include "public/web/WebFrameSerializerClient.h" |
| #include "web/WebFrameSerializerImpl.h" |
| #include "web/WebLocalFrameImpl.h" |
| +#include "web/WebPageProblemDetector.h" |
| #include "web/WebRemoteFrameImpl.h" |
| namespace blink { |
| @@ -95,6 +97,7 @@ class MHTMLFrameSerializerDelegate final : public FrameSerializer::Delegate { |
| bool ShouldSkipResource( |
| FrameSerializer::ResourceHasCacheControlNoStoreHeader) override; |
| Vector<Attribute> GetCustomAttributes(const Element&) override; |
| + void VisitNode(const Node*) override; |
| private: |
| bool ShouldIgnoreHiddenElement(const Element&); |
| @@ -107,11 +110,24 @@ class MHTMLFrameSerializerDelegate final : public FrameSerializer::Delegate { |
| WebFrameSerializer::MHTMLPartsGenerationDelegate& web_delegate_; |
| bool popup_overlays_skipped_; |
| + WebPageProblemDetectorCollection problem_detectors_; |
| }; |
| MHTMLFrameSerializerDelegate::MHTMLFrameSerializerDelegate( |
| WebFrameSerializer::MHTMLPartsGenerationDelegate& web_delegate) |
| - : web_delegate_(web_delegate), popup_overlays_skipped_(false) {} |
| + : web_delegate_(web_delegate), popup_overlays_skipped_(false) { |
| + if (web_delegate.UsePageProblemDetectors()) { |
| + std::unique_ptr<BlankPageDetector> blank_page_detector( |
|
Pete Williamson
2017/05/17 00:31:48
Let's get rid of the blank page detector for now,
romax
2017/05/17 22:28:19
Done.
|
| + new BlankPageDetector()); |
| + std::unique_ptr<MissingImageDetector> missing_image_detector( |
| + new MissingImageDetector()); |
| + std::unique_ptr<MissingCSSDetector> missing_css_detector( |
| + new MissingCSSDetector()); |
| + problem_detectors_.AddDetector(std::move(blank_page_detector)); |
| + problem_detectors_.AddDetector(std::move(missing_image_detector)); |
| + problem_detectors_.AddDetector(std::move(missing_css_detector)); |
| + } |
| +} |
| MHTMLFrameSerializerDelegate::~MHTMLFrameSerializerDelegate() { |
| if (web_delegate_.RemovePopupOverlay()) { |
| @@ -280,6 +296,10 @@ Vector<Attribute> MHTMLFrameSerializerDelegate::GetCustomAttributes( |
| return attributes; |
| } |
| +void MHTMLFrameSerializerDelegate::VisitNode(const Node* node) { |
| + problem_detectors_.VisitNode(node); |
| +} |
| + |
| void MHTMLFrameSerializerDelegate::GetCustomAttributesForImageElement( |
| const HTMLImageElement& element, |
| Vector<Attribute>* attributes) { |