Search in sources :

Example 1 with OnClearBrowsingDataListener

use of org.chromium.chrome.browser.preferences.PrefServiceBridge.OnClearBrowsingDataListener in project AndroidChromium by JackyAndroid.

the class SyncUserDataWiper method wipeSyncUserData.

/**
     * Wipes the user's bookmarks and sync data.
     * @return A promise which will be fulfilled once the data is wiped.
     */
public static Promise<Void> wipeSyncUserData() {
    final Promise<Void> promise = new Promise<>();
    final BookmarkModel model = new BookmarkModel();
    model.runAfterBookmarkModelLoaded(new Runnable() {

        @Override
        public void run() {
            model.removeAllUserBookmarks();
            model.destroy();
            PrefServiceBridge.getInstance().clearBrowsingData(new OnClearBrowsingDataListener() {

                @Override
                public void onBrowsingDataCleared() {
                    promise.fulfill(null);
                }
            }, SYNC_DATA_TYPES, TimePeriod.ALL_TIME);
        }
    });
    return promise;
}
Also used : Promise(org.chromium.base.Promise) OnClearBrowsingDataListener(org.chromium.chrome.browser.preferences.PrefServiceBridge.OnClearBrowsingDataListener) BookmarkModel(org.chromium.chrome.browser.bookmarks.BookmarkModel)

Aggregations

Promise (org.chromium.base.Promise)1 BookmarkModel (org.chromium.chrome.browser.bookmarks.BookmarkModel)1 OnClearBrowsingDataListener (org.chromium.chrome.browser.preferences.PrefServiceBridge.OnClearBrowsingDataListener)1