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

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

Issue 2891583004: [Android] Fix 'open in browser' in CCT does not work for images in Google image search (Closed)
Patch Set: Update based on Ted's comment. 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 | « 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 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();
}
}
}
« 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