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

Unified Diff: components/dom_distiller/content/renderer/distillability_agent.cc

Issue 1891643002: Reader Mode distillability uses Mojo (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add web contents check Created 4 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
« no previous file with comments | « components/dom_distiller/content/renderer/BUILD.gn ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/dom_distiller/content/renderer/distillability_agent.cc
diff --git a/components/dom_distiller/content/renderer/distillability_agent.cc b/components/dom_distiller/content/renderer/distillability_agent.cc
index 93e37361d9f0b01d1a066909ba08a7e9e5508cb3..a3119f469ccbb831763783ba317ee7aeb9ec2fcc 100644
--- a/components/dom_distiller/content/renderer/distillability_agent.cc
+++ b/components/dom_distiller/content/renderer/distillability_agent.cc
@@ -3,13 +3,15 @@
// found in the LICENSE file.
#include "base/metrics/histogram.h"
+#include "base/strings/string_util.h"
-#include "components/dom_distiller/content/common/distiller_messages.h"
+#include "components/dom_distiller/content/common/distillability_service.mojom.h"
#include "components/dom_distiller/content/renderer/distillability_agent.h"
#include "components/dom_distiller/core/distillable_page_detector.h"
#include "components/dom_distiller/core/experiments.h"
#include "components/dom_distiller/core/page_features.h"
#include "components/dom_distiller/core/url_utils.h"
+#include "content/public/common/service_registry.h"
#include "content/public/renderer/render_frame.h"
#include "third_party/WebKit/public/platform/WebDistillability.h"
@@ -146,11 +148,15 @@ void DistillabilityAgent::DidMeaningfulLayout(
if (!NeedToUpdate(is_loaded)) return;
bool is_last = IsLast(is_loaded);
- Send(new FrameHostMsg_Distillability(routing_id(),
- IsDistillablePage(doc, is_last), is_last));
+ // Connect to Mojo service on browser to notify page distillability.
+ DistillabilityServicePtr distillability_service;
+ render_frame()->GetServiceRegistry()->ConnectToRemoteService(
+ mojo::GetProxy(&distillability_service));
+ DCHECK(distillability_service);
+ distillability_service->NotifyIsDistillable(
+ IsDistillablePage(doc, is_last), is_last);
}
-
DistillabilityAgent::~DistillabilityAgent() {}
} // namespace dom_distiller
« no previous file with comments | « components/dom_distiller/content/renderer/BUILD.gn ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698