| 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;
|
| + }
|
| }
|
|
|