OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "components/dom_distiller/content/common/distiller_messages.h" |
| 6 #include "components/dom_distiller/content/renderer/distillability_agent.h" |
| 7 |
| 8 #include "content/public/renderer/render_frame.h" |
| 9 |
| 10 #include "third_party/WebKit/public/platform/WebDistillability.h" |
| 11 #include "third_party/WebKit/public/web/WebDocument.h" |
| 12 #include "third_party/WebKit/public/web/WebElement.h" |
| 13 #include "third_party/WebKit/public/web/WebLocalFrame.h" |
| 14 #include "third_party/WebKit/public/web/WebNode.h" |
| 15 #include "third_party/WebKit/public/web/WebNodeList.h" |
| 16 |
| 17 namespace dom_distiller { |
| 18 |
| 19 namespace { |
| 20 |
| 21 } // namespace |
| 22 |
| 23 using namespace blink; |
| 24 |
| 25 DistillabilityAgent::DistillabilityAgent( |
| 26 content::RenderFrame* render_frame) |
| 27 : RenderFrameObserver(render_frame) { |
| 28 } |
| 29 |
| 30 void DistillabilityAgent::DidMeaningfulLayout( |
| 31 WebMeaningfulLayout layout_type) { |
| 32 |
| 33 if (layout_type == WebMeaningfulLayout::FinishedParsing || |
| 34 layout_type == WebMeaningfulLayout::FinishedLoading) { |
| 35 DCHECK(render_frame()); |
| 36 DCHECK(render_frame()->GetWebFrame()); |
| 37 WebDocument doc = render_frame()->GetWebFrame()->document(); |
| 38 DCHECK(!doc.isNull()); |
| 39 WebDistillabilityFeatures features = doc.distillabilityFeatures(); |
| 40 |
| 41 // FIXME: get flags, model, derived features, and calculate results |
| 42 Send(new FrameHostMsg_Distillability(routing_id(), features.openGraph)); |
| 43 } |
| 44 } |
| 45 |
| 46 DistillabilityAgent::~DistillabilityAgent() {} |
| 47 |
| 48 } // namespace dom_distiller |
OLD | NEW |