Chromium Code Reviews| Index: content/public/android/java/src/org/chromium/content/browser/SelectActionModeCallback.java |
| diff --git a/content/public/android/java/src/org/chromium/content/browser/SelectActionModeCallback.java b/content/public/android/java/src/org/chromium/content/browser/SelectActionModeCallback.java |
| index c140cb60094bfc16871aa2bc992c4da05bedfe02..a09d1ebea2bcb904ef10b2f9f1f9c3bd93e43104 100644 |
| --- a/content/public/android/java/src/org/chromium/content/browser/SelectActionModeCallback.java |
| +++ b/content/public/android/java/src/org/chromium/content/browser/SelectActionModeCallback.java |
| @@ -71,12 +71,18 @@ public class SelectActionModeCallback implements ActionMode.Callback { |
| * @return Whether or not web search is available. |
| */ |
| boolean isWebSearchAvailable(); |
| + |
| + /** |
| + * @return true is the current selection is of password type. |
|
jdduke (slow)
2014/04/30 14:54:50
|true is| -> |Whether| or |true iff|
Maybe we sho
|
| + */ |
| + boolean isPasswordType(); |
| } |
| private final Context mContext; |
| private final ActionHandler mActionHandler; |
| private final boolean mIncognito; |
| private boolean mEditable; |
| + private boolean mIsPasswordType; |
| protected SelectActionModeCallback( |
| Context context, ActionHandler actionHandler, boolean incognito) { |
| @@ -94,6 +100,7 @@ public class SelectActionModeCallback implements ActionMode.Callback { |
| mode.setTitle(null); |
| mode.setSubtitle(null); |
| mEditable = mActionHandler.isSelectionEditable(); |
| + mIsPasswordType = mActionHandler.isPasswordType(); |
| createActionMenu(mode, menu); |
| return true; |
| } |
| @@ -101,8 +108,10 @@ public class SelectActionModeCallback implements ActionMode.Callback { |
| @Override |
| public boolean onPrepareActionMode(ActionMode mode, Menu menu) { |
| boolean isEditableNow = mActionHandler.isSelectionEditable(); |
| - if (mEditable != isEditableNow) { |
| + boolean isPasswordNow = mActionHandler.isPasswordType(); |
| + if (mEditable != isEditableNow || mIsPasswordType != isPasswordNow) { |
| mEditable = isEditableNow; |
| + mIsPasswordType = isPasswordNow; |
| menu.clear(); |
| createActionMenu(mode, menu); |
| return true; |
| @@ -127,6 +136,10 @@ public class SelectActionModeCallback implements ActionMode.Callback { |
| if (mEditable || mIncognito || !mActionHandler.isWebSearchAvailable()) { |
| menu.removeItem(R.id.select_action_menu_web_search); |
| } |
| + if (mIsPasswordType) { |
| + menu.removeItem(R.id.select_action_menu_copy); |
| + menu.removeItem(R.id.select_action_menu_cut); |
| + } |
| } |
| @Override |