本文整理匯總了Java中org.chromium.chrome.browser.preferences.website.Website.StoredDataClearedCallback類的典型用法代碼示例。如果您正苦於以下問題:Java StoredDataClearedCallback類的具體用法?Java StoredDataClearedCallback怎麽用?Java StoredDataClearedCallback使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
StoredDataClearedCallback類屬於org.chromium.chrome.browser.preferences.website.Website包,在下文中一共展示了StoredDataClearedCallback類的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: clearStorage
import org.chromium.chrome.browser.preferences.website.Website.StoredDataClearedCallback; //導入依賴的package包/類
/**
* This clears all the storage for websites that are displayed to the user. This happens
* asynchronously, and then we call {@link #getInfoForOrigins()} when we're done.
*/
public void clearStorage() {
if (mWebsites == null) {
return;
}
RecordUserAction.record("MobileSettingsStorageClearAll");
// The goal is to refresh the info for origins again after we've cleared all of them, so we
// wait until the last website is cleared to refresh the origin list.
final int[] numLeft = new int[1];
numLeft[0] = mWebsites.size();
for (int i = 0; i < mWebsites.size(); i++) {
WebsitePreference preference = mWebsites.get(i);
preference.site().clearAllStoredData(new StoredDataClearedCallback() {
@Override
public void onStoredDataCleared() {
if (--numLeft[0] <= 0) {
getInfoForOrigins();
}
}
});
}
}