OLD | NEW |
---|---|
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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.chrome.browser.webapps; | 5 package org.chromium.chrome.browser.webapps; |
6 | 6 |
7 import android.content.Intent; | 7 import android.content.Intent; |
8 | 8 |
9 import org.chromium.base.ContextUtils; | |
10 import org.chromium.base.library_loader.LibraryProcessType; | |
11 import org.chromium.chrome.browser.ChromeApplication; | |
9 import org.chromium.chrome.browser.ShortcutHelper; | 12 import org.chromium.chrome.browser.ShortcutHelper; |
13 import org.chromium.content.browser.ChildProcessCreationParams; | |
10 import org.chromium.content_public.browser.LoadUrlParams; | 14 import org.chromium.content_public.browser.LoadUrlParams; |
11 import org.chromium.ui.base.PageTransition; | 15 import org.chromium.ui.base.PageTransition; |
12 | 16 |
13 /** | 17 /** |
14 * An Activity is designed for WebAPKs (native Android apps) and displays a weba pp in a nearly | 18 * An Activity is designed for WebAPKs (native Android apps) and displays a weba pp in a nearly |
15 * UI-less Chrome. | 19 * UI-less Chrome. |
16 */ | 20 */ |
17 public class WebApkActivity extends WebappActivity { | 21 public class WebApkActivity extends WebappActivity { |
18 @Override | 22 @Override |
19 protected void onNewIntent(Intent intent) { | 23 protected void onNewIntent(Intent intent) { |
(...skipping 12 matching lines...) Expand all Loading... | |
32 new LoadUrlParams(overrideUrl, PageTransition.AUTO_TOPLEVEL) ); | 36 new LoadUrlParams(overrideUrl, PageTransition.AUTO_TOPLEVEL) ); |
33 } | 37 } |
34 } | 38 } |
35 | 39 |
36 @Override | 40 @Override |
37 protected void initializeSplashScreenWidgets(final int backgroundColor) { | 41 protected void initializeSplashScreenWidgets(final int backgroundColor) { |
38 // TODO(hanxi): Removes this function and use {@link WebApkActivity}'s i mplementation | 42 // TODO(hanxi): Removes this function and use {@link WebApkActivity}'s i mplementation |
39 // when WebAPKs are registered in WebappRegistry. | 43 // when WebAPKs are registered in WebappRegistry. |
40 initializeSplashScreenWidgets(backgroundColor, null); | 44 initializeSplashScreenWidgets(backgroundColor, null); |
41 } | 45 } |
46 | |
47 @Override | |
48 public void onResume() { | |
49 super.onResume(); | |
50 // WebAPK hosts Chrome's renderer processes by declaring Chrome' rendere r service in its | |
51 // AndroidManifest.xml. We set WebAPK's child process creation parameter to let the | |
52 // {@link ChildProcessLauncher} knows which application's renderer servi ce to connect. | |
pkotwicz
2016/05/27 21:10:13
Nit: connect to
Can you update this comment. I do
Xi Han
2016/05/27 21:31:39
Done.
| |
53 initializeChildProcessCreationParams(true); | |
54 } | |
55 | |
56 @Override | |
57 protected void initializeChildProcessCreationParams() { | |
58 // TODO(hanxi): crbug.com/611842. Investigates whether this function wor ks for multiple | |
59 // window or with --site-per-process enabled. | |
pkotwicz
2016/05/27 21:10:13
window -> windows
Xi Han
2016/05/27 21:31:39
Done.
| |
60 initializeChildProcessCreationParams(true); | |
61 } | |
62 | |
63 @Override | |
64 public void onPause() { | |
65 super.onPause(); | |
66 initializeChildProcessCreationParams(false); | |
67 } | |
68 | |
pkotwicz
2016/05/27 21:10:13
Nit: isForWebApk
Please add a comment to this fun
Xi Han
2016/05/27 21:31:39
Done.
| |
69 private void initializeChildProcessCreationParams(boolean isforWebApk) { | |
70 ChromeApplication chrome = (ChromeApplication) ContextUtils.getApplicati onContext(); | |
71 ChildProcessCreationParams params = chrome.getChildProcessCreationParams (); | |
72 if (isforWebApk) { | |
73 params = new ChildProcessCreationParams(getWebappInfo().webApkPackag eName(), | |
74 params.getExtraBindFlags(), LibraryProcessType.PROCESS_WEBAP K_CHILD); | |
75 } | |
76 ChildProcessCreationParams.set(params); | |
77 } | |
42 } | 78 } |
OLD | NEW |