Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1722)

Unified Diff: android_webview/java/src/org/chromium/android_webview/AwBrowserProcess.java

Issue 12208099: Create java AwBrowserContext (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: android_webview/java/src/org/chromium/android_webview/AwBrowserProcess.java
diff --git a/android_webview/java/src/org/chromium/android_webview/AwBrowserProcess.java b/android_webview/java/src/org/chromium/android_webview/AwBrowserProcess.java
index 5e027f63f4a199868d60be15ebfb2dda6fbe45b1..4d6c1ff14213f921411fe80413b239325cb59ee3 100644
--- a/android_webview/java/src/org/chromium/android_webview/AwBrowserProcess.java
+++ b/android_webview/java/src/org/chromium/android_webview/AwBrowserProcess.java
@@ -5,6 +5,7 @@
package org.chromium.android_webview;
import android.content.Context;
+import android.content.SharedPreferences;
import org.chromium.base.PathUtils;
import org.chromium.base.ThreadUtils;
@@ -24,6 +25,8 @@ public abstract class AwBrowserProcess {
private static final String PRIVATE_DATA_DIRECTORY_SUFFIX = "webview";
+ private static AwBrowserContext sDefaultBrowserContext;
+
/**
* Loads the native library, and performs basic static construction of objects needed
* to run webview in this process. Does not create threads; safe to call from zygote.
@@ -35,12 +38,22 @@ public abstract class AwBrowserProcess {
LibraryLoader.loadNow();
}
+ // TODO(joth): remove when downstream is using new version below.
+ @Deprecated
+ public static void start(Context c) {
+ start(c, null);
+ }
+
/**
* Starts the chromium browser process running within this process. Creates threads
* and performs other per-app resource allocations; must not be called from zygote.
* Note: it is up to the caller to ensure this is only called once.
+ * @param context The Android application context
+ * @param defaultContextPreferences SharedPreferences that will be used for the default
+ * browsing context.
*/
- public static void start(final Context context) {
+ public static void start(final Context context,
+ final SharedPreferences defaultContextPreferences) {
// We must post to the UI thread to cover the case that the user
// has invoked Chromium startup by using the (thread-safe)
// CookieManager rather than creating a WebView.
@@ -54,7 +67,12 @@ public abstract class AwBrowserProcess {
} catch (ProcessInitException e) {
throw new RuntimeException("Cannot initialize WebView", e);
}
+ sDefaultBrowserContext = new AwBrowserContext(defaultContextPreferences);
}
});
}
+
+ public static AwBrowserContext getDefaultBrowserContext() {
+ return sDefaultBrowserContext;
+ }
}

Powered by Google App Engine
This is Rietveld 408576698