android.webkit.WebStorage Java Examples

The following examples show how to use android.webkit.WebStorage. 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: CordovaChromeClient.java    From cordova-android-chromeview with Apache License 2.0 7 votes vote down vote up
/**
 * 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);
    }
}
 
Example #2
Source File: InAppBrowser.java    From cordova-android-chromeview with Apache License 2.0 6 votes vote down vote up
/**
 * 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);
    }
}
 
Example #3
Source File: WebViewUtils.java    From Dashchan with Apache License 2.0 5 votes vote down vote up
public static void clearAll(WebView webView) {
	clearCookie();
	if (webView != null) {
		webView.clearCache(true);
	}
	WebViewDatabase webViewDatabase = WebViewDatabase.getInstance(MainApplication.getInstance());
	webViewDatabase.clearFormData();
	webViewDatabase.clearHttpAuthUsernamePassword();
	WebStorage.getInstance().deleteAllData();
}
 
Example #4
Source File: RobotiumWebClient.java    From AndroidRipper with GNU Affero General Public License v3.0 5 votes vote down vote up
@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);
	} 
}
 
Example #5
Source File: SystemWebChromeClient.java    From xmall with MIT License 5 votes vote down vote up
/**
 * 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);
}
 
Example #6
Source File: SystemWebChromeClient.java    From ultimate-cordova-webview-app with MIT License 5 votes vote down vote up
/**
 * 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);
}
 
Example #7
Source File: WebChromeClientDelegate.java    From AgentWeb with Apache License 2.0 5 votes vote down vote up
@Override
@Deprecated
public void onReachedMaxAppCacheSize(long requiredStorage, long quota,
                                     WebStorage.QuotaUpdater quotaUpdater) {
    if (this.mDelegate != null) {
        this.mDelegate.onReachedMaxAppCacheSize(requiredStorage, quota, quotaUpdater);
        return;
    }
    super.onReachedMaxAppCacheSize(requiredStorage, quota, quotaUpdater);
}
 
Example #8
Source File: BrowserActivity.java    From browser with GNU General Public License v2.0 5 votes vote down vote up
@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();
	}
}
 
Example #9
Source File: SystemWebChromeClient.java    From keemob with MIT License 5 votes vote down vote up
/**
 * Handle database quota exceeded notification.
 */
@Override
@SuppressWarnings("deprecation")
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);
}
 
Example #10
Source File: SystemWebChromeClient.java    From keemob with MIT License 5 votes vote down vote up
/**
 * Handle database quota exceeded notification.
 */
@Override
@SuppressWarnings("deprecation")
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);
}
 
Example #11
Source File: WebChromeClientDelegate.java    From AgentWeb with Apache License 2.0 5 votes vote down vote up
@Override
@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.
    if (this.mDelegate != null) {
        this.mDelegate.onExceededDatabaseQuota(url, databaseIdentifier, quota, estimatedDatabaseSize, totalQuota, quotaUpdater);
        return;
    }
    super.onExceededDatabaseQuota(url, databaseIdentifier, quota, estimatedDatabaseSize, totalQuota, quotaUpdater);

}
 
Example #12
Source File: SystemWebChromeClient.java    From app-icon with MIT License 5 votes vote down vote up
/**
 * 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);
}
 
Example #13
Source File: ClassicWebViewProvider.java    From focus-android with Mozilla Public License 2.0 5 votes vote down vote up
/**
 * 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 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);
}
 
Example #14
Source File: SystemWebChromeClient.java    From cordova-plugin-app-update-demo with MIT License 5 votes vote down vote up
/**
 * 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);
}
 
Example #15
Source File: CordovaChromeClient.java    From L.TileLayer.Cordova with MIT License 5 votes vote down vote up
/**
 * 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);
}
 
Example #16
Source File: SystemWebChromeClient.java    From BigDataPlatform with GNU General Public License v3.0 5 votes vote down vote up
/**
 * 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);
}
 
Example #17
Source File: SystemWebChromeClient.java    From a2cardboard with Apache License 2.0 5 votes vote down vote up
/**
 * 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);
}
 
Example #18
Source File: CordovaChromeClient.java    From IoTgo_Android_App with MIT License 5 votes vote down vote up
/**
 * 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);
}
 
Example #19
Source File: SystemWebChromeClient.java    From cordova-plugin-intent with MIT License 5 votes vote down vote up
/**
 * 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);
}
 
Example #20
Source File: CordovaChromeClient.java    From bluemix-parking-meter with MIT License 5 votes vote down vote up
/**
 * 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);
}
 
Example #21
Source File: SystemWebChromeClient.java    From chappiecast with Mozilla Public License 2.0 5 votes vote down vote up
/**
 * 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);
}
 
Example #22
Source File: SystemWebChromeClient.java    From pychat with MIT License 5 votes vote down vote up
/**
 * Handle database quota exceeded notification.
 */
@Override
@SuppressWarnings("deprecation")
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);
}
 
Example #23
Source File: SystemWebChromeClient.java    From lona with GNU General Public License v3.0 5 votes vote down vote up
/**
 * 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);
}
 
Example #24
Source File: CordovaChromeClient.java    From reader with MIT License 5 votes vote down vote up
/**
 * 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);
}
 
Example #25
Source File: CordovaChromeClient.java    From reader with MIT License 5 votes vote down vote up
/**
 * 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);
}
 
Example #26
Source File: CordovaChromeClient.java    From phonegapbootcampsite with MIT License 5 votes vote down vote up
/**
 * 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);
}
 
Example #27
Source File: CordovaChromeClient.java    From CordovaYoutubeVideoPlayer with MIT License 5 votes vote down vote up
/**
 * 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);
}
 
Example #28
Source File: CordovaChromeClient.java    From wildfly-samples with MIT License 5 votes vote down vote up
/**
 * 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);
}
 
Example #29
Source File: CordovaChromeClient.java    From phonegap-plugin-loading-spinner with Apache License 2.0 5 votes vote down vote up
/**
 * 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);
}
 
Example #30
Source File: SystemWebChromeClient.java    From countly-sdk-cordova with MIT License 5 votes vote down vote up
/**
 * Handle database quota exceeded notification.
 */
@Override
@SuppressWarnings("deprecation")
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);
}