Chromium Code Reviews| 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 "base/macros.h" | |
| 9 #include "content/public/browser/web_contents_observer.h" | |
| 10 #include "content/public/browser/web_contents_user_data.h" | |
| 11 | |
| 12 namespace dom_distiller { | |
| 13 | |
| 14 // This is an IPC helper for determining whether a page should be distilled. | |
| 15 class WebContentsDistillabilityDriver | |
|
blundell
2015/11/05 09:42:41
drive-by nit: this should be named web_contents_do
wychen
2015/11/12 04:59:45
Changed the class name.
| |
| 16 : public content::WebContentsObserver, | |
| 17 public content::WebContentsUserData<WebContentsDistillabilityDriver> { | |
| 18 public: | |
| 19 ~WebContentsDistillabilityDriver() override; | |
| 20 | |
| 21 void SetDelegate(const base::Callback<void(bool, bool)>& delegate); | |
| 22 | |
| 23 // content::WebContentsObserver implementation. | |
| 24 bool OnMessageReceived(const IPC::Message& message, | |
| 25 content::RenderFrameHost* rfh) override; | |
| 26 void RenderProcessGone(base::TerminationStatus status) override; | |
| 27 | |
| 28 private: | |
| 29 explicit WebContentsDistillabilityDriver(content::WebContents* web_contents); | |
| 30 friend class content::WebContentsUserData<WebContentsDistillabilityDriver>; | |
| 31 | |
| 32 void OnDistillability(bool distillable, bool is_last); | |
| 33 | |
| 34 // Removes the observer and clears the WebContents member. | |
| 35 void CleanUp(); | |
| 36 | |
| 37 base::Callback<void(bool, bool)> m_delegate_; | |
| 38 | |
| 39 DISALLOW_COPY_AND_ASSIGN(WebContentsDistillabilityDriver); | |
| 40 }; | |
| 41 | |
| 42 } // namespace dom_distiller | |
| 43 | |
| 44 #endif // COMPONENTS_DOM_DISTILLER_CONTENT_BROWSER_DISTILLIBILITY_DRIVER_H_ | |
| OLD | NEW |