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.os.Build; | 8 import android.os.Build; |
| 9 import android.text.TextUtils; | 9 import android.text.TextUtils; |
| 10 import android.view.ContextMenu; | 10 import android.view.ContextMenu; |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 31 } | 31 } |
| 32 | 32 |
| 33 @Override | 33 @Override |
| 34 public boolean shouldShowContextMenu(ContextMenuParams params) { | 34 public boolean shouldShowContextMenu(ContextMenuParams params) { |
| 35 return params != null && (params.isAnchor() || params.isEditable() || pa rams.isImage() | 35 return params != null && (params.isAnchor() || params.isEditable() || pa rams.isImage() |
| 36 || params.isSelectedText() || params.isVideo() || params.isCusto mMenu()); | 36 || params.isSelectedText() || params.isVideo() || params.isCusto mMenu()); |
| 37 } | 37 } |
| 38 | 38 |
| 39 @Override | 39 @Override |
| 40 public void buildContextMenu(ContextMenu menu, Context context, ContextMenuP arams params) { | 40 public void buildContextMenu(ContextMenu menu, Context context, ContextMenuP arams params) { |
| 41 if (params.isImage() && !TextUtils.isEmpty(params.getSrcUrl())) | 41 if (params.isImage() && !TextUtils.isEmpty(params.getSrcUrl())) { |
| 42 menu.setHeaderTitle(params.getSrcUrl()); | 42 if (!params.getSrcUrl().startsWith("data:")) { |
|
Bernhard Bauer
2014/07/21 10:19:28
Hm, we probably shouldn't give the source URL prec
Jitu( very slow this week)
2014/07/21 11:11:35
Yes you are right... this will solve the problem.
Bernhard Bauer
2014/07/21 13:53:39
Wait, are you sure you are not confusing the link
Jitu( very slow this week)
2014/07/23 08:21:46
Yes you are right..
Link URL is "javascript:"
Th
| |
| 43 menu.setHeaderTitle(params.getSrcUrl()); | |
| 44 } else { | |
| 45 menu.setHeaderTitle(params.getLinkUrl()); | |
| 46 } | |
| 47 } | |
| 43 else if (!TextUtils.isEmpty(params.getLinkUrl()) ) | 48 else if (!TextUtils.isEmpty(params.getLinkUrl()) ) |
| 44 menu.setHeaderTitle(params.getLinkUrl()); | 49 menu.setHeaderTitle(params.getLinkUrl()); |
| 45 | 50 |
| 46 if (mMenuInflater == null) mMenuInflater = new MenuInflater(context); | 51 if (mMenuInflater == null) mMenuInflater = new MenuInflater(context); |
| 47 | 52 |
| 48 mMenuInflater.inflate(R.menu.chrome_context_menu, menu); | 53 mMenuInflater.inflate(R.menu.chrome_context_menu, menu); |
| 49 | 54 |
| 50 menu.setGroupVisible(R.id.contextmenu_group_anchor, params.isAnchor()); | 55 menu.setGroupVisible(R.id.contextmenu_group_anchor, params.isAnchor()); |
| 51 menu.setGroupVisible(R.id.contextmenu_group_image, params.isImage()); | 56 menu.setGroupVisible(R.id.contextmenu_group_image, params.isImage()); |
| 52 menu.setGroupVisible(R.id.contextmenu_group_video, params.isVideo()); | 57 menu.setGroupVisible(R.id.contextmenu_group_video, params.isVideo()); |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 123 mDelegate.onSearchByImageInNewTab(); | 128 mDelegate.onSearchByImageInNewTab(); |
| 124 } else if (itemId == R.id.contextmenu_copy_image) { | 129 } else if (itemId == R.id.contextmenu_copy_image) { |
| 125 mDelegate.onSaveImageToClipboard(params.getSrcUrl()); | 130 mDelegate.onSaveImageToClipboard(params.getSrcUrl()); |
| 126 } else { | 131 } else { |
| 127 assert false; | 132 assert false; |
| 128 } | 133 } |
| 129 | 134 |
| 130 return true; | 135 return true; |
| 131 } | 136 } |
| 132 } | 137 } |
| OLD | NEW |