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

Side by Side Diff: components/dom_distiller/content/renderer/distillability_agent.cc

Issue 1248643004: Test distillability without JavaScript (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@early
Patch Set: fix oopsies Created 5 years, 2 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 unified diff | Download patch
OLDNEW
(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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698