summaryrefslogtreecommitdiffstats
path: root/src/com
diff options
context:
space:
mode:
authorBen Murdoch <benm@google.com>2009-04-22 12:34:12 +0100
committerBen Murdoch <benm@google.com>2009-04-30 13:47:23 +0100
commit092dd5d22d7f2ee0efcc68bd6e5a3afd1ea98953 (patch)
treeb15b884149af7b036f0e1dce4cfaf77900dc3c56 /src/com
parent6439977e2db31525729eeed1f12c00ef3ce72f69 (diff)
downloadpackages_apps_Browser-092dd5d22d7f2ee0efcc68bd6e5a3afd1ea98953.zip
packages_apps_Browser-092dd5d22d7f2ee0efcc68bd6e5a3afd1ea98953.tar.gz
packages_apps_Browser-092dd5d22d7f2ee0efcc68bd6e5a3afd1ea98953.tar.bz2
Merges p9 CLs 144856 and 145055 to GIT to enable the Database API in the browser.
Diffstat (limited to 'src/com')
-rw-r--r--src/com/android/browser/BrowserActivity.java29
-rw-r--r--src/com/android/browser/BrowserSettings.java10
2 files changed, 39 insertions, 0 deletions
diff --git a/src/com/android/browser/BrowserActivity.java b/src/com/android/browser/BrowserActivity.java
index 46b3960..bd68109 100644
--- a/src/com/android/browser/BrowserActivity.java
+++ b/src/com/android/browser/BrowserActivity.java
@@ -115,6 +115,7 @@ import android.webkit.URLUtil;
import android.webkit.WebChromeClient;
import android.webkit.WebHistoryItem;
import android.webkit.WebIconDatabase;
+import android.webkit.WebStorage;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.EditText;
@@ -3432,6 +3433,34 @@ public class BrowserActivity extends Activity
public void onReceivedIcon(WebView view, Bitmap icon) {
updateIcon(view.getUrl(), icon);
}
+
+ /**
+ * The origin has exceeded it's database quota.
+ * @param url the URL that exceeded the quota
+ * @param databaseIdentifier the identifier of the database on
+ * which the transaction that caused the quota overflow was run
+ * @param currentQuota the current quota for the origin.
+ * @param quotaUpdater The callback to run when a decision to allow or
+ * deny quota has been made. Don't forget to call this!
+ */
+ @Override
+ public void onExceededDatabaseQuota(String url,
+ String databaseIdentifier, long currentQuota,
+ WebStorage.QuotaUpdater quotaUpdater) {
+ if(LOGV_ENABLED) {
+ Log.v(LOGTAG,
+ "BrowserActivity received onExceededDatabaseQuota for "
+ + url +
+ ":"
+ + databaseIdentifier +
+ "(current quota: "
+ + currentQuota +
+ ")");
+ }
+ // Give the origin an extra megabyte to play with.
+ // TODO: This should show a prompt to the user, really :)
+ quotaUpdater.updateQuota(currentQuota + 1024 * 1024);
+ }
};
/**
diff --git a/src/com/android/browser/BrowserSettings.java b/src/com/android/browser/BrowserSettings.java
index e47ed60..95ed17b 100644
--- a/src/com/android/browser/BrowserSettings.java
+++ b/src/com/android/browser/BrowserSettings.java
@@ -74,6 +74,8 @@ class BrowserSettings extends Observable {
private boolean autoFitPage = true;
private boolean landscapeOnly = false;
private boolean showDebugSettings = false;
+ private String databasePath; // default value set in loadFromDb()
+ private boolean databaseEnabled = true;
// The Browser always enables Application Caches.
private boolean appCacheEnabled = true;
private String appCachePath; // default value set in loadFromDb().
@@ -185,6 +187,10 @@ class BrowserSettings extends Observable {
s.setSupportMultipleWindows(true);
// Turn off file access
s.setAllowFileAccess(false);
+
+ s.setDatabasePath(b.databasePath);
+ s.setDatabaseEnabled(b.databaseEnabled);
+
// Turn on Application Caches.
s.setAppCachePath(b.appCachePath);
s.setAppCacheEnabled(b.appCacheEnabled);
@@ -209,6 +215,8 @@ class BrowserSettings extends Observable {
pluginsPath = ctx.getDir("plugins", 0).getPath();
// Set the default value for the Application Caches path.
appCachePath = ctx.getDir("appcache", 0).getPath();
+ // Set the default value for the Database path.
+ databasePath = ctx.getDir("databases", 0).getPath();
homeUrl = DEFAULT_HOME_URL +
Partner.getString(ctx.getContentResolver(), Partner.CLIENT_ID);
@@ -232,6 +240,8 @@ class BrowserSettings extends Observable {
pluginsEnabled = p.getBoolean("enable_plugins",
pluginsEnabled);
pluginsPath = p.getString("plugins_path", pluginsPath);
+ databasePath = p.getString("database_path", databasePath);
+ databaseEnabled = p.getBoolean("enable_database", databaseEnabled);
appCacheEnabled = p.getBoolean("enable_appcache",
appCacheEnabled);
appCachePath = p.getString("appcache_path", appCachePath);