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

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

Issue 2626333002: (Android) make ContextMenu for links / images more clear and organized (Closed)
Patch Set: Created 3 years, 11 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 | « no previous file | chrome/android/java/src/org/chromium/chrome/browser/contextmenu/ContextMenuTitleView.java » ('j') | 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 19245314a796173cead492fcea65d5053cd3eecf..2c4c996cfc65e05ad78094da0018fe23c21ac7f5 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
@@ -183,10 +183,25 @@ public class ChromeContextMenuPopulator implements ContextMenuPopulator {
@Override
public void buildContextMenu(ContextMenu menu, Context context, ContextMenuParams params) {
- if (!TextUtils.isEmpty(params.getLinkUrl()) && !params.getLinkUrl().equals(BLANK_URL)) {
- setHeaderText(context, menu, params.getLinkUrl());
+ String title = "";
+ if (!TextUtils.isEmpty(params.getLinkText())) {
+ title += "<b>" + params.getLinkText() + "</b>";
} else if (!TextUtils.isEmpty(params.getTitleText())) {
- setHeaderText(context, menu, params.getTitleText());
+ title += "<b>" + params.getTitleText() + "</b>";
+ }
+ if (!TextUtils.isEmpty(params.getLinkUrl()) && !params.getLinkUrl().equals(BLANK_URL)) {
+ if (!TextUtils.isEmpty(title)) {
+ title += "<br>";
+ }
+ title += UrlUtilities.decodeUrl(params.getLinkUrl());
+ } else if (!TextUtils.isEmpty(params.getSrcUrl())) {
+ if (!TextUtils.isEmpty(title)) {
+ title += "<br>";
+ }
+ title += UrlUtilities.decodeUrl(params.getSrcUrl());
+ }
+ if (!TextUtils.isEmpty(title)) {
+ setHeaderText(context, menu, title);
}
if (mMenuInflater == null) mMenuInflater = new MenuInflater(context);
@@ -233,6 +248,12 @@ public class ChromeContextMenuPopulator implements ContextMenuPopulator {
menu.findItem(R.id.contextmenu_save_link_as).setVisible(
UrlUtilities.isDownloadableScheme(params.getLinkUrl()));
+ if (TextUtils.isEmpty(params.getLinkUrl()) || params.getLinkUrl().equals(BLANK_URL)) {
+ menu.findItem(R.id.contextmenu_open_in_other_window).setVisible(false);
+ menu.findItem(R.id.contextmenu_open_in_new_tab).setVisible(false);
+ menu.findItem(R.id.contextmenu_open_in_incognito_tab).setVisible(false);
+ }
+
if (params.imageWasFetchedLoFi()
|| !DataReductionProxySettings.getInstance().wasLoFiModeActiveOnMainFrame()
|| !DataReductionProxySettings.getInstance().canUseDataReductionProxy(
« no previous file with comments | « no previous file | chrome/android/java/src/org/chromium/chrome/browser/contextmenu/ContextMenuTitleView.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698