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 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
382 if (params.getLinkText().trim().isEmpty() || params.isImage()) { | 382 if (params.getLinkText().trim().isEmpty() || params.isImage()) { |
383 disabledOptions.add(ContextMenuItem.COPY_LINK_TEXT); | 383 disabledOptions.add(ContextMenuItem.COPY_LINK_TEXT); |
384 } | 384 } |
385 | 385 |
386 if (params.isAnchor() && !UrlUtilities.isAcceptedScheme(params.getLinkUr
l())) { | 386 if (params.isAnchor() && !UrlUtilities.isAcceptedScheme(params.getLinkUr
l())) { |
387 disabledOptions.add(ContextMenuItem.OPEN_IN_OTHER_WINDOW); | 387 disabledOptions.add(ContextMenuItem.OPEN_IN_OTHER_WINDOW); |
388 disabledOptions.add(ContextMenuItem.OPEN_IN_NEW_TAB); | 388 disabledOptions.add(ContextMenuItem.OPEN_IN_NEW_TAB); |
389 disabledOptions.add(ContextMenuItem.OPEN_IN_INCOGNITO_TAB); | 389 disabledOptions.add(ContextMenuItem.OPEN_IN_INCOGNITO_TAB); |
390 } | 390 } |
391 | 391 |
| 392 if (TextUtils.isEmpty(params.getLinkUrl()) |
| 393 || params.getLinkUrl().equals(UrlConstants.ABOUT_BLANK_DISPLAY_U
RL)) { |
| 394 disabledOptions.add(ContextMenuItem.OPEN_IN_OTHER_WINDOW); |
| 395 disabledOptions.add(ContextMenuItem.OPEN_IN_NEW_TAB); |
| 396 disabledOptions.add(ContextMenuItem.OPEN_IN_INCOGNITO_TAB); |
| 397 } |
| 398 |
392 if (MailTo.isMailTo(params.getLinkUrl())) { | 399 if (MailTo.isMailTo(params.getLinkUrl())) { |
393 disabledOptions.add(ContextMenuItem.COPY_LINK_TEXT); | 400 disabledOptions.add(ContextMenuItem.COPY_LINK_TEXT); |
394 disabledOptions.add(ContextMenuItem.COPY_LINK_ADDRESS); | 401 disabledOptions.add(ContextMenuItem.COPY_LINK_ADDRESS); |
395 if (!mDelegate.supportsSendEmailMessage()) { | 402 if (!mDelegate.supportsSendEmailMessage()) { |
396 disabledOptions.add(ContextMenuItem.SEND_MESSAGE); | 403 disabledOptions.add(ContextMenuItem.SEND_MESSAGE); |
397 } | 404 } |
398 if (TextUtils.isEmpty(MailTo.parse(params.getLinkUrl()).getTo()) | 405 if (TextUtils.isEmpty(MailTo.parse(params.getLinkUrl()).getTo()) |
399 || !mDelegate.supportsAddToContacts()) { | 406 || !mDelegate.supportsAddToContacts()) { |
400 disabledOptions.add(ContextMenuItem.ADD_TO_CONTACTS); | 407 disabledOptions.add(ContextMenuItem.ADD_TO_CONTACTS); |
401 } | 408 } |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
584 * @param params The parameters used to decide the type of the content. | 591 * @param params The parameters used to decide the type of the content. |
585 */ | 592 */ |
586 private String getUrl(ContextMenuParams params) { | 593 private String getUrl(ContextMenuParams params) { |
587 if (params.isImage() || params.isVideo()) { | 594 if (params.isImage() || params.isVideo()) { |
588 return params.getSrcUrl(); | 595 return params.getSrcUrl(); |
589 } else { | 596 } else { |
590 return params.getLinkUrl(); | 597 return params.getLinkUrl(); |
591 } | 598 } |
592 } | 599 } |
593 } | 600 } |
OLD | NEW |