Chromium Code Reviews| 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..bdf123277b60dfddf23d6ee776542287118cc271 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 |
| @@ -616,15 +616,16 @@ public class ChromeContextMenuPopulator implements ContextMenuPopulator { |
| } |
| /** |
| - * 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. |
| + * Return the valid url of a ContextMenuParams. |
| + * If the ContextMenuParams is an anchor and its linkUrl is not empty, returns the linkUrl. |
| + * Otherwise returns the srcUrl. |
| + * @param params The {@link ContextMenuParams} to check. |
| */ |
| private String getUrl(ContextMenuParams params) { |
| - if (params.isImage() || params.isVideo()) { |
| - return params.getSrcUrl(); |
| - } else { |
| + if (params.isAnchor() && !isEmptyUrl(params.getLinkUrl())) { |
|
Ted C
2017/05/19 16:55:07
per offline discussion, let's remove the isEmptyUr
ltian
2017/05/19 18:02:04
Done.
|
| return params.getLinkUrl(); |
| + } else { |
| + return params.getSrcUrl(); |
| } |
| } |
| } |