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

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

Issue 2079943002: Change RenderFrame to use InterfaceRegistry et al. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@a2
Patch Set: . Created 4 years, 6 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
1 // Copyright 2015 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/metrics/histogram.h" 5 #include "base/metrics/histogram.h"
6 #include "base/strings/string_util.h" 6 #include "base/strings/string_util.h"
7 7
8 #include "components/dom_distiller/content/common/distillability_service.mojom.h " 8 #include "components/dom_distiller/content/common/distillability_service.mojom.h "
9 #include "components/dom_distiller/content/renderer/distillability_agent.h" 9 #include "components/dom_distiller/content/renderer/distillability_agent.h"
10 #include "components/dom_distiller/core/distillable_page_detector.h" 10 #include "components/dom_distiller/core/distillable_page_detector.h"
11 #include "components/dom_distiller/core/experiments.h" 11 #include "components/dom_distiller/core/experiments.h"
12 #include "components/dom_distiller/core/page_features.h" 12 #include "components/dom_distiller/core/page_features.h"
13 #include "components/dom_distiller/core/url_utils.h" 13 #include "components/dom_distiller/core/url_utils.h"
14 #include "content/public/common/service_registry.h"
15 #include "content/public/renderer/render_frame.h" 14 #include "content/public/renderer/render_frame.h"
16 15 #include "services/shell/public/cpp/interface_provider.h"
17 #include "third_party/WebKit/public/platform/WebDistillability.h" 16 #include "third_party/WebKit/public/platform/WebDistillability.h"
18 #include "third_party/WebKit/public/web/WebDocument.h" 17 #include "third_party/WebKit/public/web/WebDocument.h"
19 #include "third_party/WebKit/public/web/WebElement.h" 18 #include "third_party/WebKit/public/web/WebElement.h"
20 #include "third_party/WebKit/public/web/WebLocalFrame.h" 19 #include "third_party/WebKit/public/web/WebLocalFrame.h"
21 20
22 namespace dom_distiller { 21 namespace dom_distiller {
23 22
24 using namespace blink; 23 using namespace blink;
25 24
26 namespace { 25 namespace {
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 WebDocument doc = render_frame()->GetWebFrame()->document(); 193 WebDocument doc = render_frame()->GetWebFrame()->document();
195 if (doc.isNull() || doc.body().isNull()) return; 194 if (doc.isNull() || doc.body().isNull()) return;
196 if (!url_utils::IsUrlDistillable(doc.url())) return; 195 if (!url_utils::IsUrlDistillable(doc.url())) return;
197 196
198 bool is_loaded = layout_type == WebMeaningfulLayout::FinishedLoading; 197 bool is_loaded = layout_type == WebMeaningfulLayout::FinishedLoading;
199 if (!NeedToUpdate(is_loaded)) return; 198 if (!NeedToUpdate(is_loaded)) return;
200 199
201 bool is_last = IsLast(is_loaded); 200 bool is_last = IsLast(is_loaded);
202 // Connect to Mojo service on browser to notify page distillability. 201 // Connect to Mojo service on browser to notify page distillability.
203 mojom::DistillabilityServicePtr distillability_service; 202 mojom::DistillabilityServicePtr distillability_service;
204 render_frame()->GetServiceRegistry()->ConnectToRemoteService( 203 render_frame()->GetRemoteInterfaces()->GetInterface(
205 mojo::GetProxy(&distillability_service)); 204 &distillability_service);
206 DCHECK(distillability_service); 205 DCHECK(distillability_service);
207 distillability_service->NotifyIsDistillable( 206 distillability_service->NotifyIsDistillable(
208 IsDistillablePage(doc, is_last), is_last); 207 IsDistillablePage(doc, is_last), is_last);
209 } 208 }
210 209
211 DistillabilityAgent::~DistillabilityAgent() {} 210 DistillabilityAgent::~DistillabilityAgent() {}
212 211
213 void DistillabilityAgent::OnDestruct() { 212 void DistillabilityAgent::OnDestruct() {
214 delete this; 213 delete this;
215 } 214 }
216 215
217 } // namespace dom_distiller 216 } // namespace dom_distiller
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698