Search in sources :

Example 1 with FindInPageBridge

use of org.chromium.chrome.browser.findinpage.FindInPageBridge in project AndroidChromium by JackyAndroid.

the class FindToolbar method activate.

/**
     * Initializes the find toolbar. Should be called just after the find toolbar is shown.
     * If the toolbar is already showing, this just focuses the toolbar.
     */
public void activate() {
    if (!isViewAvailable())
        return;
    if (mActive) {
        requestQueryFocus();
        return;
    }
    mTabModelSelector.addObserver(mTabModelSelectorObserver);
    for (TabModel model : mTabModelSelector.getModels()) {
        model.addObserver(mTabModelObserver);
    }
    mCurrentTab = mTabModelSelector.getCurrentTab();
    mCurrentTab.addObserver(mTabObserver);
    mFindInPageBridge = new FindInPageBridge(mCurrentTab.getWebContents());
    mCurrentTab.getTabWebContentsDelegateAndroid().setFindResultListener(this);
    mCurrentTab.getTabWebContentsDelegateAndroid().setFindMatchRectsListener(this);
    initializeFindText();
    mFindQuery.requestFocus();
    // The keyboard doesn't show itself automatically.
    showKeyboard();
    // Always show the bar to make the FindToolbar more distinct from the Omnibox.
    setResultsBarVisibility(true);
    mActive = true;
    updateVisualsForTabModel(mTabModelSelector.isIncognitoSelected());
    // Let everyone know that we've just updated.
    if (mObserver != null)
        mObserver.onFindToolbarShown();
}
Also used : FindInPageBridge(org.chromium.chrome.browser.findinpage.FindInPageBridge) TabModel(org.chromium.chrome.browser.tabmodel.TabModel)

Aggregations

FindInPageBridge (org.chromium.chrome.browser.findinpage.FindInPageBridge)1 TabModel (org.chromium.chrome.browser.tabmodel.TabModel)1