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

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

Issue 2842303002: "Open in new chrome tab" and "open in incognito tab" missing for images in context menu CCT. (Closed)
Patch Set: Update Ted's nit. Created 3 years, 8 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 | 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 279ac2537ccac6fab25ed66dce892a186a6e6f70..5fec9e7fa010e1aa8fcc7bbde4bdd7908dbf824f 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
@@ -396,13 +396,10 @@ public class ChromeContextMenuPopulator implements ContextMenuPopulator {
disabledOptions.add(ContextMenuItem.OPEN_IN_INCOGNITO_TAB);
}
- if (TextUtils.isEmpty(params.getLinkUrl())
- || params.getLinkUrl().equals(ContentUrlConstants.ABOUT_BLANK_DISPLAY_URL)) {
+ if (isEmptyUrl(params.getLinkUrl())) {
disabledOptions.add(ContextMenuItem.OPEN_IN_OTHER_WINDOW);
disabledOptions.add(ContextMenuItem.OPEN_IN_NEW_TAB);
disabledOptions.add(ContextMenuItem.OPEN_IN_INCOGNITO_TAB);
- disabledOptions.add(ContextMenuItem.OPEN_IN_CHROME_INCOGNITO_TAB);
- disabledOptions.add(ContextMenuItem.OPEN_IN_NEW_CHROME_TAB);
}
if (MailTo.isMailTo(params.getLinkUrl())) {
@@ -484,7 +481,7 @@ public class ChromeContextMenuPopulator implements ContextMenuPopulator {
if (mMode == CUSTOM_TAB_MODE) {
try {
URI uri = new URI(getUrl(params));
- if (UrlUtilities.isInternalScheme(uri)) {
+ if (UrlUtilities.isInternalScheme(uri) || isEmptyUrl(getUrl(params))) {
disabledOptions.add(ContextMenuItem.OPEN_IN_NEW_CHROME_TAB);
disabledOptions.add(ContextMenuItem.OPEN_IN_CHROME_INCOGNITO_TAB);
disabledOptions.add(ContextMenuItem.OPEN_IN_BROWSER_ID);
@@ -607,6 +604,18 @@ public class ChromeContextMenuPopulator implements ContextMenuPopulator {
}
/**
+ * Checks whether a url is empty or blank.
+ * @param url The url need to be checked.
+ * @return True if the url is empty or "about:blank".
+ */
+ private boolean isEmptyUrl(String url) {
+ if (TextUtils.isEmpty(url) || url.equals(ContentUrlConstants.ABOUT_BLANK_DISPLAY_URL)) {
+ return true;
+ }
+ return false;
+ }
+
+ /**
* The valid url of a link is stored in the linkUrl of ContextMenuParams while the
* valid url of a image or video is stored in the srcUrl of ContextMenuParams.
* @param params The parameters used to decide the type of the content.
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698