summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTorne (Richard Coles) <torne@google.com>2013-10-03 12:39:09 +0100
committerJonathan Dixon <joth@google.com>2013-11-27 21:25:43 +0000
commit8be908c9c3af0debd0aeb0e4ff511dd16bcecf7b (patch)
tree55cec636ce54487e5d37e07d6423c5cd3669961f
parent8ec5fb8559251164082b3f050c090ceb740a14e8 (diff)
downloadandroid_frameworks_webview-8be908c9c3af0debd0aeb0e4ff511dd16bcecf7b.tar.gz
android_frameworks_webview-8be908c9c3af0debd0aeb0e4ff511dd16bcecf7b.tar.bz2
android_frameworks_webview-8be908c9c3af0debd0aeb0e4ff511dd16bcecf7b.zip
Allow CookieManager to be used without starting Chromium.
If getCookieManager is called without Chromium having been started, set the application context but don't start Chromium. The native code will create a temporary cookie manager. Bug: 10969703 Change-Id: Ic1bd67d352dee78a761a4abf549cd9ba9ddb9f8d (cherry picked from commit 9dab5652ee2433cb990baca967d4331be0b2d3f3)
-rw-r--r--chromium/java/com/android/webview/chromium/WebViewChromiumFactoryProvider.java9
1 files changed, 8 insertions, 1 deletions
diff --git a/chromium/java/com/android/webview/chromium/WebViewChromiumFactoryProvider.java b/chromium/java/com/android/webview/chromium/WebViewChromiumFactoryProvider.java
index 7ccdee3..b823543 100644
--- a/chromium/java/com/android/webview/chromium/WebViewChromiumFactoryProvider.java
+++ b/chromium/java/com/android/webview/chromium/WebViewChromiumFactoryProvider.java
@@ -46,6 +46,7 @@ import org.chromium.base.CommandLine;
import org.chromium.base.MemoryPressureListener;
import org.chromium.base.PathService;
import org.chromium.base.ThreadUtils;
+import org.chromium.content.app.ContentMain;
import org.chromium.content.app.LibraryLoader;
import org.chromium.content.browser.ContentViewStatics;
import org.chromium.content.browser.ResourceExtractor;
@@ -315,7 +316,13 @@ public class WebViewChromiumFactoryProvider implements WebViewFactoryProvider {
public CookieManager getCookieManager() {
synchronized (mLock) {
if (mCookieManager == null) {
- ensureChromiumStartedLocked(true);
+ if (!mStarted) {
+ // We can use CookieManager without starting Chromium; the native code
+ // will bring up just the parts it needs to make this work on a temporary
+ // basis until Chromium is started for real. The temporary cookie manager
+ // needs the application context to have been set.
+ ContentMain.initApplicationContext(ActivityThread.currentApplication());
+ }
mCookieManager = new CookieManagerAdapter(new AwCookieManager());
}
}