diff options
author | Steve Block <steveblock@google.com> | 2010-09-28 10:44:17 +0100 |
---|---|---|
committer | Steve Block <steveblock@google.com> | 2010-09-28 12:32:05 +0100 |
commit | 5c23ebadd48c8c3190878030a9974f1ff36b0419 (patch) | |
tree | 891b90d6deb6c2284f501a6e023bf0efbceacd46 | |
parent | 1d9fc8c50452bb80c789e5c05e379855c33c0af0 (diff) | |
download | frameworks_base-5c23ebadd48c8c3190878030a9974f1ff36b0419.zip frameworks_base-5c23ebadd48c8c3190878030a9974f1ff36b0419.tar.gz frameworks_base-5c23ebadd48c8c3190878030a9974f1ff36b0419.tar.bz2 |
Update the storage locations used by the Chromium HTTP stack
This updates the strorage locations to better match those used by the
Android HTTP stack.
The corresponding external/webkit change is
https://android-git.corp.google.com/g/70643
Bug: 3039536
Change-Id: Ia7ea68d1472e96788a7fbaa6e8f7aa1ee51b3fb0
-rw-r--r-- | core/java/android/webkit/BrowserFrame.java | 27 | ||||
-rw-r--r-- | core/java/android/webkit/WebView.java | 16 | ||||
-rw-r--r-- | core/java/android/webkit/WebViewDatabase.java | 3 |
3 files changed, 34 insertions, 12 deletions
diff --git a/core/java/android/webkit/BrowserFrame.java b/core/java/android/webkit/BrowserFrame.java index 35cfbcb..efe4b9d 100644 --- a/core/java/android/webkit/BrowserFrame.java +++ b/core/java/android/webkit/BrowserFrame.java @@ -74,7 +74,8 @@ class BrowserFrame extends Handler { // queue has been cleared,they are ignored. private boolean mBlockMessages = false; - private static String sDataDirectory = ""; + private static String sDatabaseDirectory; + private static String sCacheDirectory; // Is this frame the main frame? private boolean mIsMainFrame; @@ -228,9 +229,11 @@ class BrowserFrame extends Handler { AssetManager am = context.getAssets(); nativeCreateFrame(w, am, proxy.getBackForwardList()); - if (sDataDirectory.length() == 0) { - String dir = appContext.getFilesDir().getAbsolutePath(); - sDataDirectory = dir.substring(0, dir.lastIndexOf('/')); + if (sDatabaseDirectory == null) { + sDatabaseDirectory = appContext.getDatabasePath("dummy").getParent(); + } + if (sCacheDirectory == null) { + sCacheDirectory = appContext.getCacheDir().getAbsolutePath(); } if (DebugFlags.BROWSER_FRAME) { @@ -652,11 +655,19 @@ class BrowserFrame extends Handler { } /** - * Called by JNI. Gets the applications data directory - * @return String The applications data directory + * Called by JNI. Gets the application's database directory, excluding the trailing slash. + * @return String The application's database directory + */ + private static String getDatabaseDirectory() { + return sDatabaseDirectory; + } + + /** + * Called by JNI. Gets the application's cache directory, excluding the trailing slash. + * @return String The application's cache directory */ - private static String getDataDirectory() { - return sDataDirectory; + private static String getCacheDirectory() { + return sCacheDirectory; } /** diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java index 73fd8ed..29ebd3a 100644 --- a/core/java/android/webkit/WebView.java +++ b/core/java/android/webkit/WebView.java @@ -1875,10 +1875,18 @@ public class WebView extends AbsoluteLayout * @hide pending API council approval. */ public static boolean cleanupPrivateBrowsingFiles(Context context) { - return nativeCleanupPrivateBrowsingFiles(context.getFilesDir().getParent()); - } - - private static native boolean nativeCleanupPrivateBrowsingFiles(String dataDirectory); + // It seems wrong that we have to pass the storage locations here, given + // that the storage files are created native-side in WebRequestContext + // (albeit using a dumb getter on BrowserFrame to get the paths from + // Java). It looks like this is required because we may need to call + // this method before the BrowserFrame has been set up. + // TODO: Investigate whether this can be avoided. + return nativeCleanupPrivateBrowsingFiles(context.getDatabasePath("dummy").getParent(), + context.getCacheDir().getAbsolutePath()); + } + + private static native boolean nativeCleanupPrivateBrowsingFiles(String databaseDirectory, + String cacheDirectory); private boolean extendScroll(int y) { int finalY = mScroller.getFinalY(); diff --git a/core/java/android/webkit/WebViewDatabase.java b/core/java/android/webkit/WebViewDatabase.java index d7b4452..8f89678 100644 --- a/core/java/android/webkit/WebViewDatabase.java +++ b/core/java/android/webkit/WebViewDatabase.java @@ -67,6 +67,9 @@ public class WebViewDatabase { private final Object mFormLock = new Object(); private final Object mHttpAuthLock = new Object(); + // TODO: The Chromium HTTP stack handles cookies independently. + // We should consider removing the cookies table if and when we switch to + // the Chromium HTTP stack for good. private static final String mTableNames[] = { "cookies", "password", "formurl", "formdata", "httpauth" }; |