use of org.chromium.chrome.browser.tabmodel.TabModel in project AndroidChromium by JackyAndroid.
the class StaticLayout method setStaticTab.
private void setStaticTab(final int id) {
if (mLayoutTabs != null && mLayoutTabs.length > 0 && mLayoutTabs[0].getId() == id) {
if (!mLayoutTabs[0].shouldStall())
setPostHideState();
return;
}
TabModel model = mTabModelSelector.getModelForTabId(id);
if (model == null)
return;
updateCacheVisibleIds(new LinkedList<Integer>(Arrays.asList(id)));
if (mLayoutTabs == null || mLayoutTabs.length != 1)
mLayoutTabs = new LayoutTab[1];
mLayoutTabs[0] = createLayoutTab(id, model.isIncognito(), NO_CLOSE_BUTTON, NO_TITLE);
mLayoutTabs[0].setDrawDecoration(false);
if (mLayoutTabs[0].shouldStall()) {
setPreHideState();
mHandler.postDelayed(mUnstallRunnable, HIDE_TIMEOUT_MS);
} else {
setPostHideState();
}
requestRender();
}
use of org.chromium.chrome.browser.tabmodel.TabModel in project AndroidChromium by JackyAndroid.
the class ToolbarSwipeLayout method show.
@Override
public void show(long time, boolean animate) {
super.show(time, animate);
init();
if (mTabModelSelector == null)
return;
Tab tab = mTabModelSelector.getCurrentTab();
if (tab != null && tab.isNativePage())
mTabContentManager.cacheTabThumbnail(tab);
TabModel model = mTabModelSelector.getCurrentModel();
if (model == null)
return;
int fromTabId = mTabModelSelector.getCurrentTabId();
if (fromTabId == TabModel.INVALID_TAB_INDEX)
return;
mFromTab = createLayoutTab(fromTabId, model.isIncognito(), NO_CLOSE_BUTTON, NEED_TITLE);
prepareLayoutTabForSwipe(mFromTab, false);
}
use of org.chromium.chrome.browser.tabmodel.TabModel in project AndroidChromium by JackyAndroid.
the class SeparateTaskManagedCustomTabActivity method createIntentHandlerDelegate.
@Override
protected IntentHandlerDelegate createIntentHandlerDelegate() {
return new IntentHandlerDelegate() {
@Override
public void processWebSearchIntent(String query) {
}
@Override
public void processUrlViewIntent(String url, String referer, String headers, TabOpenType tabOpenType, String externalAppId, int tabIdToBringToFront, boolean hasUserGesture, Intent intent) {
Tab currentTab = getTabCreator(false).launchUrlFromExternalApp(url, referer, headers, externalAppId, true, intent, mIntentHandlingTimeMs);
// Close all existing tabs from the previous session.
TabModel tabModel = getTabModelSelector().getModel(false);
for (int i = tabModel.getCount() - 1; i >= 0; i--) {
if (tabModel.getTabAt(i).equals(currentTab))
continue;
tabModel.closeTab(tabModel.getTabAt(i), false, false, false);
}
}
};
}
use of org.chromium.chrome.browser.tabmodel.TabModel in project AndroidChromium by JackyAndroid.
the class ContextReporter method disable.
/**
* Stops reporting context. Called when the app goes to the background.
*/
public void disable() {
reportUsageEndedIfNecessary();
if (mSelectorTabObserver != null) {
mSelectorTabObserver.destroy();
mSelectorTabObserver = null;
}
if (mModelObserver != null) {
for (TabModel model : mActivity.getTabModelSelector().getModels()) {
model.removeObserver(mModelObserver);
}
mModelObserver = null;
}
if (mContextualSearchObserver != null && mActivity.getContextualSearchManager() != null) {
mActivity.getContextualSearchManager().removeObserver(mContextualSearchObserver);
mContextualSearchObserver = null;
}
}
use of org.chromium.chrome.browser.tabmodel.TabModel 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