Index: components/dom_distiller/content/renderer/distiller_native_javascript.cc |
diff --git a/components/dom_distiller/content/renderer/distiller_native_javascript.cc b/components/dom_distiller/content/renderer/distiller_native_javascript.cc |
index 767dac67ef3d11ccc1a3803702463641308bd8b4..aa6619b22adbcb6a6bfefc2785ac24d0f195ca02 100644 |
--- a/components/dom_distiller/content/renderer/distiller_native_javascript.cc |
+++ b/components/dom_distiller/content/renderer/distiller_native_javascript.cc |
@@ -45,14 +45,30 @@ void DistillerNativeJavaScript::AddJavaScriptObjectToFrame( |
isolate, base::Bind(&DistillerNativeJavaScript::DistillerEcho, |
base::Unretained(this))) |
->GetFunction()); |
+ |
+ distiller_obj->Set( |
+ gin::StringToSymbol(isolate, "sendFeedback"), |
+ gin::CreateFunctionTemplate( |
+ isolate, base::Bind(&DistillerNativeJavaScript::DistillerSendFeedback, |
+ base::Unretained(this))) |
+ ->GetFunction()); |
} |
-std::string DistillerNativeJavaScript::DistillerEcho( |
- const std::string& message) { |
+void DistillerNativeJavaScript::EnsureServiceConnected() { |
if (!distiller_js_service_) { |
render_frame_->GetServiceRegistry()->ConnectToRemoteService( |
mojo::GetProxy(&distiller_js_service_)); |
} |
+} |
+ |
+void DistillerNativeJavaScript::DistillerSendFeedback(bool good) { |
+ EnsureServiceConnected(); |
+ distiller_js_service_->HandleDistillerFeedbackCall(good); |
+} |
+ |
+std::string DistillerNativeJavaScript::DistillerEcho( |
+ const std::string& message) { |
+ EnsureServiceConnected(); |
// TODO(mdjones): It is possible and beneficial to have information |
// returned from the browser process with these calls. The problem |
// is waiting blocks this process. |