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

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

Issue 1323263004: Do not trigger action mode actions after being destroyed. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/public/android/java/src/org/chromium/content/browser/WebActionModeCallback.java
diff --git a/content/public/android/java/src/org/chromium/content/browser/WebActionModeCallback.java b/content/public/android/java/src/org/chromium/content/browser/WebActionModeCallback.java
index 9e62d7efde8741d04ad1bd393ced79494f71281c..082068a4daff3edd92c064299dd81658a62a06ed 100644
--- a/content/public/android/java/src/org/chromium/content/browser/WebActionModeCallback.java
+++ b/content/public/android/java/src/org/chromium/content/browser/WebActionModeCallback.java
@@ -105,6 +105,7 @@ public class WebActionModeCallback implements ActionMode.Callback {
private boolean mEditable;
private boolean mIsPasswordType;
private boolean mIsInsertion;
+ private boolean mIsDestroyed;
public WebActionModeCallback(Context context, ActionHandler actionHandler) {
mContext = context;
@@ -189,6 +190,8 @@ public class WebActionModeCallback implements ActionMode.Callback {
@Override
public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
+ if (mIsDestroyed) return true;
+
int id = item.getItemId();
if (id == R.id.select_action_menu_select_all) {
@@ -216,6 +219,7 @@ public class WebActionModeCallback implements ActionMode.Callback {
@Override
public void onDestroyActionMode(ActionMode mode) {
+ mIsDestroyed = true;
mActionHandler.onDestroyActionMode();
}
@@ -229,6 +233,7 @@ public class WebActionModeCallback implements ActionMode.Callback {
* @param outRect The Rect to be populated with the content position.
*/
public void onGetContentRect(ActionMode mode, View view, Rect outRect) {
+ if (mIsDestroyed) return;
mActionHandler.onGetContentRect(outRect);
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698