Java Code Examples for org.chromium.chrome.browser.tabmodel.TabModel#addObserver()
The following examples show how to use
org.chromium.chrome.browser.tabmodel.TabModel#addObserver() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CustomTabLayoutManager.java From delion with Apache License 2.0 | 5 votes |
@Override public void init(TabModelSelector selector, TabCreatorManager creator, TabContentManager content, ViewGroup androidContentContainer, ContextualSearchManagementDelegate contextualSearchDelegate, ReaderModeManagerDelegate readerModeDelegate, DynamicResourceLoader dynamicResourceLoader) { super.init(selector, creator, content, androidContentContainer, contextualSearchDelegate, readerModeDelegate, dynamicResourceLoader); for (TabModel model : selector.getModels()) model.addObserver(mTabModelObserver); }
Example 2
Source File: ToolbarManager.java From delion with Apache License 2.0 | 5 votes |
private void onNativeLibraryReady() { mNativeLibraryReady = true; mToolbar.onNativeLibraryReady(); if (FeatureUtilities.isTabSwitchingEnabledInDocumentMode(mToolbar.getContext())) { // We want to give a similar look and feel as Android's overview mode button // by not updating tab count and keep the button as a rounded square. mShouldUpdateTabCount = false; } final TemplateUrlService templateUrlService = TemplateUrlService.getInstance(); TemplateUrlService.LoadListener mTemplateServiceLoadListener = new TemplateUrlService.LoadListener() { @Override public void onTemplateUrlServiceLoaded() { registerTemplateUrlObserver(); templateUrlService.unregisterLoadListener(this); } }; templateUrlService.registerLoadListener(mTemplateServiceLoadListener); if (templateUrlService.isLoaded()) { mTemplateServiceLoadListener.onTemplateUrlServiceLoaded(); } else { templateUrlService.load(); } mTabModelSelector.addObserver(mTabModelSelectorObserver); for (TabModel model : mTabModelSelector.getModels()) model.addObserver(mTabModelObserver); refreshSelectedTab(); if (mTabModelSelector.isTabStateInitialized()) mTabRestoreCompleted = true; handleTabRestoreCompleted(); }
Example 3
Source File: FindToolbar.java From delion with Apache License 2.0 | 5 votes |
/** * 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(); }
Example 4
Source File: IncognitoToggleButtonTablet.java From delion with Apache License 2.0 | 5 votes |
@Override protected void onAttachedToWindow() { if (mTabModelSelector != null) { mTabModelSelector.addObserver(mTabModelSelectorObserver); for (TabModel model : mTabModelSelector.getModels()) { model.addObserver(mTabModelObserver); } } super.onAttachedToWindow(); }
Example 5
Source File: CustomTabLayoutManager.java From AndroidChromium with Apache License 2.0 | 5 votes |
@Override public void init(TabModelSelector selector, TabCreatorManager creator, TabContentManager content, ViewGroup androidContentContainer, ContextualSearchManagementDelegate contextualSearchDelegate, ReaderModeManagerDelegate readerModeDelegate, DynamicResourceLoader dynamicResourceLoader) { super.init(selector, creator, content, androidContentContainer, contextualSearchDelegate, readerModeDelegate, dynamicResourceLoader); for (TabModel model : selector.getModels()) model.addObserver(mTabModelObserver); }
Example 6
Source File: ToolbarManager.java From AndroidChromium with Apache License 2.0 | 5 votes |
private void onNativeLibraryReady() { mNativeLibraryReady = true; mToolbar.onNativeLibraryReady(); final TemplateUrlService templateUrlService = TemplateUrlService.getInstance(); TemplateUrlService.LoadListener mTemplateServiceLoadListener = new TemplateUrlService.LoadListener() { @Override public void onTemplateUrlServiceLoaded() { registerTemplateUrlObserver(); templateUrlService.unregisterLoadListener(this); } }; templateUrlService.registerLoadListener(mTemplateServiceLoadListener); if (templateUrlService.isLoaded()) { mTemplateServiceLoadListener.onTemplateUrlServiceLoaded(); } else { templateUrlService.load(); } mTabModelSelector.addObserver(mTabModelSelectorObserver); for (TabModel model : mTabModelSelector.getModels()) model.addObserver(mTabModelObserver); refreshSelectedTab(); if (mTabModelSelector.isTabStateInitialized()) mTabRestoreCompleted = true; handleTabRestoreCompleted(); }
Example 7
Source File: FindToolbar.java From AndroidChromium with Apache License 2.0 | 5 votes |
/** * 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(); }
Example 8
Source File: IncognitoToggleButtonTablet.java From AndroidChromium with Apache License 2.0 | 5 votes |
@Override protected void onAttachedToWindow() { if (mTabModelSelector != null) { mTabModelSelector.addObserver(mTabModelSelectorObserver); for (TabModel model : mTabModelSelector.getModels()) { model.addObserver(mTabModelObserver); } } super.onAttachedToWindow(); }
Example 9
Source File: CustomTabLayoutManager.java From 365browser with Apache License 2.0 | 5 votes |
@Override public void init(TabModelSelector selector, TabCreatorManager creator, TabContentManager content, ViewGroup androidContentContainer, ContextualSearchManagementDelegate contextualSearchDelegate, ReaderModeManagerDelegate readerModeDelegate, DynamicResourceLoader dynamicResourceLoader) { super.init(selector, creator, content, androidContentContainer, contextualSearchDelegate, readerModeDelegate, dynamicResourceLoader); for (TabModel model : selector.getModels()) model.addObserver(mTabModelObserver); }
Example 10
Source File: ToolbarManager.java From 365browser with Apache License 2.0 | 5 votes |
private void onNativeLibraryReady() { mNativeLibraryReady = true; mToolbar.onNativeLibraryReady(); final TemplateUrlService templateUrlService = TemplateUrlService.getInstance(); TemplateUrlService.LoadListener mTemplateServiceLoadListener = new TemplateUrlService.LoadListener() { @Override public void onTemplateUrlServiceLoaded() { registerTemplateUrlObserver(); templateUrlService.unregisterLoadListener(this); } }; templateUrlService.registerLoadListener(mTemplateServiceLoadListener); if (templateUrlService.isLoaded()) { mTemplateServiceLoadListener.onTemplateUrlServiceLoaded(); } else { templateUrlService.load(); } mTabModelSelector.addObserver(mTabModelSelectorObserver); for (TabModel model : mTabModelSelector.getModels()) model.addObserver(mTabModelObserver); refreshSelectedTab(); if (mTabModelSelector.isTabStateInitialized()) mTabRestoreCompleted = true; handleTabRestoreCompleted(); }
Example 11
Source File: FindToolbar.java From 365browser with Apache License 2.0 | 5 votes |
/** * 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(); }
Example 12
Source File: IncognitoToggleButtonTablet.java From 365browser with Apache License 2.0 | 5 votes |
@Override protected void onAttachedToWindow() { if (mTabModelSelector != null) { mTabModelSelector.addObserver(mTabModelSelectorObserver); for (TabModel model : mTabModelSelector.getModels()) { model.addObserver(mTabModelObserver); } } super.onAttachedToWindow(); }
Example 13
Source File: EmptyBackgroundViewWrapper.java From delion with Apache License 2.0 | 4 votes |
/** * Initialize the wrapper to listen for the proper notifications. */ public void initialize() { for (TabModel model : mTabModelSelector.getModels()) model.addObserver(mTabModelObserver); mTabModelSelector.addObserver(mTabModelSelectorObserver); }
Example 14
Source File: EmptyBackgroundViewWrapper.java From AndroidChromium with Apache License 2.0 | 4 votes |
/** * Initialize the wrapper to listen for the proper notifications. */ public void initialize() { for (TabModel model : mTabModelSelector.getModels()) model.addObserver(mTabModelObserver); mTabModelSelector.addObserver(mTabModelSelectorObserver); }
Example 15
Source File: EmptyBackgroundViewWrapper.java From 365browser with Apache License 2.0 | 4 votes |
/** * Initialize the wrapper to listen for the proper notifications. */ public void initialize() { for (TabModel model : mTabModelSelector.getModels()) model.addObserver(mTabModelObserver); mTabModelSelector.addObserver(mTabModelSelectorObserver); }