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; |
9 import org.chromium.chrome.browser.ShortcutHelper; | 10 import org.chromium.chrome.browser.ShortcutHelper; |
10 import org.chromium.content_public.browser.LoadUrlParams; | 11 import org.chromium.content_public.browser.LoadUrlParams; |
11 import org.chromium.ui.base.PageTransition; | 12 import org.chromium.ui.base.PageTransition; |
| 13 import org.chromium.webapk.lib.client.WebApkServiceConnectionManager; |
12 | 14 |
13 /** | 15 /** |
14 * An Activity is designed for WebAPKs (native Android apps) and displays a weba
pp in a nearly | 16 * An Activity is designed for WebAPKs (native Android apps) and displays a weba
pp in a nearly |
15 * UI-less Chrome. | 17 * UI-less Chrome. |
16 */ | 18 */ |
17 public class WebApkActivity extends WebappActivity { | 19 public class WebApkActivity extends WebappActivity { |
18 @Override | 20 @Override |
19 protected void onNewIntent(Intent intent) { | 21 protected void onNewIntent(Intent intent) { |
20 super.onNewIntent(intent); | 22 super.onNewIntent(intent); |
21 // We could bring a WebAPK hosted WebappActivity to foreground and navig
ate it to a | 23 // We could bring a WebAPK hosted WebappActivity to foreground and navig
ate it to a |
(...skipping 10 matching lines...) Expand all Loading... |
32 new LoadUrlParams(overrideUrl, PageTransition.AUTO_TOPLEVEL)
); | 34 new LoadUrlParams(overrideUrl, PageTransition.AUTO_TOPLEVEL)
); |
33 } | 35 } |
34 } | 36 } |
35 | 37 |
36 @Override | 38 @Override |
37 protected void initializeSplashScreenWidgets(final int backgroundColor) { | 39 protected void initializeSplashScreenWidgets(final int backgroundColor) { |
38 // TODO(hanxi): Removes this function and use {@link WebApkActivity}'s i
mplementation | 40 // TODO(hanxi): Removes this function and use {@link WebApkActivity}'s i
mplementation |
39 // when WebAPKs are registered in WebappRegistry. | 41 // when WebAPKs are registered in WebappRegistry. |
40 initializeSplashScreenWidgets(backgroundColor, null); | 42 initializeSplashScreenWidgets(backgroundColor, null); |
41 } | 43 } |
| 44 |
| 45 @Override |
| 46 public void onStop() { |
| 47 super.onStop(); |
| 48 String packageName = getWebappInfo().webApkPackageName(); |
| 49 WebApkServiceConnectionManager.getInstance().disconnect( |
| 50 ContextUtils.getApplicationContext(), packageName); |
| 51 } |
42 } | 52 } |
OLD | NEW |