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/distiller_javascript_service_
impl.h" | 5 #include "components/dom_distiller/content/browser/distiller_javascript_service_
impl.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "components/dom_distiller/content/browser/distiller_ui_handle.h" | 9 #include "components/dom_distiller/content/browser/distiller_ui_handle.h" |
10 #include "components/dom_distiller/core/feedback_reporter.h" | 10 #include "components/dom_distiller/core/feedback_reporter.h" |
11 #include "content/public/browser/user_metrics.h" | 11 #include "content/public/browser/user_metrics.h" |
12 #include "mojo/public/cpp/bindings/string.h" | 12 #include "mojo/public/cpp/bindings/string.h" |
| 13 #include "mojo/public/cpp/bindings/strong_binding.h" |
13 | 14 |
14 namespace dom_distiller { | 15 namespace dom_distiller { |
15 | 16 |
16 DistillerJavaScriptServiceImpl::DistillerJavaScriptServiceImpl( | 17 DistillerJavaScriptServiceImpl::DistillerJavaScriptServiceImpl( |
17 content::RenderFrameHost* render_frame_host, | 18 content::RenderFrameHost* render_frame_host, |
18 DistillerUIHandle* distiller_ui_handle, | 19 DistillerUIHandle* distiller_ui_handle) |
19 mojo::InterfaceRequest<mojom::DistillerJavaScriptService> request) | 20 : render_frame_host_(render_frame_host), |
20 : binding_(this, std::move(request)), | |
21 render_frame_host_(render_frame_host), | |
22 distiller_ui_handle_(distiller_ui_handle) {} | 21 distiller_ui_handle_(distiller_ui_handle) {} |
23 | 22 |
24 DistillerJavaScriptServiceImpl::~DistillerJavaScriptServiceImpl() {} | 23 DistillerJavaScriptServiceImpl::~DistillerJavaScriptServiceImpl() {} |
25 | 24 |
26 void DistillerJavaScriptServiceImpl::HandleDistillerEchoCall( | 25 void DistillerJavaScriptServiceImpl::HandleDistillerEchoCall( |
27 const mojo::String& message) {} | 26 const mojo::String& message) {} |
28 | 27 |
29 void DistillerJavaScriptServiceImpl::HandleDistillerFeedbackCall( | 28 void DistillerJavaScriptServiceImpl::HandleDistillerFeedbackCall( |
30 bool good) { | 29 bool good) { |
31 FeedbackReporter::ReportQuality(good); | 30 FeedbackReporter::ReportQuality(good); |
(...skipping 27 matching lines...) Expand all Loading... |
59 } | 58 } |
60 content::WebContents* contents = | 59 content::WebContents* contents = |
61 content::WebContents::FromRenderFrameHost(render_frame_host_); | 60 content::WebContents::FromRenderFrameHost(render_frame_host_); |
62 distiller_ui_handle_->OpenSettings(contents); | 61 distiller_ui_handle_->OpenSettings(contents); |
63 } | 62 } |
64 | 63 |
65 void CreateDistillerJavaScriptService( | 64 void CreateDistillerJavaScriptService( |
66 content::RenderFrameHost* render_frame_host, | 65 content::RenderFrameHost* render_frame_host, |
67 DistillerUIHandle* distiller_ui_handle, | 66 DistillerUIHandle* distiller_ui_handle, |
68 mojo::InterfaceRequest<mojom::DistillerJavaScriptService> request) { | 67 mojo::InterfaceRequest<mojom::DistillerJavaScriptService> request) { |
69 // This is strongly bound and owned by the pipe. | 68 mojo::MakeStrongBinding(base::MakeUnique<DistillerJavaScriptServiceImpl>( |
70 new DistillerJavaScriptServiceImpl(render_frame_host, distiller_ui_handle, | 69 render_frame_host, distiller_ui_handle), |
71 std::move(request)); | 70 std::move(request)); |
72 } | 71 } |
73 | 72 |
74 } // namespace dom_distiller | 73 } // namespace dom_distiller |
OLD | NEW |