Commit c364b7e4 authored by Robbie McElrath's avatar Robbie McElrath Committed by Commit Bot

[WebLayer] Split SiteSettingsClient.launchHelpAndFeedbackActivity into two methods

This CL splits SiteSettingsClient.launchHelpAndFeedbackActivity into
launchSettingsHelpAndFeedbackActivity and
launchProtectedContentHelpAndFeedbackActivity methods. The method
originally took a "helpContext" string, which mapped to one of Chrome's
constants defined in //chrome/android/java/res/values/values.xml,
which were used to determine which Chrome help page to launch. These
constants are specific to Chrome, and shouldn't be part of a
//components API. Splitting the method into two allows the embedder
to choose which help page to show the user.

Bug: 1058595
Change-Id: I193dd6c0767fe53223afaa952f311d0fa045c6c5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2158408Reviewed-by: default avatarFinnur Thorarinsson <finnur@chromium.org>
Commit-Queue: Robbie McElrath <rmcelrath@chromium.org>
Cr-Commit-Position: refs/heads/master@{#761054}
parent 37fa4e59
...@@ -127,8 +127,7 @@ public class ChosenObjectSettings extends SiteSettingsPreferenceFragment { ...@@ -127,8 +127,7 @@ public class ChosenObjectSettings extends SiteSettingsPreferenceFragment {
@Override @Override
public boolean onOptionsItemSelected(MenuItem item) { public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId() == R.id.menu_id_targeted_help) { if (item.getItemId() == R.id.menu_id_targeted_help) {
getSiteSettingsClient().launchHelpAndFeedbackActivity( getSiteSettingsClient().launchSettingsHelpAndFeedbackActivity(getActivity());
getActivity(), getString(R.string.help_context_settings));
return true; return true;
} }
return false; return false;
......
...@@ -10,6 +10,7 @@ import android.graphics.Bitmap; ...@@ -10,6 +10,7 @@ import android.graphics.Bitmap;
import androidx.preference.Preference; import androidx.preference.Preference;
import org.chromium.base.Callback; import org.chromium.base.Callback;
import org.chromium.chrome.R;
import org.chromium.chrome.browser.flags.ChromeFeatureList; import org.chromium.chrome.browser.flags.ChromeFeatureList;
import org.chromium.chrome.browser.help.HelpAndFeedback; import org.chromium.chrome.browser.help.HelpAndFeedback;
import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.profiles.Profile;
...@@ -40,9 +41,17 @@ public class ChromeSiteSettingsClient implements SiteSettingsClient { ...@@ -40,9 +41,17 @@ public class ChromeSiteSettingsClient implements SiteSettingsClient {
} }
@Override @Override
public void launchHelpAndFeedbackActivity(Activity currentActivity, String helpContext) { public void launchSettingsHelpAndFeedbackActivity(Activity currentActivity) {
HelpAndFeedback.getInstance().show( HelpAndFeedback.getInstance().show(currentActivity,
currentActivity, helpContext, Profile.getLastUsedRegularProfile(), null); currentActivity.getString(R.string.help_context_settings),
Profile.getLastUsedRegularProfile(), null);
}
@Override
public void launchProtectedContentHelpAndFeedbackActivity(Activity currentActivity) {
HelpAndFeedback.getInstance().show(currentActivity,
currentActivity.getString(R.string.help_context_protected_content),
Profile.getLastUsedRegularProfile(), null);
} }
@Override @Override
......
...@@ -409,12 +409,12 @@ public class SingleCategorySettings extends SiteSettingsPreferenceFragment ...@@ -409,12 +409,12 @@ public class SingleCategorySettings extends SiteSettingsPreferenceFragment
@Override @Override
public boolean onOptionsItemSelected(MenuItem item) { public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId() == R.id.menu_id_targeted_help) { if (item.getItemId() == R.id.menu_id_targeted_help) {
int helpContextResId = R.string.help_context_settings;
if (mCategory.showSites(SiteSettingsCategory.Type.PROTECTED_MEDIA)) { if (mCategory.showSites(SiteSettingsCategory.Type.PROTECTED_MEDIA)) {
helpContextResId = R.string.help_context_protected_content; getSiteSettingsClient().launchProtectedContentHelpAndFeedbackActivity(
getActivity());
} else {
getSiteSettingsClient().launchSettingsHelpAndFeedbackActivity(getActivity());
} }
getSiteSettingsClient().launchHelpAndFeedbackActivity(
getActivity(), getString(helpContextResId));
return true; return true;
} }
if (handleSearchNavigation(item, mSearchItem, mSearch, getActivity())) { if (handleSearchNavigation(item, mSearchItem, mSearch, getActivity())) {
......
...@@ -22,9 +22,18 @@ public interface SiteSettingsClient { ...@@ -22,9 +22,18 @@ public interface SiteSettingsClient {
ManagedPreferenceDelegate getManagedPreferenceDelegate(); ManagedPreferenceDelegate getManagedPreferenceDelegate();
/** /**
* Launches a support page relevant to settings UI pages.
*
* @see org.chromium.chrome.browser.help.HelpAndFeedback#show
*/
void launchSettingsHelpAndFeedbackActivity(Activity currentActivity);
/**
* Launches a support page related to protected content.
*
* @see org.chromium.chrome.browser.help.HelpAndFeedback#show * @see org.chromium.chrome.browser.help.HelpAndFeedback#show
*/ */
void launchHelpAndFeedbackActivity(Activity currentActivity, String helpContext); void launchProtectedContentHelpAndFeedbackActivity(Activity currentActivity);
/** /**
* @return The NotificationSettingsClient that should be used when showing the Site Settings UI. * @return The NotificationSettingsClient that should be used when showing the Site Settings UI.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment