OLD | NEW |
---|---|
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 package org.chromium.android_webview; | 5 package org.chromium.android_webview; |
6 | 6 |
7 import android.app.Application; | 7 import android.app.Application; |
8 import android.content.Context; | 8 import android.content.Context; |
9 | 9 |
10 import org.chromium.android_webview.policy.AwPolicyProvider; | |
10 import org.chromium.base.ApplicationStatus; | 11 import org.chromium.base.ApplicationStatus; |
11 import org.chromium.base.CommandLine; | 12 import org.chromium.base.CommandLine; |
12 import org.chromium.base.PathUtils; | 13 import org.chromium.base.PathUtils; |
13 import org.chromium.base.ThreadUtils; | 14 import org.chromium.base.ThreadUtils; |
14 import org.chromium.base.library_loader.LibraryLoader; | 15 import org.chromium.base.library_loader.LibraryLoader; |
15 import org.chromium.base.library_loader.LibraryProcessType; | 16 import org.chromium.base.library_loader.LibraryProcessType; |
16 import org.chromium.base.library_loader.ProcessInitException; | 17 import org.chromium.base.library_loader.ProcessInitException; |
17 import org.chromium.content.browser.BrowserStartupController; | 18 import org.chromium.content.browser.BrowserStartupController; |
19 import org.chromium.policy.CombinedPolicyProvider; | |
18 | 20 |
19 /** | 21 /** |
20 * Wrapper for the steps needed to initialize the java and native sides of webvi ew chromium. | 22 * Wrapper for the steps needed to initialize the java and native sides of webvi ew chromium. |
21 */ | 23 */ |
22 public abstract class AwBrowserProcess { | 24 public abstract class AwBrowserProcess { |
23 public static final String PRIVATE_DATA_DIRECTORY_SUFFIX = "webview"; | 25 public static final String PRIVATE_DATA_DIRECTORY_SUFFIX = "webview"; |
24 | 26 |
25 private static final String TAG = "AwBrowserProcess"; | 27 private static final String TAG = "AwBrowserProcess"; |
26 | 28 |
27 /** | 29 /** |
(...skipping 26 matching lines...) Expand all Loading... | |
54 public static void start(final Context context, final Application applicatio n) { | 56 public static void start(final Context context, final Application applicatio n) { |
55 // We must post to the UI thread to cover the case that the user | 57 // We must post to the UI thread to cover the case that the user |
56 // has invoked Chromium startup by using the (thread-safe) | 58 // has invoked Chromium startup by using the (thread-safe) |
57 // CookieManager rather than creating a WebView. | 59 // CookieManager rather than creating a WebView. |
58 ThreadUtils.runOnUiThreadBlocking(new Runnable() { | 60 ThreadUtils.runOnUiThreadBlocking(new Runnable() { |
59 @Override | 61 @Override |
60 public void run() { | 62 public void run() { |
61 if (application != null) { | 63 if (application != null) { |
62 ApplicationStatus.initializeActivityIndependent(application, context); | 64 ApplicationStatus.initializeActivityIndependent(application, context); |
63 } | 65 } |
66 | |
67 // The policies are used by browser startup, so we need to regis ter the policy | |
68 // providers before starting the browser process. This only regi sters java objects | |
69 // and doesn't need the native library. | |
70 CombinedPolicyProvider.get().registerProvider(new AwPolicyProvid er(context)); | |
sgurun-gerrit only
2015/11/13 08:43:51
please remind me where the user manager reads the
dgn
2015/11/25 00:27:15
We read them through the app restriction system, w
| |
71 | |
64 try { | 72 try { |
65 BrowserStartupController.get(context, LibraryProcessType.PRO CESS_WEBVIEW) | 73 BrowserStartupController.get(context, LibraryProcessType.PRO CESS_WEBVIEW) |
66 .startBrowserProcessesSync(!CommandLine.getInstance( ).hasSwitch( | 74 .startBrowserProcessesSync(!CommandLine.getInstance( ).hasSwitch( |
67 AwSwitches.WEBVIEW_SANDBOXED_RENDERE R)); | 75 AwSwitches.WEBVIEW_SANDBOXED_RENDERE R)); |
68 } catch (ProcessInitException e) { | 76 } catch (ProcessInitException e) { |
69 throw new RuntimeException("Cannot initialize WebView", e); | 77 throw new RuntimeException("Cannot initialize WebView", e); |
70 } | 78 } |
71 } | 79 } |
72 }); | 80 }); |
73 } | 81 } |
74 | 82 |
75 /** | 83 /** |
76 * Same as {@link #start(Context, Application)} except it does not enable Ap plicationStatus. | 84 * Same as {@link #start(Context, Application)} except it does not enable Ap plicationStatus. |
77 */ | 85 */ |
78 public static void start(final Context context) { | 86 public static void start(final Context context) { |
79 start(context, null); | 87 start(context, null); |
80 } | 88 } |
81 } | 89 } |
OLD | NEW |