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();
}
Aggregations