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

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

Issue 2801003004: Add "Paste as plain text" into text selection toolbar overflow (Closed)
Patch Set: add comments 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/input/FloatingPastePopupMenu.java
diff --git a/content/public/android/java/src/org/chromium/content/browser/input/FloatingPastePopupMenu.java b/content/public/android/java/src/org/chromium/content/browser/input/FloatingPastePopupMenu.java
index f48e3e4f0163f90f569070001fcddac613d0156c..8d7e89b9fdf0d92ad0b89b533a2b4d72569b8e33 100644
--- a/content/public/android/java/src/org/chromium/content/browser/input/FloatingPastePopupMenu.java
+++ b/content/public/android/java/src/org/chromium/content/browser/input/FloatingPastePopupMenu.java
@@ -109,6 +109,15 @@ public class FloatingPastePopupMenu implements PastePopupMenu {
SelectionPopupController.initializeMenu(mContext, mode, menu);
if (!mDelegate.canPaste()) menu.removeItem(R.id.select_action_menu_paste);
if (!mDelegate.canSelectAll()) menu.removeItem(R.id.select_action_menu_select_all);
+ if (!mDelegate.canPasteAsPlainText()) {
+ menu.removeItem(R.id.select_action_menu_paste_as_plain_text);
+ }
+ // TODO(ctzsm): Remove runtime title set after O SDK rolls.
+ MenuItem item = menu.findItem(R.id.select_action_menu_paste_as_plain_text);
+ if (item != null) {
+ item.setTitle(mContext.getResources().getIdentifier(
+ "paste_as_plain_text", "string", "android"));
+ }
menu.removeItem(R.id.select_action_menu_cut);
menu.removeItem(R.id.select_action_menu_copy);
menu.removeItem(R.id.select_action_menu_share);
@@ -122,11 +131,16 @@ public class FloatingPastePopupMenu implements PastePopupMenu {
@Override
public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
- if (item.getItemId() == R.id.select_action_menu_paste) {
+ int id = item.getItemId();
+ if (id == R.id.select_action_menu_paste) {
mDelegate.paste();
mode.finish();
}
- if (item.getItemId() == R.id.select_action_menu_select_all) {
+ if (id == R.id.select_action_menu_paste_as_plain_text) {
+ mDelegate.pasteAsPlainText();
+ mode.finish();
+ }
+ if (id == R.id.select_action_menu_select_all) {
mDelegate.selectAll();
mode.finish();
}

Powered by Google App Engine
This is Rietveld 408576698