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

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

Issue 1209713002: [Android] Use WebContents text manipulation methods directly (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix null check Created 5 years, 6 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/ContentViewCore.java
diff --git a/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java b/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java
index 13294f2c0b663e922a7e4dd254187c1df22bb18f..780201fa42b75a9e352640f89b80b2f637855ffe 100644
--- a/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java
+++ b/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java
@@ -753,6 +753,27 @@ public class ContentViewCore implements
}
@Override
+ public boolean performContextMenuAction(int id) {
+ assert mWebContents != null;
+ switch (id) {
+ case android.R.id.selectAll:
+ mWebContents.selectAll();
+ return true;
+ case android.R.id.cut:
+ mWebContents.cut();
+ return true;
+ case android.R.id.copy:
+ mWebContents.copy();
+ return true;
+ case android.R.id.paste:
+ mWebContents.paste();
+ return true;
+ default:
+ return false;
+ }
+ }
+
+ @Override
public View getAttachedView() {
return mContainerView;
}
@@ -1439,8 +1460,8 @@ public class ContentViewCore implements
int selectionEnd = Selection.getSelectionEnd(mEditable);
mInputConnection.setSelection(selectionEnd, selectionEnd);
}
- } else if (mImeAdapter != null) {
- mImeAdapter.unselect();
+ } else if (mWebContents != null) {
+ mWebContents.unselect();
}
}
@@ -2001,22 +2022,22 @@ public class ContentViewCore implements
mActionHandler = new SelectActionModeCallback.ActionHandler() {
@Override
public void selectAll() {
- mImeAdapter.selectAll();
+ mWebContents.selectAll();
}
@Override
public void cut() {
- mImeAdapter.cut();
+ mWebContents.cut();
}
@Override
public void copy() {
- mImeAdapter.copy();
+ mWebContents.copy();
}
@Override
public void paste() {
- mImeAdapter.paste();
+ mWebContents.paste();
}
@Override
@@ -2130,7 +2151,7 @@ public class ContentViewCore implements
mUnselectAllOnActionModeDismiss = true;
if (mActionMode == null) {
// There is no ActionMode, so remove the selection.
- mImeAdapter.unselect();
+ clearSelection();
} else {
getContentViewClient().onContextualActionBarShown();
}
@@ -2149,7 +2170,8 @@ public class ContentViewCore implements
* Clears the current text selection.
*/
public void clearSelection() {
- mImeAdapter.unselect();
+ // This method can be called during shutdown, guard against null accordingly.
+ if (mWebContents != null) mWebContents.unselect();
}
/**
@@ -2586,7 +2608,7 @@ public class ContentViewCore implements
new PastePopupMenuDelegate() {
@Override
public void paste() {
- mImeAdapter.paste();
+ mWebContents.paste();
dismissTextHandles();
}
});

Powered by Google App Engine
This is Rietveld 408576698