| 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 #include "components/dom_distiller/content/browser/distillability_driver.h" | 5 #include "components/dom_distiller/content/browser/distillability_driver.h" | 
| 6 | 6 | 
| 7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" | 
| 8 #include "content/public/browser/navigation_handle.h" | 8 #include "content/public/browser/navigation_handle.h" | 
| 9 #include "content/public/browser/render_frame_host.h" | 9 #include "content/public/browser/render_frame_host.h" | 
| 10 #include "content/public/browser/web_contents.h" | 10 #include "content/public/browser/web_contents.h" | 
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 47       weak_factory_(this) { | 47       weak_factory_(this) { | 
| 48   if (!web_contents) return; | 48   if (!web_contents) return; | 
| 49   SetupMojoService(web_contents->GetMainFrame()); | 49   SetupMojoService(web_contents->GetMainFrame()); | 
| 50 } | 50 } | 
| 51 | 51 | 
| 52 DistillabilityDriver::~DistillabilityDriver() { | 52 DistillabilityDriver::~DistillabilityDriver() { | 
| 53   content::WebContentsObserver::Observe(nullptr); | 53   content::WebContentsObserver::Observe(nullptr); | 
| 54 } | 54 } | 
| 55 | 55 | 
| 56 void DistillabilityDriver::CreateDistillabilityService( | 56 void DistillabilityDriver::CreateDistillabilityService( | 
| 57     mojo::InterfaceRequest<mojom::DistillabilityService> request) { | 57     const service_manager::BindSourceInfo& source_info, | 
|  | 58     mojom::DistillabilityServiceRequest request) { | 
| 58   mojo::MakeStrongBinding( | 59   mojo::MakeStrongBinding( | 
| 59       base::MakeUnique<DistillabilityServiceImpl>(weak_factory_.GetWeakPtr()), | 60       base::MakeUnique<DistillabilityServiceImpl>(weak_factory_.GetWeakPtr()), | 
| 60       std::move(request)); | 61       std::move(request)); | 
| 61 } | 62 } | 
| 62 | 63 | 
| 63 void DistillabilityDriver::SetDelegate( | 64 void DistillabilityDriver::SetDelegate( | 
| 64     const base::Callback<void(bool, bool)>& delegate) { | 65     const base::Callback<void(bool, bool)>& delegate) { | 
| 65   m_delegate_ = delegate; | 66   m_delegate_ = delegate; | 
| 66 } | 67 } | 
| 67 | 68 | 
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 102     return; | 103     return; | 
| 103   } | 104   } | 
| 104 | 105 | 
| 105   frame_host->GetInterfaceRegistry()->AddInterface( | 106   frame_host->GetInterfaceRegistry()->AddInterface( | 
| 106       base::Bind(&DistillabilityDriver::CreateDistillabilityService, | 107       base::Bind(&DistillabilityDriver::CreateDistillabilityService, | 
| 107           weak_factory_.GetWeakPtr())); | 108           weak_factory_.GetWeakPtr())); | 
| 108   mojo_needs_setup_ = false; | 109   mojo_needs_setup_ = false; | 
| 109 } | 110 } | 
| 110 | 111 | 
| 111 }  // namespace dom_distiller | 112 }  // namespace dom_distiller | 
| OLD | NEW | 
|---|