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..b7a0dbac33b14d6f0f1464f96587bdbd616700a0 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 null, 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() && params.getLinkUrl() != null) { |
|
Ted C
2017/05/18 02:21:33
Should we use isEmptyUrl(params.getLinkUrl()) inst
ltian
2017/05/18 18:00:02
Done.
|
| return params.getLinkUrl(); |
| + } else { |
| + return params.getSrcUrl(); |
| } |
| } |
| } |