Java Code Examples for org.chromium.chrome.browser.ChromeApplication#createFeedbackReporter()

The following examples show how to use org.chromium.chrome.browser.ChromeApplication#createFeedbackReporter() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DomDistillerUIUtils.java    From delion with Apache License 2.0 6 votes vote down vote up
/**
 * 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);
                }
            });
}
 
Example 2
Source File: DomDistillerUIUtils.java    From AndroidChromium with Apache License 2.0 6 votes vote down vote up
/**
 * 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);
                }
            });
}
 
Example 3
Source File: ChildAccountFeedbackReporter.java    From delion with Apache License 2.0 5 votes vote down vote up
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);
                }
            });
}
 
Example 4
Source File: ChildAccountFeedbackReporter.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
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);
                }
            });
}