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
3 // found in the LICENSE file.
5 #include "chrome/browser/android/dom_distiller/external_feedback_reporter_android.h"
7 #include "base/android/jni_string.h"
8 #include "chrome/browser/ui/android/window_android_helper.h"
9 #include "components/dom_distiller/core/url_utils.h"
10 #include "content/public/browser/web_contents.h"
11 #include "jni/DomDistillerFeedbackReporter_jni.h"
12 #include "ui/android/window_android.h"
15 namespace dom_distiller
{
19 // ExternalFeedbackReporter implementation.
20 void ExternalFeedbackReporterAndroid::ReportExternalFeedback(
21 content::WebContents
* web_contents
,
26 WindowAndroidHelper
* helper
=
27 content::WebContentsUserData
<WindowAndroidHelper
>::FromWebContents(
31 ui::WindowAndroid
* window
= helper
->GetWindowAndroid();
34 JNIEnv
* env
= base::android::AttachCurrentThread();
35 ScopedJavaLocalRef
<jstring
> jurl
= base::android::ConvertUTF8ToJavaString(
36 env
, url_utils::GetOriginalUrlFromDistillerUrl(url
).spec());
38 Java_DomDistillerFeedbackReporter_reportFeedbackWithWindow(
39 env
, window
->GetJavaObject().obj(), jurl
.obj(), good
);
43 bool RegisterFeedbackReporter(JNIEnv
* env
) {
44 return RegisterNativesImpl(env
);
47 } // namespace android
49 } // namespace dom_distiller