Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(32)

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/contextmenu/ChromeContextMenuPopulator.java

Issue 2841543003: changed ordering of context menu to display image/video tab before link tab (Closed)
Patch Set: fixing the adding to groups actually this time Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/android/java/res/layout/tabular_context_menu.xml ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/android/java/src/org/chromium/chrome/browser/contextmenu/ChromeContextMenuPopulator.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/contextmenu/ChromeContextMenuPopulator.java b/chrome/android/java/src/org/chromium/chrome/browser/contextmenu/ChromeContextMenuPopulator.java
index 5fec9e7fa010e1aa8fcc7bbde4bdd7908dbf824f..50010458599e3d9e6efceb269f43c3ed35d8bcb1 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/contextmenu/ChromeContextMenuPopulator.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/contextmenu/ChromeContextMenuPopulator.java
@@ -16,6 +16,7 @@ import android.webkit.MimeTypeMap;
import org.chromium.base.CollectionUtil;
import org.chromium.base.metrics.RecordHistogram;
import org.chromium.chrome.R;
+import org.chromium.chrome.browser.ChromeFeatureList;
import org.chromium.chrome.browser.firstrun.FirstRunStatus;
import org.chromium.chrome.browser.preferences.ChromePreferenceManager;
import org.chromium.chrome.browser.preferences.datareduction.DataReductionProxyUma;
@@ -260,7 +261,8 @@ public class ChromeContextMenuPopulator implements ContextMenuPopulator {
Set<ContextMenuItem> disabledOptions = getDisabledOptions(params);
// Split the items into their respective groups.
List<Pair<Integer, List<ContextMenuItem>>> groupedItems = new ArrayList<>();
- if (params.isAnchor()) {
+ if (params.isAnchor()
+ && !ChromeFeatureList.isEnabled(ChromeFeatureList.CUSTOM_CONTEXT_MENU)) {
populateItemGroup(LINK, R.string.contextmenu_link_title, groupedItems, supportedOptions,
disabledOptions);
}
@@ -272,6 +274,11 @@ public class ChromeContextMenuPopulator implements ContextMenuPopulator {
populateItemGroup(VIDEO, R.string.contextmenu_video_title, groupedItems,
supportedOptions, disabledOptions);
}
+ if (params.isAnchor()
+ && ChromeFeatureList.isEnabled(ChromeFeatureList.CUSTOM_CONTEXT_MENU)) {
+ populateItemGroup(LINK, R.string.contextmenu_link_title, groupedItems, supportedOptions,
+ disabledOptions);
+ }
// If there are no groups there still needs to be a way to add items from the OTHER_GROUP
// and CUSTOM_TAB_GROUP.
@@ -289,17 +296,20 @@ public class ChromeContextMenuPopulator implements ContextMenuPopulator {
// These items don't belong to any official group so they are added to a possible visible
// list.
- addValidItems(groupedItems.get(groupedItems.size() - 1).second, OTHER_GROUP,
+ int index = ChromeFeatureList.isEnabled(ChromeFeatureList.CUSTOM_CONTEXT_MENU)
+ ? groupedItems.size() - 1
+ : 0;
Daniel Park 2017/05/05 18:47:58 assuming the content long pressed were solely a li
+ addValidItems(groupedItems.get(groupedItems.size() - 1 - index).second, OTHER_GROUP,
supportedOptions, disabledOptions);
if (mMode == CUSTOM_TAB_MODE) {
- addValidItemsToFront(groupedItems.get(0).second, CUSTOM_TAB_GROUP, supportedOptions,
+ addValidItemsToFront(groupedItems.get(index).second, CUSTOM_TAB_GROUP, supportedOptions,
disabledOptions);
}
- // If there are no items from the extra items withing OTHER_GROUP and CUSTOM_TAB_GROUP, then
+ // If there are no items from the extra items within OTHER_GROUP and CUSTOM_TAB_GROUP, then
// it's removed since there is nothing to show at all.
- if (groupedItems.get(0).second.isEmpty()) {
- groupedItems.remove(0);
+ if (groupedItems.get(index).second.isEmpty()) {
+ groupedItems.remove(index);
}
return groupedItems;
« no previous file with comments | « chrome/android/java/res/layout/tabular_context_menu.xml ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698