OLD | NEW |
(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 #ifndef COMPONENTS_DOM_DISTILLER_CONTENT_BROWSER_DISTILLIBILITY_DRIVER_H_ |
| 6 #define COMPONENTS_DOM_DISTILLER_CONTENT_BROWSER_DISTILLIBILITY_DRIVER_H_ |
| 7 |
| 8 #include "content/public/browser/web_contents_observer.h" |
| 9 #include "content/public/browser/web_contents_user_data.h" |
| 10 |
| 11 namespace dom_distiller { |
| 12 |
| 13 // This is an IPC helper for determining whether a page should be distilled. |
| 14 class WebContentsDistillabilityDriver |
| 15 : public content::WebContentsObserver, |
| 16 public content::WebContentsUserData<WebContentsDistillabilityDriver> { |
| 17 public: |
| 18 ~WebContentsDistillabilityDriver() override; |
| 19 |
| 20 // content::WebContentsObserver implementation. |
| 21 bool OnMessageReceived(const IPC::Message& message, |
| 22 content::RenderFrameHost* rfh) override; |
| 23 void RenderProcessGone(base::TerminationStatus status) override; |
| 24 |
| 25 void OnDistillability(bool distillable); |
| 26 |
| 27 void ExtractFeatures(); |
| 28 |
| 29 private: |
| 30 explicit WebContentsDistillabilityDriver(content::WebContents* web_contents); |
| 31 friend class content::WebContentsUserData<WebContentsDistillabilityDriver>; |
| 32 |
| 33 // Removes the observer and clears the WebContents member. |
| 34 void CleanUp(); |
| 35 |
| 36 DISALLOW_COPY_AND_ASSIGN(WebContentsDistillabilityDriver); |
| 37 }; |
| 38 |
| 39 } // namespace dom_distiller |
| 40 |
| 41 #endif // COMPONENTS_DOM_DISTILLER_CONTENT_BROWSER_DISTILLIBILITY_DRIVER_H_ |
OLD | NEW |