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.base.ContextUtils; |
10 import org.chromium.chrome.browser.ShortcutHelper; | 10 import org.chromium.chrome.browser.ShortcutHelper; |
| 11 import org.chromium.chrome.browser.banners.AppBannerManager; |
| 12 import org.chromium.chrome.browser.tab.Tab; |
| 13 import org.chromium.chrome.browser.tab.TabDelegateFactory; |
11 import org.chromium.content_public.browser.LoadUrlParams; | 14 import org.chromium.content_public.browser.LoadUrlParams; |
12 import org.chromium.ui.base.PageTransition; | 15 import org.chromium.ui.base.PageTransition; |
13 import org.chromium.webapk.lib.client.WebApkServiceConnectionManager; | 16 import org.chromium.webapk.lib.client.WebApkServiceConnectionManager; |
14 | 17 |
15 /** | 18 /** |
16 * An Activity is designed for WebAPKs (native Android apps) and displays a weba
pp in a nearly | 19 * An Activity is designed for WebAPKs (native Android apps) and displays a weba
pp in a nearly |
17 * UI-less Chrome. | 20 * UI-less Chrome. |
18 */ | 21 */ |
19 public class WebApkActivity extends WebappActivity { | 22 public class WebApkActivity extends WebappActivity { |
20 @Override | 23 @Override |
(...skipping 15 matching lines...) Expand all Loading... |
36 } | 39 } |
37 | 40 |
38 @Override | 41 @Override |
39 protected void initializeSplashScreenWidgets(final int backgroundColor) { | 42 protected void initializeSplashScreenWidgets(final int backgroundColor) { |
40 // TODO(hanxi): Removes this function and use {@link WebApkActivity}'s i
mplementation | 43 // TODO(hanxi): Removes this function and use {@link WebApkActivity}'s i
mplementation |
41 // when WebAPKs are registered in WebappRegistry. | 44 // when WebAPKs are registered in WebappRegistry. |
42 initializeSplashScreenWidgets(backgroundColor, null); | 45 initializeSplashScreenWidgets(backgroundColor, null); |
43 } | 46 } |
44 | 47 |
45 @Override | 48 @Override |
| 49 protected TabDelegateFactory createTabDelegateFactory() { |
| 50 return new WebappDelegateFactory(this) { |
| 51 @Override |
| 52 public AppBannerManager createAppBannerManager(Tab tab) { |
| 53 // Do not show app banners for WebAPKs regardless of the current
page URL. |
| 54 // A WebAPK can display a page outside of its WebAPK scope if a
page within the |
| 55 // WebAPK scope navigates via JavaScript while the WebAPK is in
the background. |
| 56 return null; |
| 57 } |
| 58 }; |
| 59 } |
| 60 |
46 public void onStop() { | 61 public void onStop() { |
47 super.onStop(); | 62 super.onStop(); |
48 String packageName = getWebappInfo().webApkPackageName(); | 63 String packageName = getWebappInfo().webApkPackageName(); |
49 WebApkServiceConnectionManager.getInstance().disconnect( | 64 WebApkServiceConnectionManager.getInstance().disconnect( |
50 ContextUtils.getApplicationContext(), packageName); | 65 ContextUtils.getApplicationContext(), packageName); |
51 } | 66 } |
52 } | 67 } |
OLD | NEW |