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

Unified 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: Param order 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 side-by-side diff with in-line comments
Download patch
Index: components/dom_distiller/content/browser/distiller_javascript_service_impl.cc
diff --git a/components/dom_distiller/content/browser/distiller_javascript_service_impl.cc b/components/dom_distiller/content/browser/distiller_javascript_service_impl.cc
index 16601d2c96fbcd91dd57f19f630b0f03682a118f..6c13eff11e88279762e4012ac5acd5767e14ce7a 100644
--- a/components/dom_distiller/content/browser/distiller_javascript_service_impl.cc
+++ b/components/dom_distiller/content/browser/distiller_javascript_service_impl.cc
@@ -3,23 +3,51 @@
// found in the LICENSE file.
#include "components/dom_distiller/content/browser/distiller_javascript_service_impl.h"
+#include "components/dom_distiller/content/browser/external_feedback_reporter.h"
+#include "components/dom_distiller/core/feedback_reporter.h"
#include "third_party/mojo/src/mojo/public/cpp/bindings/string.h"
namespace dom_distiller {
DistillerJavaScriptServiceImpl::DistillerJavaScriptServiceImpl(
- mojo::InterfaceRequest<DistillerJavaScriptService> request)
- : binding_(this, request.Pass()) {}
+ content::RenderFrameHost* render_frame_host,
+ ExternalFeedbackReporter* external_feedback_reporter,
+ mojo::InterfaceRequest<DistillerJavaScriptService> request)
+ : binding_(this, request.Pass()),
+ render_frame_host_(render_frame_host),
+ external_feedback_reporter_(external_feedback_reporter) {}
DistillerJavaScriptServiceImpl::~DistillerJavaScriptServiceImpl() {}
void DistillerJavaScriptServiceImpl::HandleDistillerEchoCall(
const mojo::String& message) {}
+void DistillerJavaScriptServiceImpl::HandleDistillerFeedbackCall(
+ bool good) {
+ if (good) {
+ FeedbackReporter::ReportQuality(true);
+ return;
+ }
+
+ // If feedback is bad, report it and try to start up external feedback.
+ FeedbackReporter::ReportQuality(false);
nyquist 2015/09/10 19:04:13 Could we just do: ### FeedbackReporter::ReportQual
mdjones 2015/09/11 16:50:13 Done.
+ if (!external_feedback_reporter_) {
+ return;
+ }
+ content::WebContents* contents =
+ content::WebContents::FromRenderFrameHost(render_frame_host_);
+ external_feedback_reporter_->ReportExternalFeedback(
+ contents, contents->GetURL(), false);
+ return;
+}
+
void CreateDistillerJavaScriptService(
+ content::RenderFrameHost* render_frame_host,
+ ExternalFeedbackReporter* feedback_reporter,
mojo::InterfaceRequest<DistillerJavaScriptService> request) {
// This is strongly bound and owned by the pipe.
- new DistillerJavaScriptServiceImpl(request.Pass());
+ new DistillerJavaScriptServiceImpl(render_frame_host, feedback_reporter,
+ request.Pass());
}
} // namespace dom_distiller

Powered by Google App Engine
This is Rietveld 408576698