[Home] Allow bookmarks, downloads, and history menu items to open sheet
This change adds a finch flag "ChromeHomeMenuItemsExpandSheet" that
allows the bookmarks, downloads, and history menu items to be shown
despite Chrome Home being enabled. Selecting these items expands the
bottom sheet to half height with the selected content being shown.
The tap count will be reset if either Chrome Home or the feature is
disabled. Tap count can be configured via finch with the "max_taps"
parameter.
BUG=792573
Change-Id: Ibc66e59aa773a69c474f08e2fc7fa9c708d33468
Reviewed-on: https://chromium-review.googlesource.com/806257
Commit-Queue: Matthew Jones <[email protected]>
Reviewed-by: Theresa <[email protected]>
Reviewed-by: Ted Choc <[email protected]>
Cr-Commit-Position: refs/heads/master@{#525049}
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ChromeActivity.java b/chrome/android/java/src/org/chromium/chrome/browser/ChromeActivity.java
index 1f185d9..87f328ff 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/ChromeActivity.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/ChromeActivity.java
@@ -1885,7 +1885,7 @@
NewTabPageUma.recordAction(NewTabPageUma.ACTION_OPENED_HISTORY_MANAGER);
}
RecordUserAction.record("MobileMenuHistory");
- HistoryManagerUtils.showHistoryManager(this, currentTab);
+ HistoryManagerUtils.showHistoryManager(this, currentTab, true);
StartupMetrics.getInstance().recordOpenedHistory();
} else if (id == R.id.share_menu_id || id == R.id.direct_share_menu_id) {
onShareMenuItemSelected(id == R.id.direct_share_menu_id,
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ChromeFeatureList.java b/chrome/android/java/src/org/chromium/chrome/browser/ChromeFeatureList.java
index 0c37c01..1f40637 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/ChromeFeatureList.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/ChromeFeatureList.java
@@ -165,6 +165,8 @@
"ChromeHomeDropAllButFirstThumbnail";
public static final String CHROME_HOME_INACTIVITY_SHEET_EXPANSION =
"ChromeHomeInactivitySheetExpansion";
+ public static final String CHROME_HOME_MENU_ITEMS_EXPAND_SHEET =
+ "ChromeHomeMenuItemsExpandSheet";
public static final String CHROME_HOME_OPT_OUT_SNACKBAR = "ChromeHomeOptOutSnackbar";
public static final String CHROME_HOME_PERSISTENT_IPH = "ChromeHomePersistentIph";
public static final String CHROME_HOME_PERSONALIZED_OMNIBOX_SUGGESTIONS =
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ChromeTabbedActivity.java b/chrome/android/java/src/org/chromium/chrome/browser/ChromeTabbedActivity.java
index b71f946..90a9084 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/ChromeTabbedActivity.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/ChromeTabbedActivity.java
@@ -1693,7 +1693,8 @@
// Return early if the conditions aren't right to show the Chrome Home IPH menu
// header.
if (mControlContainer.getVisibility() != View.VISIBLE
- || getBottomSheet().isSheetOpen() || !isPageMenu) {
+ || getBottomSheet().isSheetOpen() || !isPageMenu
+ || AppMenuPropertiesDelegate.shouldShowNavMenuItems()) {
return null;
}
@@ -1834,7 +1835,7 @@
if (currentTab != null) {
getCompositorViewHolder().hideKeyboard(() -> {
StartupMetrics.getInstance().recordOpenedBookmarks();
- BookmarkUtils.showBookmarkManager(ChromeTabbedActivity.this);
+ BookmarkUtils.showBookmarkManager(ChromeTabbedActivity.this, true);
});
if (currentTabIsNtp) {
NewTabPageUma.recordAction(NewTabPageUma.ACTION_OPENED_BOOKMARKS_MANAGER);
@@ -1873,7 +1874,7 @@
getToolbarManager().setUrlBarFocus(true);
}
} else if (id == R.id.downloads_menu_id) {
- DownloadUtils.showDownloadManager(this, currentTab);
+ DownloadUtils.showDownloadManager(this, currentTab, true);
if (currentTabIsNtp) {
NewTabPageUma.recordAction(NewTabPageUma.ACTION_OPENED_DOWNLOADS_MANAGER);
}
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/appmenu/AppMenuPropertiesDelegate.java b/chrome/android/java/src/org/chromium/chrome/browser/appmenu/AppMenuPropertiesDelegate.java
index 91a809f..581b4f6 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/appmenu/AppMenuPropertiesDelegate.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/appmenu/AppMenuPropertiesDelegate.java
@@ -20,9 +20,11 @@
import org.chromium.base.ApiCompatibilityUtils;
import org.chromium.base.CommandLine;
import org.chromium.base.ContextUtils;
+import org.chromium.base.StrictModeContext;
import org.chromium.base.metrics.RecordHistogram;
import org.chromium.chrome.R;
import org.chromium.chrome.browser.ChromeActivity;
+import org.chromium.chrome.browser.ChromeFeatureList;
import org.chromium.chrome.browser.ChromeSwitches;
import org.chromium.chrome.browser.ShortcutHelper;
import org.chromium.chrome.browser.UrlConstants;
@@ -31,6 +33,7 @@
import org.chromium.chrome.browser.download.DownloadUtils;
import org.chromium.chrome.browser.multiwindow.MultiWindowUtils;
import org.chromium.chrome.browser.omaha.UpdateMenuItemHelper;
+import org.chromium.chrome.browser.preferences.ChromePreferenceManager;
import org.chromium.chrome.browser.preferences.ManagedPreferencesUtils;
import org.chromium.chrome.browser.preferences.PrefServiceBridge;
import org.chromium.chrome.browser.share.ShareHelper;
@@ -46,6 +49,24 @@
* App Menu helper that handles hiding and showing menu items based on activity state.
*/
public class AppMenuPropertiesDelegate {
+ /**
+ * The param name for the "ChromeHomeMenuItemsExpandSheet" experiment. This specifies the number
+ * of times a menu item can be tapped before being hidden.
+ */
+ private static final String CHROME_HOME_MENU_ITEM_TAP_PARAM_NAME = "max_taps";
+
+ /**
+ * The number of times that bookmarks, downloads, and history can be triggered from the overflow
+ * menu in Chrome Home before they are hidden.
+ */
+ private static final int CHROME_HOME_MENU_ITEM_TAP_MAX = 10;
+
+ /**
+ * Whether or not the Chrome Home menu items should be hidden because they have been tapped the
+ * maximum number of times.
+ */
+ private static boolean sHideChromeHomeMenuItems;
+
protected MenuItem mReloadMenuItem;
protected final ChromeActivity mActivity;
@@ -212,7 +233,7 @@
menu.findItem(R.id.enter_vr_id).setVisible(
CommandLine.getInstance().hasSwitch(ChromeSwitches.ENABLE_VR_SHELL_DEV));
- if (FeatureUtilities.isChromeHomeEnabled()) {
+ if (!shouldShowNavMenuItems()) {
// History, downloads, and bookmarks are shown in the Chrome Home bottom sheet.
menu.findItem(R.id.open_history_menu_id).setVisible(false);
menu.findItem(R.id.downloads_menu_id).setVisible(false);
@@ -455,4 +476,32 @@
? mActivity.getString(R.string.menu_request_desktop_site_on)
: mActivity.getString(R.string.menu_request_desktop_site_off));
}
+
+ /**
+ * @return Whether bookmarks, downloads, and history should be shown in the menu.
+ */
+ public static boolean shouldShowNavMenuItems() {
+ if (!FeatureUtilities.isChromeHomeEnabled()) return true;
+
+ try (StrictModeContext unused = StrictModeContext.allowDiskReads()) {
+ int maxTapCount = ChromeFeatureList.getFieldTrialParamByFeatureAsInt(
+ ChromeFeatureList.CHROME_HOME_MENU_ITEMS_EXPAND_SHEET,
+ CHROME_HOME_MENU_ITEM_TAP_PARAM_NAME, CHROME_HOME_MENU_ITEM_TAP_MAX);
+
+ sHideChromeHomeMenuItems = sHideChromeHomeMenuItems
+ || ChromePreferenceManager.getInstance().getChromeHomeMenuItemClickCount()
+ >= maxTapCount;
+ }
+
+ boolean chromeHomeMenuItemFlagEnabled = ChromeFeatureList.isInitialized()
+ && ChromeFeatureList.isEnabled(
+ ChromeFeatureList.CHROME_HOME_MENU_ITEMS_EXPAND_SHEET);
+
+ // If Chrome Home or the menu item feature is disabled, clear the menu tap preference.
+ if (!chromeHomeMenuItemFlagEnabled) {
+ ChromePreferenceManager.getInstance().clearChromeHomeMenuItemClickCount();
+ }
+
+ return chromeHomeMenuItemFlagEnabled && !sHideChromeHomeMenuItems;
+ }
}
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/bookmarks/BookmarkUtils.java b/chrome/android/java/src/org/chromium/chrome/browser/bookmarks/BookmarkUtils.java
index abe3cda..c17018d 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/bookmarks/BookmarkUtils.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/bookmarks/BookmarkUtils.java
@@ -157,14 +157,29 @@
/**
* Shows bookmark main UI.
+ * @param activity An activity to start the manager with.
*/
public static void showBookmarkManager(ChromeActivity activity) {
+ showBookmarkManager(activity, false);
+ }
+
+ /**
+ * Shows bookmark main UI.
+ * @param activity An activity to start the manager with.
+ * @param fromMenu Whether bookmarks was triggered from the overflow menu.
+ */
+ public static void showBookmarkManager(ChromeActivity activity, boolean fromMenu) {
ThreadUtils.assertOnUiThread();
String url = getFirstUrlToLoad(activity);
if (activity.getBottomSheet() != null) {
- activity.getBottomSheetContentController().showContentAndOpenSheet(
- R.id.action_bookmarks);
+ if (fromMenu) {
+ activity.getBottomSheetContentController().openBottomSheetForMenuItem(
+ R.id.action_bookmarks);
+ } else {
+ activity.getBottomSheetContentController().showContentAndOpenSheet(
+ R.id.action_bookmarks);
+ }
} else if (DeviceFormFactor.isTablet()) {
openUrl(activity, url, activity.getComponentName());
} else {
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadUtils.java b/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadUtils.java
index 0a92a0c1..f9d4809e 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadUtils.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadUtils.java
@@ -122,13 +122,27 @@
/**
* Displays the download manager UI. Note the UI is different on tablets and on phones.
+ * @param activity The current activity is available.
+ * @param tab The current tab if it exists.
* @return Whether the UI was shown.
*/
public static boolean showDownloadManager(@Nullable Activity activity, @Nullable Tab tab) {
+ return showDownloadManager(activity, tab, false);
+ }
+
+ /**
+ * Displays the download manager UI. Note the UI is different on tablets and on phones.
+ * @param activity The current activity is available.
+ * @param tab The current tab if it exists.
+ * @param fromMenu Whether the manager was triggered from the overflow menu.
+ * @return Whether the UI was shown.
+ */
+ public static boolean showDownloadManager(
+ @Nullable Activity activity, @Nullable Tab tab, boolean fromMenu) {
// Figure out what tab was last being viewed by the user.
if (activity == null) activity = ApplicationStatus.getLastTrackedFocusedActivity();
- if (openDownloadsManagerInBottomSheet(activity)) return true;
+ if (openDownloadsManagerInBottomSheet(activity, fromMenu)) return true;
if (tab == null && activity instanceof ChromeTabbedActivity) {
tab = ((ChromeTabbedActivity) activity).getActivityTab();
@@ -186,9 +200,10 @@
/**
* @param activity The activity the download manager should be displayed in if applicable or
* the last tracked focused activity.
+ * @param fromMenu Whether downloads was triggered from the overflow menu.
* @return Whether the downloads manager was opened in the Chrome Home bottom sheet.
*/
- private static boolean openDownloadsManagerInBottomSheet(Activity activity) {
+ private static boolean openDownloadsManagerInBottomSheet(Activity activity, boolean fromMenu) {
if (!FeatureUtilities.isChromeHomeEnabled()) return false;
Context appContext = ContextUtils.getApplicationContext();
@@ -209,14 +224,19 @@
if (tabbedActivity == null) return false;
- tabbedActivity.getBottomSheetContentController().showContentAndOpenSheet(
- R.id.action_downloads);
+ if (fromMenu) {
+ tabbedActivity.getBottomSheetContentController().openBottomSheetForMenuItem(
+ R.id.action_downloads);
+ } else {
+ tabbedActivity.getBottomSheetContentController().showContentAndOpenSheet(
+ R.id.action_downloads);
- // Bring the ChromeTabbedActivity to the front.
- Intent intent = new Intent(appContext, tabbedActivity.getClass());
- intent.addFlags(Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT);
- intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
- appContext.startActivity(intent);
+ // Bring the ChromeTabbedActivity to the front.
+ Intent intent = new Intent(appContext, tabbedActivity.getClass());
+ intent.addFlags(Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT);
+ intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+ appContext.startActivity(intent);
+ }
return true;
}
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/history/HistoryManagerUtils.java b/chrome/android/java/src/org/chromium/chrome/browser/history/HistoryManagerUtils.java
index f944f5a..4a9dea87 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/history/HistoryManagerUtils.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/history/HistoryManagerUtils.java
@@ -28,9 +28,27 @@
* {@link HistoryManager}.
*/
public static void showHistoryManager(ChromeActivity activity, Tab tab) {
+ showHistoryManager(activity, tab, false);
+ }
+
+ /**
+ * Opens the browsing history manager.
+ *
+ * @param activity The {@link ChromeActivity} that owns the {@link HistoryManager}.
+ * @param tab The {@link Tab} to used to display the native page version of the
+ * {@link HistoryManager}.
+ * @param fromMenu Whether history is being triggered from the overflow menu.
+ */
+ public static void showHistoryManager(ChromeActivity activity, Tab tab, boolean fromMenu) {
Context appContext = ContextUtils.getApplicationContext();
if (activity.getBottomSheet() != null) {
- activity.getBottomSheetContentController().showContentAndOpenSheet(R.id.action_history);
+ if (fromMenu) {
+ activity.getBottomSheetContentController().openBottomSheetForMenuItem(
+ R.id.action_history);
+ } else {
+ activity.getBottomSheetContentController().showContentAndOpenSheet(
+ R.id.action_history);
+ }
} else if (DeviceFormFactor.isTablet()) {
// History shows up as a tab on tablets.
LoadUrlParams params = new LoadUrlParams(UrlConstants.NATIVE_HISTORY_URL);
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/preferences/ChromePreferenceManager.java b/chrome/android/java/src/org/chromium/chrome/browser/preferences/ChromePreferenceManager.java
index fb0aaf3c88..2c19603a 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/preferences/ChromePreferenceManager.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/preferences/ChromePreferenceManager.java
@@ -70,6 +70,9 @@
public static final String CHROME_HOME_INFO_PROMO_SHOWN_KEY = "chrome_home_info_promo_shown";
+ private static final String CHROME_HOME_MENU_ITEM_CLICK_COUNT_KEY =
+ "chrome_home_menu_item_click_count";
+
private static class LazyHolder {
static final ChromePreferenceManager INSTANCE = new ChromePreferenceManager();
}
@@ -461,6 +464,30 @@
return mSharedPreferences.getBoolean(CHROME_HOME_OPT_OUT_SNACKBAR_SHOWN, false);
}
+ /**
+ * @return The number of times that bookmarks, history, or downloads have been triggered from
+ * the overflow menu while Chrome Home is enabled.
+ */
+ public int getChromeHomeMenuItemClickCount() {
+ return readInt(CHROME_HOME_MENU_ITEM_CLICK_COUNT_KEY);
+ }
+
+ /**
+ * Increment the count for the number of times bookmarks, history, or downloads have been
+ * triggered from the overflow menu while Chrome Home is enabled.
+ */
+ public void incrementChromeHomeMenuItemClickCount() {
+ writeInt(CHROME_HOME_MENU_ITEM_CLICK_COUNT_KEY, getChromeHomeMenuItemClickCount() + 1);
+ }
+
+ /**
+ * Remove the count for number of times bookmarks, history, or downloads were clicked while
+ * Chrome Home is enabled.
+ */
+ public void clearChromeHomeMenuItemClickCount() {
+ mSharedPreferences.edit().remove(CHROME_HOME_MENU_ITEM_CLICK_COUNT_KEY).apply();
+ }
+
/** Marks that the content suggestions surface has been shown. */
public void setSuggestionsSurfaceShown() {
writeBoolean(CONTENT_SUGGESTIONS_SHOWN_KEY, true);
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/widget/bottomsheet/BottomSheetContentController.java b/chrome/android/java/src/org/chromium/chrome/browser/widget/bottomsheet/BottomSheetContentController.java
index 78e87cc..2643ffb0 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/widget/bottomsheet/BottomSheetContentController.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/widget/bottomsheet/BottomSheetContentController.java
@@ -12,6 +12,7 @@
import android.content.res.ColorStateList;
import android.graphics.PointF;
import android.graphics.drawable.Drawable;
+import android.support.annotation.IdRes;
import android.support.annotation.IntDef;
import android.support.annotation.Nullable;
import android.util.AttributeSet;
@@ -29,6 +30,7 @@
import org.chromium.base.ApplicationStatus;
import org.chromium.base.ApplicationStatus.ActivityStateListener;
import org.chromium.base.ContextUtils;
+import org.chromium.base.StrictModeContext;
import org.chromium.base.VisibleForTesting;
import org.chromium.base.library_loader.LibraryProcessType;
import org.chromium.chrome.R;
@@ -38,6 +40,7 @@
import org.chromium.chrome.browser.download.DownloadSheetContent;
import org.chromium.chrome.browser.history.HistorySheetContent;
import org.chromium.chrome.browser.ntp.IncognitoBottomSheetContent;
+import org.chromium.chrome.browser.preferences.ChromePreferenceManager;
import org.chromium.chrome.browser.snackbar.SnackbarManager;
import org.chromium.chrome.browser.suggestions.SuggestionsBottomSheetContent;
import org.chromium.chrome.browser.tabmodel.EmptyTabModelSelectorObserver;
@@ -51,6 +54,7 @@
import org.chromium.chrome.browser.widget.bottomsheet.BottomSheet.StateChangeReason;
import org.chromium.chrome.browser.widget.bottomsheet.base.BottomNavigationView;
import org.chromium.chrome.browser.widget.bottomsheet.base.BottomNavigationView.OnNavigationItemSelectedListener;
+import org.chromium.chrome.browser.widget.textbubble.ViewAnchoredTextBubble;
import org.chromium.content.browser.BrowserStartupController;
import org.chromium.ui.UiUtils;
@@ -175,8 +179,12 @@
if (mShouldOpenSheetOnNextContentChange) {
mShouldOpenSheetOnNextContentChange = false;
- if (mBottomSheet.getSheetState() != BottomSheet.SHEET_STATE_FULL) {
- mBottomSheet.setSheetState(BottomSheet.SHEET_STATE_FULL, true);
+ @BottomSheet.SheetState
+ int targetState = mShouldOpenSheetToHalfOnNextContentChange
+ ? BottomSheet.SHEET_STATE_HALF
+ : BottomSheet.SHEET_STATE_FULL;
+ if (mBottomSheet.getSheetState() != targetState) {
+ mBottomSheet.setSheetState(targetState, true);
}
return;
}
@@ -198,6 +206,7 @@
private int mSelectedItemId;
private ChromeActivity mActivity;
private boolean mShouldOpenSheetOnNextContentChange;
+ private boolean mShouldOpenSheetToHalfOnNextContentChange;
private boolean mShouldClearContentsOnNextContentChange;
private PlaceholderSheetContent mPlaceholderContent;
private boolean mOmniboxHasFocus;
@@ -747,4 +756,65 @@
animator.start();
}
}
+
+ /**
+ * Record a menu item click and open the bottom sheet to the specified content. This method
+ * assumes that Chrome Home is enabled.
+ * @param navId The bottom sheet navigation id to open.
+ */
+ public void openBottomSheetForMenuItem(@IdRes int navId) {
+ try (StrictModeContext unused = StrictModeContext.allowDiskReads()) {
+ ChromePreferenceManager.getInstance().incrementChromeHomeMenuItemClickCount();
+ }
+
+ mShouldOpenSheetToHalfOnNextContentChange = true;
+ final View highlightedView = findViewById(navId);
+
+ int stringId = 0;
+ if (navId == R.id.action_bookmarks) {
+ stringId = R.string.chrome_home_menu_bookmarks_help_bubble;
+ } else if (navId == R.id.action_downloads) {
+ stringId = R.string.chrome_home_menu_downloads_help_bubble;
+ } else if (navId == R.id.action_history) {
+ stringId = R.string.chrome_home_menu_history_help_bubble;
+ } else {
+ throw new RuntimeException("Attempting to show invalid content in bottom sheet.");
+ }
+
+ final ViewAnchoredTextBubble helpBubble =
+ new ViewAnchoredTextBubble(getContext(), mBottomSheet, stringId, stringId);
+ helpBubble.setDismissOnTouchInteraction(true);
+
+ mBottomSheet.addObserver(new EmptyBottomSheetObserver() {
+ /** Whether the help bubble has been shown. */
+ private boolean mHelpBubbleShown;
+
+ @Override
+ public void onSheetContentChanged(BottomSheet.BottomSheetContent newContent) {
+ if (getSheetContentForId(navId) == newContent) return;
+ post(() -> {
+ ViewHighlighter.turnOffHighlight(highlightedView);
+ mBottomSheet.removeObserver(this);
+ });
+ }
+
+ @Override
+ public void onSheetOpened(@StateChangeReason int reason) {
+ ViewHighlighter.turnOnHighlight(highlightedView, false);
+ mShouldOpenSheetToHalfOnNextContentChange = false;
+ }
+
+ @Override
+ public void onSheetStateChanged(@BottomSheet.SheetState int state) {
+ if (state != BottomSheet.SHEET_STATE_HALF || mHelpBubbleShown) return;
+ int inset = getContext().getResources().getDimensionPixelSize(
+ R.dimen.bottom_sheet_help_bubble_inset);
+ helpBubble.setInsetPx(0, inset, 0, inset);
+ helpBubble.show();
+ mHelpBubbleShown = true;
+ }
+ });
+
+ showContentAndOpenSheet(navId);
+ }
}
diff --git a/chrome/android/java/strings/android_chrome_strings.grd b/chrome/android/java/strings/android_chrome_strings.grd
index b7fa08e..180a5ddb 100644
--- a/chrome/android/java/strings/android_chrome_strings.grd
+++ b/chrome/android/java/strings/android_chrome_strings.grd
@@ -3247,6 +3247,15 @@
<message name="IDS_BOTTOM_SHEET_APP_MENU_IPH" desc="Label for in-product help that appears in the Chrome three-dot menu (navigation menu). In previous versions of Chrome, the menu contained Downloads, Bookmarks, and History. In this version of Chrome, these three items have been moved out of the menu. Tapping this help text will show the user where they can find these three items. 'Downloads', 'Bookmarks', and 'History' should use the same translations as in Chrome settings and menu items. The tone of this string is that of the user asking Chrome, 'where are these 3 things?'">
Where are downloads, bookmarks, and history?
</message>
+ <message name="IDS_CHROME_HOME_MENU_BOOKMARKS_HELP_BUBBLE" desc="Help text. Shown after a user taps the ‘Bookmarks’ item in the three-dot menu of mobile Chrome. Context: In Chrome Hub, ‘Bookmarks’ is moving from the three-dot menu to a bottom navigation bar, which can be accessed by swiping the address bar up. This help text notifies the user of the change. Please ensure ‘Bookmarks’ in this message matches the ‘Bookmarks’ menu item and button label.">
+ “Bookmarks” is moving. Next time, pull the address bar up.
+ </message>
+ <message name="IDS_CHROME_HOME_MENU_DOWNLOADS_HELP_BUBBLE" desc="Help text. Shown after a user taps the ‘Downloads’ item in the three-dot menu of mobile Chrome. Context: In Chrome Hub, ‘Downloads’ is moving from the three-dot menu to a bottom navigation bar, which can be accessed by swiping the address bar up. This help text notifies the user of the change. Please ensure ‘Downloads’ in this message matches the ‘Downloads’ menu item and button label.">
+ “Downloads” is moving. Next time, pull the address bar up.
+ </message>
+ <message name="IDS_CHROME_HOME_MENU_HISTORY_HELP_BUBBLE" desc="Help text. Shown after a user taps the ‘History’ item in the three-dot menu of mobile Chrome. Context: In Chrome Hub, ‘History’ is moving from the three-dot menu to a bottom navigation bar, which can be accessed by swiping the address bar up. This help text notifies the user of the change. Please ensure ‘History’ in this message matches the ‘History’ menu item and button label.">
+ “History” is moving. Next time, pull the address bar up.
+ </message>
<message name="IDS_CHROME_HOME_PROMO_DIALOG_MESSAGE" desc="Dialog body text. Describes the new features available in the new Chrome. “Swipe up” (imperative) refers to the gesture on a mobile phone. “access” is a noun. “Popular” modifies both “sites and articles.” “Downloads” refers to items the user has downloaded in Chrome.">
Swipe up for easy access to popular sites and articles, downloads, and more
</message>
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/bookmarks/BookmarkPersonalizedSigninPromoTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/bookmarks/BookmarkPersonalizedSigninPromoTest.java
index 3a63b09..5a93235 100644
--- a/chrome/android/javatests/src/org/chromium/chrome/browser/bookmarks/BookmarkPersonalizedSigninPromoTest.java
+++ b/chrome/android/javatests/src/org/chromium/chrome/browser/bookmarks/BookmarkPersonalizedSigninPromoTest.java
@@ -161,7 +161,7 @@
private void openBookmarkManager() throws InterruptedException {
ThreadUtils.runOnUiThreadBlocking(
- () -> BookmarkUtils.showBookmarkManager(mActivityTestRule.getActivity()));
+ () -> BookmarkUtils.showBookmarkManager(mActivityTestRule.getActivity(), false));
}
private void addTestAccount() {
diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc
index d96cef4..7f64263 100644
--- a/chrome/browser/about_flags.cc
+++ b/chrome/browser/about_flags.cc
@@ -1902,6 +1902,10 @@
flag_descriptions::kChromeHomeInactivitySheetExpansionDescription,
kOsAndroid,
FEATURE_VALUE_TYPE(chrome::android::kChromeHomeInactivitySheetExpansion)},
+ {"enable-chrome-home-menu-items",
+ flag_descriptions::kChromeHomeMenuItemsName,
+ flag_descriptions::kChromeHomeMenuItemsDescription, kOsAndroid,
+ FEATURE_VALUE_TYPE(chrome::android::kChromeHomeMenuItemsExpandSheet)},
{"enable-chrome-home-opt-out-snackbar",
flag_descriptions::kChromeHomeOptOutSnackbarName,
flag_descriptions::kChromeHomeOptOutSnackbarDescription, kOsAndroid,
diff --git a/chrome/browser/android/chrome_feature_list.cc b/chrome/browser/android/chrome_feature_list.cc
index 723e27bd..f0e88bb 100644
--- a/chrome/browser/android/chrome_feature_list.cc
+++ b/chrome/browser/android/chrome_feature_list.cc
@@ -68,6 +68,7 @@
&kChromeHomeDestroySuggestions,
&kChromeHomeDropAllButFirstThumbnail,
&kChromeHomeInactivitySheetExpansion,
+ &kChromeHomeMenuItemsExpandSheet,
&kChromeHomePersistentIph,
&kChromeHomePromo,
&kChromeHomePromoInfoOnly,
@@ -197,6 +198,9 @@
const base::Feature kChromeHomeInactivitySheetExpansion{
"ChromeHomeInactivitySheetExpansion", base::FEATURE_DISABLED_BY_DEFAULT};
+const base::Feature kChromeHomeMenuItemsExpandSheet{
+ "ChromeHomeMenuItemsExpandSheet", base::FEATURE_DISABLED_BY_DEFAULT};
+
const base::Feature kChromeHomePersistentIph{"ChromeHomePersistentIph",
base::FEATURE_DISABLED_BY_DEFAULT};
diff --git a/chrome/browser/android/chrome_feature_list.h b/chrome/browser/android/chrome_feature_list.h
index 4d5c2366..20df61b 100644
--- a/chrome/browser/android/chrome_feature_list.h
+++ b/chrome/browser/android/chrome_feature_list.h
@@ -27,6 +27,7 @@
extern const base::Feature kChromeHomeDestroySuggestions;
extern const base::Feature kChromeHomeDropAllButFirstThumbnail;
extern const base::Feature kChromeHomeInactivitySheetExpansion;
+extern const base::Feature kChromeHomeMenuItemsExpandSheet;
extern const base::Feature kChromeHomePersistentIph;
extern const base::Feature kChromeHomePromo;
extern const base::Feature kChromeHomePromoInfoOnly;
diff --git a/chrome/browser/flag_descriptions.cc b/chrome/browser/flag_descriptions.cc
index 1f81de4..4b6e71bb 100644
--- a/chrome/browser/flag_descriptions.cc
+++ b/chrome/browser/flag_descriptions.cc
@@ -1696,6 +1696,13 @@
"Expand bottom sheet on startup in Chrome Home after a period of"
" inactivity.";
+const char kChromeHomeMenuItemsName[] =
+ "Show bookmarks, downloads, and history menu items in Chrome Home";
+const char kChromeHomeMenuItemsDescription[] =
+ "Shows bookmarks, downloads, and history menu items in the overflow menu"
+ " when Chrome Home is enabled. These items will open the bottom sheet to"
+ " show the desired content.";
+
const char kChromeHomeOptOutSnackbarName[] = "Chrome Home Opt-out Snackbar";
const char kChromeHomeOptOutSnackbarDescription[] =
"Show a snackbar prompting users to take a survey the first time they"
diff --git a/chrome/browser/flag_descriptions.h b/chrome/browser/flag_descriptions.h
index 2a471056..2d384c7 100644
--- a/chrome/browser/flag_descriptions.h
+++ b/chrome/browser/flag_descriptions.h
@@ -1037,6 +1037,9 @@
extern const char kChromeHomeInactivitySheetExpansionName[];
extern const char kChromeHomeInactivitySheetExpansionDescription[];
+extern const char kChromeHomeMenuItemsName[];
+extern const char kChromeHomeMenuItemsDescription[];
+
extern const char kChromeHomeOptOutSnackbarName[];
extern const char kChromeHomeOptOutSnackbarDescription[];