OLD | NEW |
(Empty) | |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 package org.chromium.chrome.browser.contextualsearch; |
| 6 |
| 7 import org.chromium.chrome.browser.Tab; |
| 8 import org.chromium.chrome.browser.compositor.bottombar.contextualsearch.Context
ualSearchPanelDelegate; |
| 9 import org.chromium.content.browser.ContentViewCore; |
| 10 import org.chromium.content_public.common.TopControlsState; |
| 11 |
| 12 /** |
| 13 * The delegate that provides global management functionality for Contextual Sea
rch. |
| 14 */ |
| 15 public interface ContextualSearchManagementDelegate { |
| 16 /** |
| 17 * @return Whether or not the Contextual Search Bar is peeking. |
| 18 */ |
| 19 boolean isSearchBarPeeking(); |
| 20 |
| 21 /** |
| 22 * Updates the top controls state for the base tab. As these values are set
at the renderer |
| 23 * level, there is potential for this impacting other tabs that might share
the same |
| 24 * process. See {@link Tab#updateTopControlsState(int current, boolean anima
te)} |
| 25 * @param current The desired current state for the controls. Pass |
| 26 * {@link TopControlsState#BOTH} to preserve the current posi
tion. |
| 27 * @param animate Whether the controls should animate to the specified endin
g condition or |
| 28 * should jump immediately. |
| 29 */ |
| 30 void updateTopControlsState(int current, boolean animate); |
| 31 |
| 32 /** |
| 33 * Promotes the current Content View Core in the Contextual Search Panel to
its own Tab. |
| 34 * @param shouldFocusOmnibox Whether the Omnibox should be focused after pro
moting. |
| 35 */ |
| 36 void promoteToTab(boolean shouldFocusOmnibox); |
| 37 |
| 38 /** |
| 39 * Resets the Search Content View scroll position. |
| 40 */ |
| 41 void resetSearchContentViewScroll(); |
| 42 |
| 43 /** |
| 44 * Gets the Search Content View's vertical scroll position. If the Search Co
ntent View |
| 45 * is not available it returns -1. |
| 46 * @return The Search Content View scroll position. |
| 47 */ |
| 48 float getSearchContentViewVerticalScroll(); |
| 49 |
| 50 /** |
| 51 * Sets the visibility of the Search Content View. |
| 52 * TODO(pedrosimonetti): Revisit this API. Consumers should not be allowed t
o make |
| 53 * it invisible, only visible. |
| 54 * @param isVisible True to make it visible. |
| 55 */ |
| 56 void setSearchContentViewVisibility(boolean isVisible); |
| 57 |
| 58 /** |
| 59 * Sets the delegate responsible for manipulating the ContextualSearchLayout
. |
| 60 * @param delegate The ContextualSearchLayoutDelegate. |
| 61 */ |
| 62 void setContextualSearchPanelDelegate(ContextualSearchPanelDelegate delegate
); |
| 63 |
| 64 /** |
| 65 * Gets whether the device is running in compatibility mode for Contextual S
earch. |
| 66 * If so, a new tab showing search results should be opened instead of showi
ng the panel. |
| 67 * @return whether the device is running in compatibility mode. |
| 68 */ |
| 69 boolean isRunningInCompatibilityMode(); |
| 70 |
| 71 /** |
| 72 * Opens the resolved search URL in a new tab. |
| 73 */ |
| 74 void openResolvedSearchUrlInNewTab(); |
| 75 |
| 76 /** |
| 77 * Preserves the Base Page's selection next time it loses focus. |
| 78 */ |
| 79 void preserveBasePageSelectionOnNextLossOfFocus(); |
| 80 |
| 81 /** |
| 82 * Dismisses the Contextual Search bar completely. This will hide any panel
that's currently |
| 83 * showing as well as any bar that's peeking. |
| 84 */ |
| 85 void dismissContextualSearchBar(); |
| 86 |
| 87 /** |
| 88 * Gets the {@code ContentViewCore} associated with Contextual Search Panel. |
| 89 * @return Contextual Search Panel's {@code ContentViewCore}. |
| 90 */ |
| 91 ContentViewCore getSearchContentViewCore(); |
| 92 } |
OLD | NEW |