org.chromium.chrome.browser.tabmodel.TabModelSelectorTabObserver Java Examples

The following examples show how to use org.chromium.chrome.browser.tabmodel.TabModelSelectorTabObserver. 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: UmaSessionStats.java    From delion with Apache License 2.0 5 votes vote down vote up
/**
 * Starts a new session for logging.
 * @param tabModelSelector A TabModelSelector instance for recording tab counts on page loads.
 * If null, UmaSessionStats does not record page loads and tab counts.
 */
public void startNewSession(TabModelSelector tabModelSelector) {
    ensureNativeInitialized();

    mTabModelSelector = tabModelSelector;
    if (mTabModelSelector != null) {
        mComponentCallbacks = new ComponentCallbacks() {
            @Override
            public void onLowMemory() {
                // Not required
            }

            @Override
            public void onConfigurationChanged(Configuration newConfig) {
                mKeyboardConnected = newConfig.keyboard != Configuration.KEYBOARD_NOKEYS;
            }
        };
        mContext.registerComponentCallbacks(mComponentCallbacks);
        mKeyboardConnected = mContext.getResources().getConfiguration()
                .keyboard != Configuration.KEYBOARD_NOKEYS;
        mTabModelSelectorTabObserver = new TabModelSelectorTabObserver(mTabModelSelector) {
            @Override
            public void onPageLoadFinished(Tab tab) {
                recordPageLoadStats(tab);
            }
        };
    }

    nativeUmaResumeSession(sNativeUmaSessionStats);
    NetworkChangeNotifier.addConnectionTypeObserver(this);
    updatePreferences();
    updateMetricsServiceState();
}
 
Example #2
Source File: UmaSessionStats.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
/**
 * Starts a new session for logging.
 * @param tabModelSelector A TabModelSelector instance for recording tab counts on page loads.
 * If null, UmaSessionStats does not record page loads and tab counts.
 */
public void startNewSession(TabModelSelector tabModelSelector) {
    ensureNativeInitialized();

    mTabModelSelector = tabModelSelector;
    if (mTabModelSelector != null) {
        mComponentCallbacks = new ComponentCallbacks() {
            @Override
            public void onLowMemory() {
                // Not required
            }

            @Override
            public void onConfigurationChanged(Configuration newConfig) {
                mKeyboardConnected = newConfig.keyboard != Configuration.KEYBOARD_NOKEYS;
            }
        };
        mContext.registerComponentCallbacks(mComponentCallbacks);
        mKeyboardConnected = mContext.getResources().getConfiguration()
                .keyboard != Configuration.KEYBOARD_NOKEYS;
        mTabModelSelectorTabObserver = new TabModelSelectorTabObserver(mTabModelSelector) {
            @Override
            public void onPageLoadFinished(Tab tab) {
                recordPageLoadStats(tab);
            }
        };
    }

    nativeUmaResumeSession(sNativeUmaSessionStats);
    updatePreferences();
    updateMetricsServiceState();
}
 
Example #3
Source File: UmaSessionStats.java    From 365browser with Apache License 2.0 5 votes vote down vote up
/**
 * Starts a new session for logging.
 * @param tabModelSelector A TabModelSelector instance for recording tab counts on page loads.
 * If null, UmaSessionStats does not record page loads and tab counts.
 */
public void startNewSession(TabModelSelector tabModelSelector) {
    ensureNativeInitialized();

    mTabModelSelector = tabModelSelector;
    if (mTabModelSelector != null) {
        mComponentCallbacks = new ComponentCallbacks() {
            @Override
            public void onLowMemory() {
                // Not required
            }

            @Override
            public void onConfigurationChanged(Configuration newConfig) {
                mKeyboardConnected = newConfig.keyboard != Configuration.KEYBOARD_NOKEYS;
            }
        };
        mContext.registerComponentCallbacks(mComponentCallbacks);
        mKeyboardConnected = mContext.getResources().getConfiguration()
                .keyboard != Configuration.KEYBOARD_NOKEYS;
        mTabModelSelectorTabObserver = new TabModelSelectorTabObserver(mTabModelSelector) {
            @Override
            public void onPageLoadFinished(Tab tab) {
                recordPageLoadStats(tab);
            }
        };
    }

    nativeUmaResumeSession(sNativeUmaSessionStats);
    updatePreferences();
    updateMetricsServiceState();
    DefaultBrowserInfo.logDefaultBrowserStats();
}