| 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 625 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 636 * @return True if the url is empty or "about:blank". | 636 * @return True if the url is empty or "about:blank". |
| 637 */ | 637 */ |
| 638 private boolean isEmptyUrl(String url) { | 638 private boolean isEmptyUrl(String url) { |
| 639 if (TextUtils.isEmpty(url) || url.equals(ContentUrlConstants.ABOUT_BLANK
_DISPLAY_URL)) { | 639 if (TextUtils.isEmpty(url) || url.equals(ContentUrlConstants.ABOUT_BLANK
_DISPLAY_URL)) { |
| 640 return true; | 640 return true; |
| 641 } | 641 } |
| 642 return false; | 642 return false; |
| 643 } | 643 } |
| 644 | 644 |
| 645 /** | 645 /** |
| 646 * The valid url of a link is stored in the linkUrl of ContextMenuParams whi
le the | 646 * Return the valid url of a ContextMenuParams. |
| 647 * valid url of a image or video is stored in the srcUrl of ContextMenuParam
s. | 647 * If the ContextMenuParams is an anchor and its linkUrl is not empty, retur
ns the linkUrl. |
| 648 * @param params The parameters used to decide the type of the content. | 648 * Otherwise returns the srcUrl. |
| 649 * @param params The {@link ContextMenuParams} to check. |
| 649 */ | 650 */ |
| 650 private String getUrl(ContextMenuParams params) { | 651 private String getUrl(ContextMenuParams params) { |
| 651 if (params.isImage() || params.isVideo()) { | 652 if (params.isAnchor()) { |
| 653 return params.getLinkUrl(); |
| 654 } else { |
| 652 return params.getSrcUrl(); | 655 return params.getSrcUrl(); |
| 653 } else { | |
| 654 return params.getLinkUrl(); | |
| 655 } | 656 } |
| 656 } | 657 } |
| 657 } | 658 } |
| OLD | NEW |