Java Code Examples for org.chromium.net.NetworkChangeNotifier#isInitialized()

The following examples show how to use org.chromium.net.NetworkChangeNotifier#isInitialized() . 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: AccountManagerHelper.java    From android-chromium with BSD 2-Clause "Simplified" License 6 votes vote down vote up
private void onGotAuthTokenResult(Account account, String authTokenType, String authToken,
        GetAuthTokenCallback callback, AtomicInteger numTries, AtomicBoolean errorEncountered,
        ConnectionRetry retry) {
    if (authToken != null || !errorEncountered.get() ||
            numTries.incrementAndGet() == MAX_TRIES ||
            !NetworkChangeNotifier.isInitialized()) {
        callback.tokenAvailable(authToken);
        return;
    }
    if (retry == null) {
        ConnectionRetry newRetry = new ConnectionRetry(account, authTokenType, callback,
                numTries, errorEncountered);
        NetworkChangeNotifier.addConnectionTypeObserver(newRetry);
    } else {
        NetworkChangeNotifier.addConnectionTypeObserver(retry);
    }
}
 
Example 2
Source File: AccountManagerHelper.java    From android-chromium with BSD 2-Clause "Simplified" License 6 votes vote down vote up
private void onGotAuthTokenResult(Account account, String authTokenType, String authToken,
        GetAuthTokenCallback callback, AtomicInteger numTries, AtomicBoolean errorEncountered,
        ConnectionRetry retry) {
    if (authToken != null || !errorEncountered.get() ||
            numTries.incrementAndGet() == MAX_TRIES ||
            !NetworkChangeNotifier.isInitialized()) {
        callback.tokenAvailable(authToken);
        return;
    }
    if (retry == null) {
        ConnectionRetry newRetry = new ConnectionRetry(account, authTokenType, callback,
                numTries, errorEncountered);
        NetworkChangeNotifier.addConnectionTypeObserver(newRetry);
    } else {
        NetworkChangeNotifier.addConnectionTypeObserver(retry);
    }
}
 
Example 3
Source File: ContextualSearchTabHelper.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
private ContextualSearchTabHelper(Tab tab) {
    mTab = tab;
    tab.addObserver(this);
    // Connect to a network, unless under test.
    if (NetworkChangeNotifier.isInitialized()) {
        NetworkChangeNotifier.addConnectionTypeObserver(this);
    }
}
 
Example 4
Source File: ContextualSearchTabHelper.java    From 365browser with Apache License 2.0 5 votes vote down vote up
private ContextualSearchTabHelper(Tab tab) {
    mTab = tab;
    tab.addObserver(this);
    // Connect to a network, unless under test.
    if (NetworkChangeNotifier.isInitialized()) {
        NetworkChangeNotifier.addConnectionTypeObserver(this);
    }
}
 
Example 5
Source File: ContextualSearchTabHelper.java    From 365browser with Apache License 2.0 5 votes vote down vote up
@Override
public void onDestroyed(Tab tab) {
    if (mNativeHelper != 0) {
        nativeDestroy(mNativeHelper);
        mNativeHelper = 0;
    }
    if (mTemplateUrlObserver != null) {
        TemplateUrlService.getInstance().removeObserver(mTemplateUrlObserver);
    }
    if (NetworkChangeNotifier.isInitialized()) {
        NetworkChangeNotifier.removeConnectionTypeObserver(this);
    }
    removeContextualSearchHooks(mBaseContentViewCore);
    mBaseContentViewCore = null;
}