Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 } |
| OLD | NEW |