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

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

Issue 2407303005: Let embedder provide select action mode (Closed)
Patch Set: Move FloatingPaste into WebActionMode Created 4 years, 2 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/WebActionModeDelegate.java
diff --git a/content/public/android/java/src/org/chromium/content/browser/WebActionModeDelegate.java b/content/public/android/java/src/org/chromium/content/browser/WebActionModeDelegate.java
new file mode 100644
index 0000000000000000000000000000000000000000..af4972622707ecbe2d98dbbe8ce532573bf2adda
--- /dev/null
+++ b/content/public/android/java/src/org/chromium/content/browser/WebActionModeDelegate.java
@@ -0,0 +1,74 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package org.chromium.content.browser;
+
+import android.graphics.Rect;
+import android.util.SparseBooleanArray;
+import android.view.ActionMode;
+import android.view.Menu;
+import android.view.MenuItem;
+import android.view.View;
+
+/**
+ * Delegate interface for {@link WebActionMode} encapsulating
+ * {@link android.view.ActionMode}. Exposes the functionality of the class
+ * for embedder to provide with the callback instance that interacts with it.
+ */
+public interface WebActionModeDelegate {
boliu 2016/10/26 00:20:57 we can discuss naming this later, but this is defi
Jinsuk Kim 2016/10/26 06:11:39 Sounds better. Renamed.
+
+ /**
+ * @return {@code true} if action mode is started and in proper working state.
+ * if null, action mode was not started or is in finished, destroyed state.
+ */
+ boolean isValid();
+
+ /**
+ * @see ActionMode#finish()
+ */
+ void finishActionMode();
+
+ /**
+ * @return The selected text (empty if no text is selected).
+ */
+ String getSelectedText();
+
+ /**
+ * @return true if the current selection is for incognito content.
+ * Note: This should remain constant for the callback's lifetime.
+ */
+ boolean isIncognito();
+
+ /**
+ * Set the action mode menu items allowed on the content.
+ * @param allowedMenuItems array of item-flag mapping.
+ * @param defaultValue default value for menu item if when the mapping is not present.
+ */
+ void setAllowedMenuItems(SparseBooleanArray menItems, boolean defaultValue);
+
+ /**
+ * @see {@link ActionMode.Callback#onCreateActionMode(ActionMode, Menu)}
+ */
+ boolean onCreateActionMode(ActionMode mode, Menu menu);
+
+ /**
+ * @see {@link ActionMode.Callback#onPrepareActionMode(ActionMode, Menu)}
+ */
+ boolean onPrepareActionMode(ActionMode mode, Menu menu);
+
+ /**
+ * @see {@link ActionMode.Callback#onActionItemClicked(ActionMode, MenuItem)}
+ */
+ boolean onActionItemClicked(ActionMode mode, MenuItem item);
+
+ /**
+ * @see {@link ActionMode.Callback#onDestroyActionMode(ActionMode)}
+ */
+ void onDestroyActionMode();
+
+ /**
+ * @see {@link ActionMode.Callback2#onDestroyActionMode(ActionMode)}
+ */
+ void onGetContentRect(ActionMode mode, View view, Rect outRect);
+}

Powered by Google App Engine
This is Rietveld 408576698