| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef COMPONENTS_DOM_DISTILLER_CONTENT_BROWSER_DISTILLIBILITY_DRIVER_H_ | 5 #ifndef COMPONENTS_DOM_DISTILLER_CONTENT_BROWSER_DISTILLIBILITY_DRIVER_H_ |
| 6 #define COMPONENTS_DOM_DISTILLER_CONTENT_BROWSER_DISTILLIBILITY_DRIVER_H_ | 6 #define COMPONENTS_DOM_DISTILLER_CONTENT_BROWSER_DISTILLIBILITY_DRIVER_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
| 10 #include "components/dom_distiller/content/common/distillability_service.mojom.h
" | 10 #include "components/dom_distiller/content/common/distillability_service.mojom.h
" |
| 11 #include "content/public/browser/web_contents_observer.h" | 11 #include "content/public/browser/web_contents_observer.h" |
| 12 #include "content/public/browser/web_contents_user_data.h" | 12 #include "content/public/browser/web_contents_user_data.h" |
| 13 #include "mojo/public/cpp/bindings/strong_binding.h" | 13 #include "mojo/public/cpp/bindings/strong_binding.h" |
| 14 #include "services/service_manager/public/cpp/bind_source_info.h" |
| 14 | 15 |
| 15 namespace dom_distiller { | 16 namespace dom_distiller { |
| 16 | 17 |
| 17 // This is an IPC helper for determining whether a page should be distilled. | 18 // This is an IPC helper for determining whether a page should be distilled. |
| 18 class DistillabilityDriver | 19 class DistillabilityDriver |
| 19 : public content::WebContentsObserver, | 20 : public content::WebContentsObserver, |
| 20 public content::WebContentsUserData<DistillabilityDriver> { | 21 public content::WebContentsUserData<DistillabilityDriver> { |
| 21 public: | 22 public: |
| 22 ~DistillabilityDriver() override; | 23 ~DistillabilityDriver() override; |
| 23 void CreateDistillabilityService( | 24 void CreateDistillabilityService( |
| 24 mojo::InterfaceRequest<mojom::DistillabilityService> request); | 25 const service_manager::BindSourceInfo& source_info, |
| 26 mojom::DistillabilityServiceRequest request); |
| 25 | 27 |
| 26 void SetDelegate(const base::Callback<void(bool, bool)>& delegate); | 28 void SetDelegate(const base::Callback<void(bool, bool)>& delegate); |
| 27 | 29 |
| 28 // content::WebContentsObserver implementation. | 30 // content::WebContentsObserver implementation. |
| 29 void ReadyToCommitNavigation( | 31 void ReadyToCommitNavigation( |
| 30 content::NavigationHandle* navigation_handle) override; | 32 content::NavigationHandle* navigation_handle) override; |
| 31 void RenderFrameHostChanged( | 33 void RenderFrameHostChanged( |
| 32 content::RenderFrameHost* old_host, | 34 content::RenderFrameHost* old_host, |
| 33 content::RenderFrameHost* new_host) override; | 35 content::RenderFrameHost* new_host) override; |
| 34 | 36 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 47 bool mojo_needs_setup_; | 49 bool mojo_needs_setup_; |
| 48 | 50 |
| 49 base::WeakPtrFactory<DistillabilityDriver> weak_factory_; | 51 base::WeakPtrFactory<DistillabilityDriver> weak_factory_; |
| 50 | 52 |
| 51 DISALLOW_COPY_AND_ASSIGN(DistillabilityDriver); | 53 DISALLOW_COPY_AND_ASSIGN(DistillabilityDriver); |
| 52 }; | 54 }; |
| 53 | 55 |
| 54 } // namespace dom_distiller | 56 } // namespace dom_distiller |
| 55 | 57 |
| 56 #endif // COMPONENTS_DOM_DISTILLER_CONTENT_BROWSER_DISTILLIBILITY_DRIVER_H_ | 58 #endif // COMPONENTS_DOM_DISTILLER_CONTENT_BROWSER_DISTILLIBILITY_DRIVER_H_ |
| OLD | NEW |