Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(530)

Unified Diff: content/public/android/java/src/org/chromium/content/browser/SelectActionModeCallback.java

Issue 258273002: Cut and Copy option should not be avilable for password field. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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

Powered by Google App Engine
This is Rietveld 408576698