org.chromium.chrome.browser.invalidation.InvalidationController Java Examples

The following examples show how to use org.chromium.chrome.browser.invalidation.InvalidationController. 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: RecentTabsManager.java    From delion with Apache License 2.0 6 votes vote down vote up
/**
 * Create an RecentTabsManager to be used with RecentTabsPage and RecentTabsRowAdapter.
 *
 * @param tab The Tab that is showing this recent tabs page.
 * @param profile Profile that is associated with the current session.
 * @param context the Android context this manager will work in.
 */
public RecentTabsManager(Tab tab, Profile profile, Context context) {
    mProfile = profile;
    mTab = tab;
    mForeignSessionHelper = buildForeignSessionHelper(mProfile);
    mNewTabPagePrefs = buildNewTabPagePrefs(mProfile);
    mFaviconHelper = buildFaviconHelper();
    mRecentlyClosedBridge = buildRecentlyClosedBridge(mProfile);
    mSignInManager = SigninManager.get(context);
    mContext = context;

    updateRecentlyClosedTabs();
    registerForForeignSessionUpdates();
    updateForeignSessions();
    mForeignSessionHelper.triggerSessionSync();
    registerForSignInAndSyncNotifications();

    InvalidationController.get(mContext).onRecentTabsPageOpened();
}
 
Example #2
Source File: RecentTabsManager.java    From delion with Apache License 2.0 6 votes vote down vote up
/**
 * Should be called when this object is no longer needed. Performs necessary listener tear down.
 */
public void destroy() {
    mIsDestroyed = true;
    AndroidSyncSettings.unregisterObserver(mContext, this);

    mSignInManager.removeSignInStateObserver(this);
    mSignInManager = null;

    mFaviconHelper.destroy();
    mFaviconHelper = null;

    mRecentlyClosedBridge.destroy();
    mRecentlyClosedBridge = null;

    mForeignSessionHelper.destroy();
    mForeignSessionHelper = null;

    mUpdatedCallback = null;

    mNewTabPagePrefs.destroy();
    mNewTabPagePrefs = null;

    InvalidationController.get(mContext).onRecentTabsPageClosed();
}
 
Example #3
Source File: RecentTabsManager.java    From AndroidChromium with Apache License 2.0 6 votes vote down vote up
/**
 * Create an RecentTabsManager to be used with RecentTabsPage and RecentTabsRowAdapter.
 *
 * @param tab The Tab that is showing this recent tabs page.
 * @param profile Profile that is associated with the current session.
 * @param context the Android context this manager will work in.
 */
public RecentTabsManager(Tab tab, Profile profile, Context context) {
    mProfile = profile;
    mTab = tab;
    mForeignSessionHelper = buildForeignSessionHelper(mProfile);
    mNewTabPagePrefs = buildNewTabPagePrefs(mProfile);
    mFaviconHelper = buildFaviconHelper();
    mRecentlyClosedBridge = buildRecentlyClosedBridge(mProfile);
    mSignInManager = SigninManager.get(context);
    mContext = context;

    updateRecentlyClosedTabs();
    registerForForeignSessionUpdates();
    updateForeignSessions();
    mForeignSessionHelper.triggerSessionSync();
    registerForSignInAndSyncNotifications();

    InvalidationController.get(mContext).onRecentTabsPageOpened();
}
 
Example #4
Source File: RecentTabsManager.java    From AndroidChromium with Apache License 2.0 6 votes vote down vote up
/**
 * Should be called when this object is no longer needed. Performs necessary listener tear down.
 */
public void destroy() {
    mIsDestroyed = true;
    AndroidSyncSettings.unregisterObserver(mContext, this);

    mSignInManager.removeSignInStateObserver(this);
    mSignInManager = null;

    mFaviconHelper.destroy();
    mFaviconHelper = null;

    mRecentlyClosedBridge.destroy();
    mRecentlyClosedBridge = null;

    mForeignSessionHelper.destroy();
    mForeignSessionHelper = null;

    mUpdatedCallback = null;

    mNewTabPagePrefs.destroy();
    mNewTabPagePrefs = null;

    InvalidationController.get(mContext).onRecentTabsPageClosed();
}
 
Example #5
Source File: RecentTabsManager.java    From 365browser with Apache License 2.0 6 votes vote down vote up
/**
 * Should be called when this object is no longer needed. Performs necessary listener tear down.
 */
public void destroy() {
    mIsDestroyed = true;
    AndroidSyncSettings.unregisterObserver(mContext, this);

    mSignInManager.removeSignInStateObserver(this);
    mSignInManager = null;

    mFaviconHelper.destroy();
    mFaviconHelper = null;

    mRecentlyClosedTabManager.destroy();
    mRecentlyClosedTabManager = null;

    mForeignSessionHelper.destroy();
    mForeignSessionHelper = null;

    mUpdatedCallback = null;

    mPrefs.destroy();
    mPrefs = null;

    InvalidationController.get(mContext).onRecentTabsPageClosed();
}
 
