| Index: content/public/android/java/src/org/chromium/content/browser/ActionModeCallbackHelper.java
|
| diff --git a/content/public/android/java/src/org/chromium/content/browser/ActionModeCallbackHelper.java b/content/public/android/java/src/org/chromium/content/browser/ActionModeCallbackHelper.java
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..6b381d546d8ab7c8d7f310d11a4fcd46ae1e62b9
|
| --- /dev/null
|
| +++ b/content/public/android/java/src/org/chromium/content/browser/ActionModeCallbackHelper.java
|
| @@ -0,0 +1,83 @@
|
| +// 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.content.Intent;
|
| +import android.graphics.Rect;
|
| +import android.util.SparseBooleanArray;
|
| +import android.view.ActionMode;
|
| +import android.view.Menu;
|
| +import android.view.MenuItem;
|
| +import android.view.View;
|
| +
|
| +/**
|
| + * Helper class 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 ActionModeCallbackHelper {
|
| +
|
| + /**
|
| + * @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 isActionModeValid();
|
| +
|
| + /**
|
| + * @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();
|
| +
|
| + /**
|
| + * Called when the processed text is replied from an activity that supports
|
| + * Intent.ACTION_PROCESS_TEXT.
|
| + * @param resultCode the code that indicates if the activity successfully processed the text
|
| + * @param data the reply that contains the processed text.
|
| + */
|
| + void onReceivedProcessTextResult(int resultCode, Intent data);
|
| +
|
| + /**
|
| + * 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);
|
| +}
|
|
|