OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 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.omnibox; |
| 6 |
| 7 import android.app.Activity; |
| 8 import android.view.View; |
| 9 import android.view.ViewGroup; |
| 10 import android.view.Window; |
| 11 |
| 12 import org.chromium.chrome.browser.ContextualMenuBar; |
| 13 import org.chromium.chrome.browser.ContextualMenuBar.ActionBarDelegate; |
| 14 import org.chromium.chrome.browser.CustomSelectionActionModeCallback; |
| 15 import org.chromium.chrome.browser.Tab; |
| 16 import org.chromium.chrome.browser.WindowDelegate; |
| 17 import org.chromium.chrome.browser.appmenu.AppMenuButtonHelper; |
| 18 import org.chromium.chrome.browser.ntp.NewTabPage; |
| 19 import org.chromium.chrome.browser.omnibox.UrlBar.UrlBarDelegate; |
| 20 import org.chromium.chrome.browser.profiles.Profile; |
| 21 import org.chromium.chrome.browser.toolbar.Toolbar; |
| 22 import org.chromium.chrome.browser.toolbar.ToolbarDataProvider; |
| 23 import org.chromium.ui.base.WindowAndroid; |
| 24 |
| 25 /** |
| 26 * Container that holds the {@link UrlBar} and SSL state related with the curren
t {@link Tab}. |
| 27 */ |
| 28 public interface LocationBar extends UrlBarDelegate { |
| 29 |
| 30 /** |
| 31 * Handles native dependent initialization for this class. |
| 32 */ |
| 33 void onNativeLibraryReady(); |
| 34 |
| 35 /** |
| 36 * Triggered when the current tab has changed to a {@link NewTabPage}. |
| 37 */ |
| 38 void onTabLoadingNTP(NewTabPage ntp); |
| 39 |
| 40 /** |
| 41 * Called to set the autocomplete profile to a new profile. |
| 42 */ |
| 43 void setAutocompleteProfile(Profile profile); |
| 44 |
| 45 /** |
| 46 * Call to force the UI to update the state of various buttons based on whet
her or not the |
| 47 * current tab is incognito. |
| 48 */ |
| 49 void updateVisualsForState(); |
| 50 |
| 51 /** |
| 52 * Sets the displayed URL to be the URL of the page currently showing. |
| 53 * |
| 54 * <p>The URL is converted to the most user friendly format (removing HTTP:/
/ for example). |
| 55 * |
| 56 * <p>If the current tab is null, the URL text will be cleared. |
| 57 */ |
| 58 void setUrlToPageUrl(); |
| 59 |
| 60 /** |
| 61 * Update the visuals based on a loading state change. |
| 62 * @param updateUrl Whether to update the URL as a result of the this call. |
| 63 */ |
| 64 void updateLoadingState(boolean updateUrl); |
| 65 |
| 66 /** |
| 67 * Sets the {@link ToolbarDataProvider} to be used for accessing {@link Tool
bar} state. |
| 68 */ |
| 69 void setToolbarDataProvider(ToolbarDataProvider model); |
| 70 |
| 71 /** |
| 72 * Sets the menu helper that should be used if there is a menu button in {@l
ink LocationBar}. |
| 73 * @param helper The helper to be used. |
| 74 */ |
| 75 void setMenuButtonHelper(AppMenuButtonHelper helper); |
| 76 |
| 77 /** |
| 78 * @return The anchor view that should be used for the app menu. Null if the
re is no menu in |
| 79 * {@link LocationBar} for the current configuration. |
| 80 */ |
| 81 View getMenuAnchor(); |
| 82 |
| 83 /** |
| 84 * Initialize controls that will act as hooks to various functions. |
| 85 * @param windowDelegate {@link WindowDelegate} that will provide {@link Win
dow} related info. |
| 86 * @param delegate {@link ActionBarDelegate} to be used while creating a |
| 87 * {@link ContextualMenuBar}. |
| 88 * @param windowAndroid {@link WindowAndroid} that is used by the owning {@l
ink Activity}. |
| 89 */ |
| 90 void initializeControls(WindowDelegate windowDelegate, |
| 91 ActionBarDelegate delegate, WindowAndroid windowAndroid); |
| 92 |
| 93 /** |
| 94 * Sets the URL focus change listener that will be notified when the URL gai
ns or loses focus. |
| 95 * @param listener The listener to be registered. |
| 96 */ |
| 97 void setUrlFocusChangeListener(UrlFocusChangeListener listener); |
| 98 |
| 99 /** |
| 100 * Signal a {@link UrlBar} focus change request. |
| 101 * @param shouldBeFocused Whether the focus should be requested or cleared.
True requests focus |
| 102 * and False clears focus. |
| 103 */ |
| 104 void setUrlBarFocus(boolean shouldBeFocused); |
| 105 |
| 106 /** |
| 107 * @return The timestamp for the {@link UrlBar} gaining focus for the first
time. |
| 108 */ |
| 109 long getFirstUrlBarFocusTime(); |
| 110 |
| 111 /** |
| 112 * Updates the security icon displayed in the LocationBar. |
| 113 */ |
| 114 void updateSecurityIcon(int securityLevel); |
| 115 |
| 116 /** |
| 117 * @return The {@link ViewGroup} that this container holds. |
| 118 */ |
| 119 View getContainerView(); |
| 120 |
| 121 /** |
| 122 * Updates the state of the mic button if there is one. |
| 123 */ |
| 124 void updateMicButtonState(); |
| 125 |
| 126 /** |
| 127 * Signal to the {@link SuggestionView} populated by us. |
| 128 */ |
| 129 void hideSuggestions(); |
| 130 |
| 131 /** |
| 132 * Sets the callback to be used by default for text editing action bar. |
| 133 * @param callback The callback to use. |
| 134 */ |
| 135 void setDefaultTextEditActionModeCallback(CustomSelectionActionModeCallback
callback); |
| 136 |
| 137 } |
OLD | NEW |