Example #6
Source File: SyncCustomizationFragment.java    From delion with Apache License 2.0 5 votes vote down vote up
private void configureSyncDataTypes() {
    if (maybeDisableSync()) return;

    boolean syncEverything = mSyncEverything.isChecked();
    mProfileSyncService.setPreferredDataTypes(syncEverything, getSelectedModelTypes());
    // Update the invalidation listener with the set of types we are enabling.
    InvalidationController invController = InvalidationController.get(getActivity());
    invController.ensureStartedAndUpdateRegisteredTypes();
}
 
Example #7
Source File: SyncCustomizationFragment.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
private void configureSyncDataTypes() {
    if (maybeDisableSync()) return;

    boolean syncEverything = mSyncEverything.isChecked();
    mProfileSyncService.setPreferredDataTypes(syncEverything, getSelectedModelTypes());
    // Update the invalidation listener with the set of types we are enabling.
    InvalidationController invController = InvalidationController.get(getActivity());
    invController.ensureStartedAndUpdateRegisteredTypes();
}
 
Example #8
Source File: RecentTabsManager.java    From 365browser with Apache License 2.0 5 votes vote down vote up
/**
 * Create an RecentTabsManager to be used with RecentTabsPage and RecentTabsRowAdapter.
 *
 * @param tab The Tab that is showing this recent tabs page.
 * @param profile Profile that is associated with the current session.
 * @param context the Android context this manager will work in.
 */
public RecentTabsManager(Tab tab, Profile profile, Context context) {
    mProfile = profile;
    mTab = tab;
    mForeignSessionHelper = new ForeignSessionHelper(profile);
    mPrefs = new RecentTabsPagePrefs(profile);
    mFaviconHelper = new FaviconHelper();
    mRecentlyClosedTabManager = sRecentlyClosedTabManagerForTests != null
            ? sRecentlyClosedTabManagerForTests
            : new RecentlyClosedBridge(profile);
    mSignInManager = SigninManager.get(context);
    mContext = context;

    mRecentlyClosedTabManager.setTabsUpdatedRunnable(new Runnable() {
        @Override
        public void run() {
            updateRecentlyClosedTabs();
            postUpdate();
        }
    });

    updateRecentlyClosedTabs();
    registerForForeignSessionUpdates();
    updateForeignSessions();
    mForeignSessionHelper.triggerSessionSync();
    registerForSignInAndSyncNotifications();

    InvalidationController.get(mContext).onRecentTabsPageOpened();
}
 
Example #9
Source File: SyncCustomizationFragment.java    From 365browser with Apache License 2.0 5 votes vote down vote up
private void configureSyncDataTypes() {
    if (maybeDisableSync()) return;

    boolean syncEverything = mSyncEverything.isChecked();
    mProfileSyncService.setPreferredDataTypes(syncEverything, getSelectedModelTypes());
    // Update the invalidation listener with the set of types we are enabling.
    InvalidationController invController = InvalidationController.get(getActivity());
    invController.ensureStartedAndUpdateRegisteredTypes();
}
 
Example #10
Source File: SyncController.java    From android-chromium with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private void start() {
    ThreadUtils.assertOnUiThread();
    if (mSyncStatusHelper.isMasterSyncAutomaticallyEnabled()) {
        Log.d(TAG, "Enabling sync");
        Account account = mChromeSigninController.getSignedInUser();
        InvalidationController.get(mContext).start();
        mProfileSyncService.enableSync();
        mSyncStatusHelper.enableAndroidSync(account);
    }
}
 
Example #11
Source File: SyncController.java    From android-chromium with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private void stop() {
    ThreadUtils.assertOnUiThread();
    if (mChromeSigninController.isSignedIn()) {
        Log.d(TAG, "Disabling sync");
        Account account = mChromeSigninController.getSignedInUser();
        InvalidationController.get(mContext).stop();
        mProfileSyncService.disableSync();
        mSyncStatusHelper.disableAndroidSync(account);
    }
}
 
Example #12
Source File: SyncController.java    From android-chromium with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private void start() {
    ThreadUtils.assertOnUiThread();
    if (mSyncStatusHelper.isMasterSyncAutomaticallyEnabled()) {
        Log.d(TAG, "Enabling sync");
        Account account = mChromeSigninController.getSignedInUser();
        InvalidationController.get(mContext).start();
        mProfileSyncService.enableSync();
        mSyncStatusHelper.enableAndroidSync(account);
    }
}
 
Example #13
Source File: SyncController.java    From android-chromium with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private void stop() {
    ThreadUtils.assertOnUiThread();
    if (mChromeSigninController.isSignedIn()) {
        Log.d(TAG, "Disabling sync");
        Account account = mChromeSigninController.getSignedInUser();
        InvalidationController.get(mContext).stop();
        mProfileSyncService.disableSync();
        mSyncStatusHelper.disableAndroidSync(account);
    }
}