Search in sources :

Example 1 with FeedbackCollector

use of org.chromium.chrome.browser.feedback.FeedbackCollector in project AndroidChromium by JackyAndroid.

the class ChildAccountFeedbackReporter method reportFeedback.

public static void reportFeedback(Activity activity, final String description, String url) {
    ThreadUtils.assertOnUiThread();
    if (sFeedbackReporter == null) {
        ChromeApplication application = (ChromeApplication) activity.getApplication();
        sFeedbackReporter = application.createFeedbackReporter();
    }
    FeedbackCollector.create(activity, Profile.getLastUsedProfile(), url, new FeedbackCollector.FeedbackResult() {

        @Override
        public void onResult(FeedbackCollector collector) {
            collector.setDescription(description);
            sFeedbackReporter.reportFeedback(collector);
        }
    });
}
Also used : ChromeApplication(org.chromium.chrome.browser.ChromeApplication) FeedbackCollector(org.chromium.chrome.browser.feedback.FeedbackCollector)

Example 2 with FeedbackCollector

use of org.chromium.chrome.browser.feedback.FeedbackCollector in project AndroidChromium by JackyAndroid.

the class DomDistillerUIUtils method reportFeedbackWithWebContents.

/**
 * A static method for native code to open the external feedback form UI.
 * @param webContents The WebContents containing the distilled content.
 * @param url The URL to report feedback for.
 * @param good True if the feedback is good and false if not.
 */
@CalledByNative
public static void reportFeedbackWithWebContents(WebContents webContents, String url, final boolean good) {
    ThreadUtils.assertOnUiThread();
    // TODO(mdjones): It would be better to get the WebContents from the manager so that the
    // native code does not need to depend on RenderFrame.
    Activity activity = getActivityFromWebContents(webContents);
    if (activity == null)
        return;
    if (sFeedbackReporter == null) {
        ChromeApplication application = (ChromeApplication) activity.getApplication();
        sFeedbackReporter = application.createFeedbackReporter();
    }
    FeedbackCollector.create(activity, Profile.getLastUsedProfile(), url, new FeedbackCollector.FeedbackResult() {

        @Override
        public void onResult(FeedbackCollector collector) {
            String quality = good ? DISTILLATION_QUALITY_GOOD : DISTILLATION_QUALITY_BAD;
            collector.add(DISTILLATION_QUALITY_KEY, quality);
            sFeedbackReporter.reportFeedback(collector);
        }
    });
}
Also used : ChromeApplication(org.chromium.chrome.browser.ChromeApplication) Activity(android.app.Activity) FeedbackCollector(org.chromium.chrome.browser.feedback.FeedbackCollector) CalledByNative(org.chromium.base.annotations.CalledByNative)

Aggregations

ChromeApplication (org.chromium.chrome.browser.ChromeApplication)2 FeedbackCollector (org.chromium.chrome.browser.feedback.FeedbackCollector)2 Activity (android.app.Activity)1 CalledByNative (org.chromium.base.annotations.CalledByNative)1