| Index: chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/contextualsearch/ContextualSearchPanelDelegate.java
|
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/contextualsearch/ContextualSearchPanelDelegate.java b/chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/contextualsearch/ContextualSearchPanelDelegate.java
|
| index c0647f0f692580d1f5374ffa5766be214f50e8e3..e370194fea11e21d1d36f2ac2829aa41a16c3b9a 100644
|
| --- a/chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/contextualsearch/ContextualSearchPanelDelegate.java
|
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/contextualsearch/ContextualSearchPanelDelegate.java
|
| @@ -4,12 +4,12 @@
|
|
|
| package org.chromium.chrome.browser.compositor.bottombar.contextualsearch;
|
|
|
| +import org.chromium.base.VisibleForTesting;
|
| +import org.chromium.chrome.browser.ChromeActivity;
|
| import org.chromium.chrome.browser.compositor.bottombar.contextualsearch.ContextualSearchPanel.PanelState;
|
| import org.chromium.chrome.browser.compositor.bottombar.contextualsearch.ContextualSearchPanel.StateChangeReason;
|
| -import org.chromium.components.navigation_interception.InterceptNavigationDelegate;
|
| -import org.chromium.components.web_contents_delegate_android.WebContentsDelegateAndroid;
|
| +import org.chromium.chrome.browser.contextualsearch.ContextualSearchContentController;
|
| import org.chromium.content.browser.ContentViewCore;
|
| -import org.chromium.content_public.browser.WebContents;
|
|
|
| /**
|
| * The delegate that that interfaces with the {@link ContextualSearchPanel}.
|
| @@ -83,22 +83,6 @@ public interface ContextualSearchPanelDelegate {
|
| void updateBasePageSelectionYPx(float y);
|
|
|
| /**
|
| - * Handles the onLoadStarted event in the WebContents.
|
| - */
|
| - void onLoadStarted();
|
| -
|
| - /**
|
| - * Handles the onLoadStopped event in the WebContents.
|
| - */
|
| - void onLoadStopped();
|
| -
|
| - /**
|
| - * Handles the onLoadProgressChanged event in the WebContents.
|
| - * @param progress The loading progress in percentage (from 0 to 100).
|
| - */
|
| - void onLoadProgressChanged(int progress);
|
| -
|
| - /**
|
| * @return The panel's state.
|
| */
|
| PanelState getPanelState();
|
| @@ -109,11 +93,6 @@ public interface ContextualSearchPanelDelegate {
|
| void setDidSearchInvolvePromo();
|
|
|
| /**
|
| - * Sets that the Search Content View was seen.
|
| - */
|
| - void setWasSearchContentViewSeen();
|
| -
|
| - /**
|
| * Sets whether the promo is active.
|
| * @param shown Whether the promo is active.
|
| */
|
| @@ -139,66 +118,78 @@ public interface ContextualSearchPanelDelegate {
|
|
|
| /**
|
| * @return The ContentViewCore associated with the panel.
|
| + * TODO(mdjones): Remove this method from the interface.
|
| */
|
| ContentViewCore getContentViewCore();
|
|
|
| /**
|
| - * Set this panel's ContentViewCore to null.
|
| + * Remove the last entry from history provided it is in a given time frame.
|
| + * @param historyUrl The URL to remove.
|
| + * @param urlTimeMs The time that the URL was visited.
|
| */
|
| - void resetContentViewCore();
|
| + void removeLastHistoryEntry(String historyUrl, long urlTimeMs);
|
|
|
| /**
|
| - * Destroy the native components of this class.
|
| + * Shows the search term in the BottomBar. This should be called when the search term is set
|
| + * without resolving a search context.
|
| + * @param searchTerm The string that represents the search term.
|
| */
|
| - void destroy();
|
| + void displaySearchTerm(String searchTerm);
|
|
|
| /**
|
| - * Remove the last entry from history provided it is in a given time frame.
|
| - * @param historyUrl The URL to remove.
|
| - * @param urlTimeMs The time that the URL was visited.
|
| + * Shows the search context in the BottomBar.
|
| + * @param selection The portion of the context that represents the user's selection.
|
| + * @param start The portion of the context from its start to the selection.
|
| + * @param end The portion of the context the selection to its end.
|
| */
|
| - void removeLastHistoryEntry(String historyUrl, long urlTimeMs);
|
| + void displaySearchContext(String selection, String start, String end);
|
|
|
| /**
|
| - * Set the WebContents
|
| + * Handles showing the resolved search term in the BottomBarTextControl.
|
| + * @param searchTerm The string that represents the search term.
|
| */
|
| - void setWebContents(ContentViewCore contentView, WebContentsDelegateAndroid delegate);
|
| + void onSearchTermResolutionResponse(String searchTerm);
|
|
|
| /**
|
| - * Destroy the web contents associated with this object.
|
| + * @param activity The current active ChromeActivity.
|
| */
|
| - void destroyWebContents();
|
| + void setChromeActivity(ChromeActivity activity);
|
|
|
| /**
|
| - * Reset the native handle to the WebContents.
|
| + * Load a URL in the panel ContentViewCore.
|
| + * @param url The URL to load.
|
| */
|
| - void releaseWebContents();
|
| + void loadUrlInPanel(String url);
|
|
|
| /**
|
| - * @param delegate InterceptNavigationDelegate to use.
|
| - * @param webContents The WebContents to associate with the delegate.
|
| + * @return True if the ContentViewCore is being shown.
|
| */
|
| - void setInterceptNavigationDelegate(
|
| - InterceptNavigationDelegate delegate, WebContents webContents);
|
| + boolean isContentViewShowing();
|
|
|
| /**
|
| - * Shows the search term in the BottomBar. This should be called when the search term is set
|
| - * without resolving a search context.
|
| - * @param searchTerm The string that represents the search term.
|
| + * Create a new ContentViewCore for this panel.
|
| */
|
| - void displaySearchTerm(String searchTerm);
|
| + void createNewPanelContentView();
|
|
|
| /**
|
| - * Shows the search context in the BottomBar.
|
| - * @param selection The portion of the context that represents the user's selection.
|
| - * @param start The portion of the context from its start to the selection.
|
| - * @param end The portion of the context the selection to its end.
|
| + * Set the ContextualSearchContentController (for testing).
|
| */
|
| - void displaySearchContext(String selection, String start, String end);
|
| + @VisibleForTesting
|
| + void setContentController(ContextualSearchContentController controller);
|
|
|
| /**
|
| - * Handles showing the resolved search term in the BottomBarTextControl.
|
| - * @param searchTerm The string that represents the search term.
|
| + * @return The current content controller.
|
| */
|
| - void onSearchTermResolutionResponse(String searchTerm);
|
| + @VisibleForTesting
|
| + ContextualSearchContentController getContentController();
|
| +
|
| + /**
|
| + * @return True if the panel loaded a URL.
|
| + */
|
| + boolean didLoadAnyUrl();
|
| +
|
| + /**
|
| + * Sets the top control state based on the internals of the panel.
|
| + */
|
| + void updateTopControlState();
|
| }
|
|
|