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

Unified Diff: components/dom_distiller/content/browser/distillability_driver.cc

Issue 1883023004: Reader Mode triggers after tab crash (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@distillability-mojo
Patch Set: 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/browser/distillability_driver.h ('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/browser/distillability_driver.cc
diff --git a/components/dom_distiller/content/browser/distillability_driver.cc b/components/dom_distiller/content/browser/distillability_driver.cc
index 5154f1eccba6d8e3b634abb7714def94e633ca74..842b98d908af0b0a5e9cec4666c079a3cd949fa5 100644
--- a/components/dom_distiller/content/browser/distillability_driver.cc
+++ b/components/dom_distiller/content/browser/distillability_driver.cc
@@ -40,14 +40,13 @@ DistillabilityDriver::DistillabilityDriver(
content::WebContents* web_contents)
: content::WebContentsObserver(web_contents),
weak_factory_(this) {
- if (!web_contents) return;
- web_contents->GetMainFrame()->GetServiceRegistry()->AddService(
- base::Bind(&DistillabilityDriver::CreateDistillabilityService,
- weak_factory_.GetWeakPtr()));
+ SetupMojoService();
}
DistillabilityDriver::~DistillabilityDriver() {
- CleanUp();
+ web_contents()->GetMainFrame()->GetServiceRegistry()
+ ->RemoveService<DistillabilityService>();
+ content::WebContentsObserver::Observe(NULL);
wychen 2016/04/14 20:41:25 nit: nullptr It's my fault though.
mdjones 2016/04/15 00:29:45 Done.
}
void DistillabilityDriver::CreateDistillabilityService(
@@ -67,15 +66,17 @@ void DistillabilityDriver::OnDistillability(
m_delegate_.Run(distillable, is_last);
}
-void DistillabilityDriver::RenderProcessGone(
- base::TerminationStatus status) {
- CleanUp();
+void DistillabilityDriver::DidNavigateMainFrame(
+ const content::LoadCommittedDetails& details,
+ const content::FrameNavigateParams& params) {
+ if (details.is_in_page) return;
+ SetupMojoService();
}
-void DistillabilityDriver::CleanUp() {
- web_contents()->GetMainFrame()->GetServiceRegistry()
- ->RemoveService<DistillabilityService>();
- content::WebContentsObserver::Observe(NULL);
+void DistillabilityDriver::SetupMojoService() {
+ web_contents()->GetMainFrame()->GetServiceRegistry()->AddService(
+ base::Bind(&DistillabilityDriver::CreateDistillabilityService,
+ weak_factory_.GetWeakPtr()));
}
} // namespace dom_distiller
« no previous file with comments | « components/dom_distiller/content/browser/distillability_driver.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698