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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package org.chromium.chrome.browser.contextmenu; 5 package org.chromium.chrome.browser.contextmenu;
6 6
7 import android.content.Context; 7 import android.content.Context;
8 import android.net.MailTo; 8 import android.net.MailTo;
9 import android.support.annotation.IntDef; 9 import android.support.annotation.IntDef;
10 import android.support.annotation.StringRes; 10 import android.support.annotation.StringRes;
(...skipping 598 matching lines...) Expand 10 before | Expand all | Expand 10 after
609 * @return True if the url is empty or "about:blank". 609 * @return True if the url is empty or "about:blank".
610 */ 610 */
611 private boolean isEmptyUrl(String url) { 611 private boolean isEmptyUrl(String url) {
612 if (TextUtils.isEmpty(url) || url.equals(ContentUrlConstants.ABOUT_BLANK _DISPLAY_URL)) { 612 if (TextUtils.isEmpty(url) || url.equals(ContentUrlConstants.ABOUT_BLANK _DISPLAY_URL)) {
613 return true; 613 return true;
614 } 614 }
615 return false; 615 return false;
616 } 616 }
617 617
618 /** 618 /**
619 * The valid url of a link is stored in the linkUrl of ContextMenuParams whi le the 619 * Return the valid url of a ContextMenuParams.
620 * valid url of a image or video is stored in the srcUrl of ContextMenuParam s. 620 * If the ContextMenuParams is an anchor and its linkUrl is not empty, retur ns the linkUrl.
621 * @param params The parameters used to decide the type of the content. 621 * Otherwise returns the srcUrl.
622 * @param params The {@link ContextMenuParams} to check.
622 */ 623 */
623 private String getUrl(ContextMenuParams params) { 624 private String getUrl(ContextMenuParams params) {
624 if (params.isImage() || params.isVideo()) { 625 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.
626 return params.getLinkUrl();
627 } else {
625 return params.getSrcUrl(); 628 return params.getSrcUrl();
626 } else {
627 return params.getLinkUrl();
628 } 629 }
629 } 630 }
630 } 631 }
OLDNEW
« 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