當前位置: 首頁>>代碼示例>>Java>>正文


Java WebStorage類代碼示例

本文整理匯總了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());
}
 
開發者ID:mozilla-mobile,項目名稱:focus-android,代碼行數:21,代碼來源:SystemWebView.java

示例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);
    }
}
 
開發者ID:psydrake,項目名稱:pandacoinBalance,代碼行數:31,代碼來源:InAppChromeClient.java

示例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);
    }
}
 
開發者ID:thedracle,項目名稱:cordova-android-chromeview,代碼行數:31,代碼來源:CordovaChromeClient.java

示例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);
    }
}
 
開發者ID:polyvi,項目名稱:openxface-android,代碼行數:20,代碼來源:InAppBrowserClient.java

示例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);
}
 
開發者ID:Andy-Ta,項目名稱:COB,代碼行數:11,代碼來源:SystemWebChromeClient.java

示例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);

    }
 
開發者ID:Justson,項目名稱:AgentWeb,代碼行數:16,代碼來源:WebChromeClientWrapper.java

示例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);
}
 
開發者ID:Justson,項目名稱:AgentWeb,代碼行數:10,代碼來源:WebChromeClientWrapper.java

示例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);
}
 
開發者ID:Justson,項目名稱:AgentWeb,代碼行數:12,代碼來源:DefaultChromeClient.java

示例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);
}
 
開發者ID:Justson,項目名稱:AgentWeb,代碼行數:12,代碼來源:DefaultChromeClient.java

示例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();
	}
}
 
開發者ID:NewCasino,項目名稱:browser,代碼行數:16,代碼來源:BrowserActivity.java

示例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);
}
 
開發者ID:aabognah,項目名稱:LoRaWAN-Smart-Parking,代碼行數:11,代碼來源:CordovaChromeClient.java

示例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);
}
 
開發者ID:fendoudebb,項目名稱:PlayAndroid,代碼行數:12,代碼來源:WebViewActivity.java

示例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);
    }
}
 
開發者ID:bitbar,項目名稱:robotium-extensions,代碼行數:10,代碼來源:ProxyWebChromeClient.java

示例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);
    }
}
 
開發者ID:bitbar,項目名稱:robotium-extensions,代碼行數:9,代碼來源:ProxyWebChromeClient.java

示例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);
}
 
開發者ID:mozilla-mobile,項目名稱:focus-android,代碼行數:21,代碼來源:WebViewProvider.java


注:本文中的android.webkit.WebStorage類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。