Java源码示例:org.chromium.chrome.browser.feedback.FeedbackCollector
示例1
/**
* 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);
}
});
}
示例2
/**
* 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);
}
});
}
示例3
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);
}
});
}
示例4
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);
}
});
}
示例5
public static void reportFeedback(Activity activity, final String description, String url) {
ThreadUtils.assertOnUiThread();
if (sFeedbackReporter == null) {
sFeedbackReporter = AppHooks.get().createFeedbackReporter();
}
FeedbackCollector.create(activity, Profile.getLastUsedProfile(), url,
true /* takeScreenshot */, new FeedbackCollector.FeedbackResult() {
@Override
public void onResult(FeedbackCollector collector) {
collector.setDescription(description);
sFeedbackReporter.reportFeedback(collector);
}
});
}
示例6
/**
* Starts an activity showing a help page for the specified context ID.
*
* @param activity The activity to use for starting the help activity and to take a
* screenshot of.
* @param helpContext One of the CONTEXT_* constants. This should describe the user's current
* context and will be used to show a more relevant help page.
* @param profile the current profile.
* @param url the current URL. May be null.
*/
public void show(final Activity activity, final String helpContext, Profile profile,
@Nullable String url) {
FeedbackCollector.create(activity, profile, url, true /* takeScreenshot */,
new FeedbackCollector.FeedbackResult() {
@Override
public void onResult(FeedbackCollector collector) {
show(activity, helpContext, collector);
}
});
}
示例7
/**
* Starts an activity prompting the user to enter feedback.
*
* @param activity The activity to use for starting the feedback activity and to take a
* screenshot of.
* @param profile the current profile.
* @param url the current URL. May be null.
* @param categoryTag The category that this feedback report falls under.
*/
public void showFeedback(final Activity activity, Profile profile, @Nullable String url,
@Nullable final String categoryTag) {
FeedbackCollector.create(activity, profile, url, false /* takeScreenshot */,
new FeedbackCollector.FeedbackResult() {
@Override
public void onResult(FeedbackCollector collector) {
if (categoryTag != null) {
collector.setCategoryTag(categoryTag);
}
showFeedback(activity, collector);
}
});
}
示例8
/**
* Starts an activity showing a help page for the specified context ID.
*
* @param activity The activity to use for starting the help activity and to take a
* screenshot of.
* @param helpContext One of the CONTEXT_* constants. This should describe the user's current
* context and will be used to show a more relevant help page.
* @param profile the current profile.
* @param url the current URL. May be null.
*/
public void show(final Activity activity, final String helpContext, Profile profile,
@Nullable String url) {
FeedbackCollector.create(activity, profile, url, new FeedbackCollector.FeedbackResult() {
@Override
public void onResult(FeedbackCollector collector) {
show(activity, helpContext, collector);
}
});
}
示例9
/**
* Starts an activity showing a help page for the specified context ID.
*
* @param activity The activity to use for starting the help activity and to take a
* screenshot of.
* @param helpContext One of the CONTEXT_* constants. This should describe the user's current
* context and will be used to show a more relevant help page.
* @param profile the current profile.
* @param url the current URL. May be null.
*/
public void show(final Activity activity, final String helpContext, Profile profile,
@Nullable String url) {
FeedbackCollector.create(activity, profile, url, new FeedbackCollector.FeedbackResult() {
@Override
public void onResult(FeedbackCollector collector) {
show(activity, helpContext, collector);
}
});
}
示例10
/**
* Starts an activity showing a help page for the specified context ID.
*
* @param activity The activity to use for starting the help activity and to take a
* screenshot of.
* @param helpContext One of the CONTEXT_* constants. This should describe the user's current
* context and will be used to show a more relevant help page.
* @param collector the {@link FeedbackCollector} to use for extra data. Must not be null.
*/
protected void show(
Activity activity, String helpContext, @Nonnull FeedbackCollector collector) {
launchFallbackSupportUri(activity);
}
示例11
/**
* Starts an activity showing a help page for the specified context ID.
*
* @param activity The activity to use for starting the help activity and to take a
* screenshot of.
* @param helpContext One of the CONTEXT_* constants. This should describe the user's current
* context and will be used to show a more relevant help page.
* @param collector the {@link FeedbackCollector} to use for extra data. Must not be null.
*/
protected void show(
Activity activity, String helpContext, @Nonnull FeedbackCollector collector) {
launchFallbackSupportUri(activity);
}
示例12
/**
* Starts an activity showing a help page for the specified context ID.
*
* @param activity The activity to use for starting the help activity and to take a
* screenshot of.
* @param helpContext One of the CONTEXT_* constants. This should describe the user's current
* context and will be used to show a more relevant help page.
* @param collector the {@link FeedbackCollector} to use for extra data. Must not be null.
*/
protected void show(
Activity activity, String helpContext, @Nonnull FeedbackCollector collector) {
Log.d(TAG, "Feedback data: " + collector.getBundle());
launchFallbackSupportUri(activity);
}
示例13
/**
* Starts an activity prompting the user to enter feedback.
*
* @param activity The activity to use for starting the feedback activity and to take a
* screenshot of.
* @param collector the {@link FeedbackCollector} to use for extra data. Must not be null.
*/
protected void showFeedback(Activity activity, @Nonnull FeedbackCollector collector) {
Log.d(TAG, "Feedback data: " + collector.getBundle());
launchFallbackSupportUri(activity);
}