Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(144)

Side by Side Diff: components/dom_distiller/content/browser/distiller_javascript_service_impl.cc

Issue 1265843005: Refactor feedback to use native JS object (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@js-mojo-combine
Patch Set: impl comments Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #include "components/dom_distiller/content/browser/external_feedback_reporter.h"
7 #include "components/dom_distiller/core/feedback_reporter.h"
6 #include "third_party/mojo/src/mojo/public/cpp/bindings/string.h" 8 #include "third_party/mojo/src/mojo/public/cpp/bindings/string.h"
7 9
8 namespace dom_distiller { 10 namespace dom_distiller {
9 11
10 DistillerJavaScriptServiceImpl::DistillerJavaScriptServiceImpl( 12 DistillerJavaScriptServiceImpl::DistillerJavaScriptServiceImpl(
11 mojo::InterfaceRequest<DistillerJavaScriptService> request) 13 content::RenderFrameHost* render_frame_host,
12 : binding_(this, request.Pass()) {} 14 ExternalFeedbackReporter* external_feedback_reporter,
15 mojo::InterfaceRequest<DistillerJavaScriptService> request)
16 : binding_(this, request.Pass()),
17 render_frame_host_(render_frame_host),
18 external_feedback_reporter_(external_feedback_reporter) {}
13 19
14 DistillerJavaScriptServiceImpl::~DistillerJavaScriptServiceImpl() {} 20 DistillerJavaScriptServiceImpl::~DistillerJavaScriptServiceImpl() {}
15 21
16 void DistillerJavaScriptServiceImpl::HandleDistillerEchoCall( 22 void DistillerJavaScriptServiceImpl::HandleDistillerEchoCall(
17 const mojo::String& message) {} 23 const mojo::String& message) {}
18 24
25 void DistillerJavaScriptServiceImpl::HandleDistillerFeedbackCall(
26 bool good) {
27 FeedbackReporter::ReportQuality(good);
28 if (good) {
29 return;
30 }
31
32 // If feedback is bad try to start up external feedback.
33 if (!external_feedback_reporter_) {
34 return;
35 }
36 content::WebContents* contents =
37 content::WebContents::FromRenderFrameHost(render_frame_host_);
38 external_feedback_reporter_->ReportExternalFeedback(
39 contents, contents->GetURL(), false);
40 return;
41 }
42
19 void CreateDistillerJavaScriptService( 43 void CreateDistillerJavaScriptService(
44 content::RenderFrameHost* render_frame_host,
45 ExternalFeedbackReporter* feedback_reporter,
20 mojo::InterfaceRequest<DistillerJavaScriptService> request) { 46 mojo::InterfaceRequest<DistillerJavaScriptService> request) {
21 // This is strongly bound and owned by the pipe. 47 // This is strongly bound and owned by the pipe.
22 new DistillerJavaScriptServiceImpl(request.Pass()); 48 new DistillerJavaScriptServiceImpl(render_frame_host, feedback_reporter,
49 request.Pass());
23 } 50 }
24 51
25 } // namespace dom_distiller 52 } // namespace dom_distiller
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698