本文整理匯總了Java中android.webkit.WebStorage類的典型用法代碼示例。如果您正苦於以下問題:Java WebStorage類的具體用法?Java WebStorage怎麽用?Java WebStorage使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
WebStorage類屬於android.webkit包,在下文中一共展示了WebStorage類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: cleanup
import android.webkit.WebStorage; //導入依賴的package包/類
@Override
public void cleanup() {
clearFormData();
clearHistory();
clearMatches();
clearSslPreferences();
clearCache(true);
// We don't care about the callback - we just want to make sure cookies are gone
CookieManager.getInstance().removeAllCookies(null);
WebStorage.getInstance().deleteAllData();
final WebViewDatabase webViewDatabase = WebViewDatabase.getInstance(getContext());
// It isn't entirely clear how this differs from WebView.clearFormData()
webViewDatabase.clearFormData();
webViewDatabase.clearHttpAuthUsernamePassword();
deleteContentFromKnownLocations(getContext());
}
示例2: onExceededDatabaseQuota
import android.webkit.WebStorage; //導入依賴的package包/類
/**
* Handle database quota exceeded notification.
*
* @param url
* @param databaseIdentifier
* @param currentQuota
* @param estimatedSize
* @param totalUsedQuota
* @param quotaUpdater
*/
@Override
public void onExceededDatabaseQuota(String url, String databaseIdentifier, long currentQuota, long estimatedSize,
long totalUsedQuota, WebStorage.QuotaUpdater quotaUpdater)
{
LOG.d(LOG_TAG, "onExceededDatabaseQuota estimatedSize: %d currentQuota: %d totalUsedQuota: %d", estimatedSize, currentQuota, totalUsedQuota);
if (estimatedSize < MAX_QUOTA)
{
//increase for 1Mb
long newQuota = estimatedSize;
LOG.d(LOG_TAG, "calling quotaUpdater.updateQuota newQuota: %d", newQuota);
quotaUpdater.updateQuota(newQuota);
}
else
{
// Set the quota to whatever it is and force an error
// TODO: get docs on how to handle this properly
quotaUpdater.updateQuota(currentQuota);
}
}
示例3: onExceededDatabaseQuota
import android.webkit.WebStorage; //導入依賴的package包/類
/**
* Handle database quota exceeded notification.
*
* @param url
* @param databaseIdentifier
* @param currentQuota
* @param estimatedSize
* @param totalUsedQuota
* @param quotaUpdater
*/
@Override
public void onExceededDatabaseQuota(String url, String databaseIdentifier, long currentQuota, long estimatedSize,
long totalUsedQuota, WebStorage.QuotaUpdater quotaUpdater)
{
LOG.d(TAG, "onExceededDatabaseQuota estimatedSize: %d currentQuota: %d totalUsedQuota: %d", estimatedSize, currentQuota, totalUsedQuota);
if (estimatedSize < MAX_QUOTA)
{
//increase for 1Mb
long newQuota = estimatedSize;
LOG.d(TAG, "calling quotaUpdater.updateQuota newQuota: %d", newQuota);
quotaUpdater.updateQuota(newQuota);
}
else
{
// Set the quota to whatever it is and force an error
// TODO: get docs on how to handle this properly
quotaUpdater.updateQuota(currentQuota);
}
}
示例4: onExceededDatabaseQuota
import android.webkit.WebStorage; //導入依賴的package包/類
/** 當超出數據庫限額時的處理 */
@Override
public void onExceededDatabaseQuota(String url, String databaseIdentifier,
long currentQuota, long estimatedSize, long totalUsedQuota,
WebStorage.QuotaUpdater quotaUpdater) {
XLog.d(CLASS_NAME,
"onExceededDatabaseQuota estimatedSize: %d currentQuota: %d totalUsedQuota: %d",
estimatedSize, currentQuota, totalUsedQuota);
if (estimatedSize < MAX_QUOTA) {
// increase for 1Mb
long newQuota = estimatedSize;
XLog.d(CLASS_NAME, "calling quotaUpdater.updateQuota newQuota: %d",
newQuota);
quotaUpdater.updateQuota(newQuota);
} else {
// TODO: get docs on how to handle this properly
quotaUpdater.updateQuota(currentQuota);
}
}
示例5: onExceededDatabaseQuota
import android.webkit.WebStorage; //導入依賴的package包/類
/**
* Handle database quota exceeded notification.
*/
@Override
public void onExceededDatabaseQuota(String url, String databaseIdentifier, long currentQuota, long estimatedSize,
long totalUsedQuota, WebStorage.QuotaUpdater quotaUpdater)
{
LOG.d(LOG_TAG, "onExceededDatabaseQuota estimatedSize: %d currentQuota: %d totalUsedQuota: %d", estimatedSize, currentQuota, totalUsedQuota);
quotaUpdater.updateQuota(MAX_QUOTA);
}
示例6: onExceededDatabaseQuota
import android.webkit.WebStorage; //導入依賴的package包/類
@Deprecated
public void onExceededDatabaseQuota(String url, String databaseIdentifier,
long quota, long estimatedDatabaseSize, long totalQuota,
WebStorage.QuotaUpdater quotaUpdater) {
// This default implementation passes the current quota back to WebCore.
// WebCore will interpret this that new quota was declined.
//注掉
// quotaUpdater.updateQuota(quota);
if (this.mRealWebChromeClient != null){
this.mRealWebChromeClient.onExceededDatabaseQuota(url, databaseIdentifier, quota, estimatedDatabaseSize, totalQuota, quotaUpdater);
return;
}
super.onExceededDatabaseQuota(url,databaseIdentifier,quota,estimatedDatabaseSize,totalQuota,quotaUpdater);
}
示例7: onReachedMaxAppCacheSize
import android.webkit.WebStorage; //導入依賴的package包/類
@Deprecated
public void onReachedMaxAppCacheSize(long requiredStorage, long quota,
WebStorage.QuotaUpdater quotaUpdater) {
if (this.mRealWebChromeClient != null){
this.mRealWebChromeClient.onReachedMaxAppCacheSize(requiredStorage, quota, quotaUpdater);
return;
}
super.onReachedMaxAppCacheSize(requiredStorage,quota,quotaUpdater);
}
示例8: onExceededDatabaseQuota
import android.webkit.WebStorage; //導入依賴的package包/類
@Override
public void onExceededDatabaseQuota(String url, String databaseIdentifier, long quota, long estimatedDatabaseSize, long totalQuota, WebStorage.QuotaUpdater quotaUpdater) {
if (AgentWebUtils.isOverriedMethod(mWebChromeClient, "onExceededDatabaseQuota", ChromePath + ".onExceededDatabaseQuota", String.class, String.class, long.class, long.class, long.class, WebStorage.QuotaUpdater.class)) {
super.onExceededDatabaseQuota(url, databaseIdentifier, quota, estimatedDatabaseSize, totalQuota, quotaUpdater);
return;
}
quotaUpdater.updateQuota(totalQuota * 2);
}
示例9: onReachedMaxAppCacheSize
import android.webkit.WebStorage; //導入依賴的package包/類
@Override
public void onReachedMaxAppCacheSize(long requiredStorage, long quota, WebStorage.QuotaUpdater quotaUpdater) {
if (AgentWebUtils.isOverriedMethod(mWebChromeClient, "onReachedMaxAppCacheSize", ChromePath + ".onReachedMaxAppCacheSize", long.class, long.class, WebStorage.QuotaUpdater.class)) {
super.onReachedMaxAppCacheSize(requiredStorage, quota, quotaUpdater);
return;
}
quotaUpdater.updateQuota(requiredStorage * 2);
}
示例10: clearCookies
import android.webkit.WebStorage; //導入依賴的package包/類
@SuppressLint("NewApi")
@SuppressWarnings("deprecation")
public void clearCookies() {
// TODO Break out web storage deletion into its own option/action
// TODO clear web storage for all sites that are visited in Incognito mode
WebStorage storage = WebStorage.getInstance();
storage.deleteAllData();
CookieManager c = CookieManager.getInstance();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
c.removeAllCookies(null);
} else {
CookieSyncManager.createInstance(this);
c.removeAllCookie();
}
}
示例11: onExceededDatabaseQuota
import android.webkit.WebStorage; //導入依賴的package包/類
/**
* Handle database quota exceeded notification.
*/
@Override
public void onExceededDatabaseQuota(String url, String databaseIdentifier, long currentQuota, long estimatedSize,
long totalUsedQuota, WebStorage.QuotaUpdater quotaUpdater)
{
LOG.d(TAG, "onExceededDatabaseQuota estimatedSize: %d currentQuota: %d totalUsedQuota: %d", estimatedSize, currentQuota, totalUsedQuota);
quotaUpdater.updateQuota(MAX_QUOTA);
}
示例12: onExceededDatabaseQuota
import android.webkit.WebStorage; //導入依賴的package包/類
@Override
public void onExceededDatabaseQuota(String url, String databaseIdentifier, long
currentQuota, long estimatedSize, long totalUsedQuota, WebStorage.QuotaUpdater
quotaUpdater) {
Log.d(TAG, "onExceededDatabaseQuota() called with: url = [" + url + "], " +
"databaseIdentifier = [" + databaseIdentifier + "], currentQuota = [" +
currentQuota + "], estimatedSize = [" + estimatedSize + "], " +
"totalUsedQuota = [" + totalUsedQuota + "], quotaUpdater = [" +
quotaUpdater + "]");
quotaUpdater.updateQuota(5 * 1024 * 1024);
}
示例13: onExceededDatabaseQuota
import android.webkit.WebStorage; //導入依賴的package包/類
@Override
public void onExceededDatabaseQuota(String url, String databaseIdentifier, long quota,
long estimatedDatabaseSize, long totalQuota, WebStorage.QuotaUpdater quotaUpdater) {
if (originalWebChromeClient != null) {
originalWebChromeClient.onExceededDatabaseQuota(url, databaseIdentifier, quota, estimatedDatabaseSize, totalQuota, quotaUpdater);
} else {
super.onExceededDatabaseQuota(url, databaseIdentifier, quota, estimatedDatabaseSize, totalQuota, quotaUpdater);
}
}
示例14: onReachedMaxAppCacheSize
import android.webkit.WebStorage; //導入依賴的package包/類
@Override
public void onReachedMaxAppCacheSize(long requiredStorage, long quota, WebStorage.QuotaUpdater quotaUpdater) {
if (originalWebChromeClient != null) {
originalWebChromeClient.onReachedMaxAppCacheSize(requiredStorage, quota, quotaUpdater);
} else {
super.onReachedMaxAppCacheSize(requiredStorage, quota, quotaUpdater);
}
}
示例15: performNewBrowserSessionCleanup
import android.webkit.WebStorage; //導入依賴的package包/類
/**
* A cleanup that should occur when a new browser session starts. This might be able to be merged with
* {@link #performCleanup(Context)}, but I didn't want to do it now to avoid unforeseen side effects. We can do this
* when we rethink our erase strategy: #1472.
*
* This function must be called before WebView.loadUrl to avoid erasing current session data.
*/
public static void performNewBrowserSessionCleanup() {
// If the app is closed in certain ways, WebView.cleanup will not get called and we don't clear cookies.
CookieManager.getInstance().removeAllCookies(null);
// We run this on the main thread to guarantee it occurs before loadUrl so we don't erase current session data.
final StrictMode.ThreadPolicy oldPolicy = StrictMode.allowThreadDiskWrites();
// When left open on erase, some pages, like the google search results, will asynchronously write LocalStorage
// files to disk after we erase them. To work-around this, we delete this data again when starting a new browser session.
WebStorage.getInstance().deleteAllData();
StrictMode.setThreadPolicy(oldPolicy);
}