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

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

Issue 2722273002: Add Select All to Android floating insertion menu (Closed)
Patch Set: moving input location Created 3 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/SelectionPopupController.java
diff --git a/content/public/android/java/src/org/chromium/content/browser/SelectionPopupController.java b/content/public/android/java/src/org/chromium/content/browser/SelectionPopupController.java
index a6f50a38e44ab3251eb55128cfe9d5ae6b551e84..aa907eb81b9879e45ab87c015c3ca677f4a2fc57 100644
--- a/content/public/android/java/src/org/chromium/content/browser/SelectionPopupController.java
+++ b/content/public/android/java/src/org/chromium/content/browser/SelectionPopupController.java
@@ -102,6 +102,7 @@ public class SelectionPopupController extends ActionModeCallbackHelper {
private boolean mEditable;
private boolean mIsPasswordType;
private boolean mIsInsertion;
+ private boolean mCanSelectAllForPastePopup;
private boolean mUnselectAllOnDismiss;
private String mLastSelectedText;
@@ -251,13 +252,14 @@ public class SelectionPopupController extends ActionModeCallbackHelper {
return actionMode;
}
- void createAndShowPastePopup(int x, int y) {
+ void createAndShowPastePopup(int x, int y, boolean canSelectAll) {
if (mView.getParent() == null || mView.getVisibility() != View.VISIBLE) {
return;
}
if (!supportsFloatingActionMode() && !canPaste()) return;
destroyPastePopup();
+ mCanSelectAllForPastePopup = canSelectAll;
PastePopupMenuDelegate delegate = new PastePopupMenuDelegate() {
@Override
public void paste() {
@@ -269,6 +271,16 @@ public class SelectionPopupController extends ActionModeCallbackHelper {
public boolean canPaste() {
return SelectionPopupController.this.canPaste();
}
+
+ @Override
+ public void selectAll() {
+ SelectionPopupController.this.selectAll();
+ }
+
+ @Override
+ public boolean canSelectAll() {
+ return SelectionPopupController.this.canSelectAll();
+ }
};
Context windowContext = mWindowAndroid.getContext().get();
if (windowContext == null) return;
@@ -741,6 +753,14 @@ public class SelectionPopupController extends ActionModeCallbackHelper {
}
/**
+ * @return true if the current selection can select all.
+ */
+ @VisibleForTesting
+ public boolean canSelectAll() {
+ return mCanSelectAllForPastePopup;
+ }
+
+ /**
* @return true if the current selection is for incognito content.
* Note: This should remain constant for the callback's lifetime.
*/

Powered by Google App Engine
This is Rietveld 408576698