Commit b84eff50 authored by Ioana Pandele's avatar Ioana Pandele Committed by Commit Bot

[Android] Make the help icon lead to the passwords help page

The backend for the HC link has been updated.

Bug: 1002035
Change-Id: Ieaaa3aeb421ce2a0f62d14bd566305a45db799e2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1791152
Commit-Queue: Ioana Pandele <ioanap@chromium.org>
Reviewed-by: default avatarMatthew Jones <mdjones@chromium.org>
Reviewed-by: default avatarFriedrich [CET] <fhorschig@chromium.org>
Cr-Commit-Position: refs/heads/master@{#697564}
parent 038eb084
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
app:actionViewClass="android.support.v7.widget.SearchView" /> app:actionViewClass="android.support.v7.widget.SearchView" />
<item <item
android:id="@id/menu_id_general_help" android:id="@id/menu_id_targeted_help"
android:icon="@drawable/ic_help_and_feedback" android:icon="@drawable/ic_help_and_feedback"
android:title="@string/menu_help" android:title="@string/menu_help"
app:showAsAction="ifRoom"/> app:showAsAction="ifRoom"/>
......
...@@ -53,6 +53,7 @@ ...@@ -53,6 +53,7 @@
<string name="help_context_clear_browsing_data">clear_browsing_data</string> <string name="help_context_clear_browsing_data">clear_browsing_data</string>
<string name="help_context_change_sync_passphrase">change_sync_passphrase</string> <string name="help_context_change_sync_passphrase">change_sync_passphrase</string>
<string name="help_context_sync_and_services">syncgoogleservices</string> <string name="help_context_sync_and_services">syncgoogleservices</string>
<string name="help_context_passwords">passwords</string>
<!-- TODO(peconn): Add help section. --> <!-- TODO(peconn): Add help section. -->
<!-- <string name="help_context_suggestions">mobile_content_suggestions</string> --> <!-- <string name="help_context_suggestions">mobile_content_suggestions</string> -->
......
...@@ -27,6 +27,7 @@ import org.chromium.base.StrictModeContext; ...@@ -27,6 +27,7 @@ import org.chromium.base.StrictModeContext;
import org.chromium.base.VisibleForTesting; import org.chromium.base.VisibleForTesting;
import org.chromium.chrome.R; import org.chromium.chrome.R;
import org.chromium.chrome.browser.ChromeFeatureList; import org.chromium.chrome.browser.ChromeFeatureList;
import org.chromium.chrome.browser.help.HelpAndFeedback;
import org.chromium.chrome.browser.preferences.ChromeBaseCheckBoxPreference; import org.chromium.chrome.browser.preferences.ChromeBaseCheckBoxPreference;
import org.chromium.chrome.browser.preferences.ChromeBasePreference; import org.chromium.chrome.browser.preferences.ChromeBasePreference;
import org.chromium.chrome.browser.preferences.ChromeSwitchPreference; import org.chromium.chrome.browser.preferences.ChromeSwitchPreference;
...@@ -34,6 +35,7 @@ import org.chromium.chrome.browser.preferences.PrefServiceBridge; ...@@ -34,6 +35,7 @@ import org.chromium.chrome.browser.preferences.PrefServiceBridge;
import org.chromium.chrome.browser.preferences.PreferencesLauncher; import org.chromium.chrome.browser.preferences.PreferencesLauncher;
import org.chromium.chrome.browser.preferences.SearchUtils; import org.chromium.chrome.browser.preferences.SearchUtils;
import org.chromium.chrome.browser.preferences.TextMessagePreference; import org.chromium.chrome.browser.preferences.TextMessagePreference;
import org.chromium.chrome.browser.profiles.Profile;
import org.chromium.ui.text.SpanApplier; import org.chromium.ui.text.SpanApplier;
import java.util.Locale; import java.util.Locale;
...@@ -152,7 +154,7 @@ public class SavePasswordsPreferences ...@@ -152,7 +154,7 @@ public class SavePasswordsPreferences
menu.findItem(R.id.export_passwords).setEnabled(false); menu.findItem(R.id.export_passwords).setEnabled(false);
mSearchItem = menu.findItem(R.id.menu_id_search); mSearchItem = menu.findItem(R.id.menu_id_search);
mSearchItem.setVisible(true); mSearchItem.setVisible(true);
mHelpItem = menu.findItem(R.id.menu_id_general_help); mHelpItem = menu.findItem(R.id.menu_id_targeted_help);
SearchUtils.initializeSearchView( SearchUtils.initializeSearchView(
mSearchItem, mSearchQuery, getActivity(), this::filterPasswords); mSearchItem, mSearchQuery, getActivity(), this::filterPasswords);
} }
...@@ -174,6 +176,12 @@ public class SavePasswordsPreferences ...@@ -174,6 +176,12 @@ public class SavePasswordsPreferences
filterPasswords(null); filterPasswords(null);
return true; return true;
} }
if (id == R.id.menu_id_targeted_help) {
HelpAndFeedback.getInstance(getActivity())
.show(getActivity(), getString(R.string.help_context_passwords),
Profile.getLastUsedProfile(), null);
return true;
}
return super.onOptionsItemSelected(item); return super.onOptionsItemSelected(item);
} }
......
...@@ -1779,7 +1779,7 @@ public class SavePasswordsPreferencesTest { ...@@ -1779,7 +1779,7 @@ public class SavePasswordsPreferencesTest {
// Retrieve the initial status and ensure that the help option is there at all. // Retrieve the initial status and ensure that the help option is there at all.
final AtomicReference<Boolean> helpInOverflowMenu = new AtomicReference<>(false); final AtomicReference<Boolean> helpInOverflowMenu = new AtomicReference<>(false);
Espresso.onView(withId(R.id.menu_id_general_help)).check((helpMenuItem, e) -> { Espresso.onView(withId(R.id.menu_id_targeted_help)).check((helpMenuItem, e) -> {
ActionMenuItemView view = (ActionMenuItemView) helpMenuItem; ActionMenuItemView view = (ActionMenuItemView) helpMenuItem;
helpInOverflowMenu.set(view == null || !view.showsIcon()); helpInOverflowMenu.set(view == null || !view.showsIcon());
}); });
...@@ -1789,7 +1789,7 @@ public class SavePasswordsPreferencesTest { ...@@ -1789,7 +1789,7 @@ public class SavePasswordsPreferencesTest {
Espresso.onView(withText(R.string.menu_help)).check(matches(isDisplayed())); Espresso.onView(withText(R.string.menu_help)).check(matches(isDisplayed()));
Espresso.pressBack(); // to close the Overflow menu. Espresso.pressBack(); // to close the Overflow menu.
} else { } else {
Espresso.onView(withId(R.id.menu_id_general_help)).check(matches(isDisplayed())); Espresso.onView(withId(R.id.menu_id_targeted_help)).check(matches(isDisplayed()));
} }
// Trigger the search, close it and wait for UI to be restored. // Trigger the search, close it and wait for UI to be restored.
...@@ -1806,10 +1806,10 @@ public class SavePasswordsPreferencesTest { ...@@ -1806,10 +1806,10 @@ public class SavePasswordsPreferencesTest {
openActionBarOverflowOrOptionsMenu( openActionBarOverflowOrOptionsMenu(
InstrumentationRegistry.getInstrumentation().getTargetContext()); InstrumentationRegistry.getInstrumentation().getTargetContext());
Espresso.onView(withText(R.string.menu_help)).check(matches(isDisplayed())); Espresso.onView(withText(R.string.menu_help)).check(matches(isDisplayed()));
Espresso.onView(withId(R.id.menu_id_general_help)).check(doesNotExist()); Espresso.onView(withId(R.id.menu_id_targeted_help)).check(doesNotExist());
} else { } else {
Espresso.onView(withText(R.string.menu_help)).check(doesNotExist()); Espresso.onView(withText(R.string.menu_help)).check(doesNotExist());
Espresso.onView(withId(R.id.menu_id_general_help)).check(matches(isDisplayed())); Espresso.onView(withId(R.id.menu_id_targeted_help)).check(matches(isDisplayed()));
} }
} }
......
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