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

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

Issue 1434433002: Pass distillability updates from renderer to browser (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@model
Patch Set: address tsepez's comment Created 5 years, 1 month 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
Index: components/dom_distiller/content/browser/distillability_driver.h
diff --git a/components/dom_distiller/content/browser/distillability_driver.h b/components/dom_distiller/content/browser/distillability_driver.h
new file mode 100644
index 0000000000000000000000000000000000000000..795b9bf438fde48c98ee04d1d1af3f98e28612c3
--- /dev/null
+++ b/components/dom_distiller/content/browser/distillability_driver.h
@@ -0,0 +1,44 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef COMPONENTS_DOM_DISTILLER_CONTENT_BROWSER_DISTILLIBILITY_DRIVER_H_
+#define COMPONENTS_DOM_DISTILLER_CONTENT_BROWSER_DISTILLIBILITY_DRIVER_H_
+
+#include "base/macros.h"
+#include "content/public/browser/web_contents_observer.h"
+#include "content/public/browser/web_contents_user_data.h"
+
+namespace dom_distiller {
+
+// This is an IPC helper for determining whether a page should be distilled.
+class DistillabilityDriver
+ : public content::WebContentsObserver,
+ public content::WebContentsUserData<DistillabilityDriver> {
+ public:
+ ~DistillabilityDriver() override;
+
+ void SetDelegate(const base::Callback<void(bool, bool)>& delegate);
+
+ // content::WebContentsObserver implementation.
+ bool OnMessageReceived(const IPC::Message& message,
+ content::RenderFrameHost* rfh) override;
+ void RenderProcessGone(base::TerminationStatus status) override;
+
+ private:
+ explicit DistillabilityDriver(content::WebContents* web_contents);
+ friend class content::WebContentsUserData<DistillabilityDriver>;
+
+ void OnDistillability(bool distillable, bool is_last);
+
+ // Removes the observer and clears the WebContents member.
+ void CleanUp();
+
+ base::Callback<void(bool, bool)> m_delegate_;
+
+ DISALLOW_COPY_AND_ASSIGN(DistillabilityDriver);
+};
+
+} // namespace dom_distiller
+
+#endif // COMPONENTS_DOM_DISTILLER_CONTENT_BROWSER_DISTILLIBILITY_DRIVER_H_
« no previous file with comments | « components/dom_distiller/content/DEPS ('k') | components/dom_distiller/content/browser/distillability_driver.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698