Commit aca98f1a authored by Peter Kotwicz's avatar Peter Kotwicz Committed by Commit Bot

[Android Webapp] Always navigate as a result of clients#openWindow()

This CL makes webapps always navigate as a result of
clients#openWindow()
In particular:
- The CL moves WebApkConstants#EXTRA_WEBAPK_FORCE_NAVIGATION to
ShortcutHelper
- Sets the extra in ServiceTabLauncher#launchTab() for webapps

BUG=744843
NOPRESUBMIT=true
(Because the version in shell_apk_version.gni does not need to
be incremented because although I renamed
WebApkConstants#EXTRA_WEBAPK_FORCE_NAVIGATION I did not change
its value)

Change-Id: I98465c1f8773a705dc7177792256d901bf9aa6bc
Reviewed-on: https://chromium-review.googlesource.com/575328
Commit-Queue: Peter Kotwicz <pkotwicz@chromium.org>
Reviewed-by: default avatarDominick Ng <dominickn@chromium.org>
Reviewed-by: default avatarXi Han <hanxi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#488831}
parent e87d3b9b
......@@ -118,6 +118,7 @@ public class ServiceTabLauncher {
// webapp's scope, so it is valid.
intent.putExtra(ShortcutHelper.EXTRA_URL, url);
intent.putExtra(ShortcutHelper.EXTRA_SOURCE, ShortcutSource.NOTIFICATION);
intent.putExtra(ShortcutHelper.EXTRA_FORCE_NAVIGATION, true);
tabDelegate.createNewStandaloneFrame(intent);
}
}
......
......@@ -83,6 +83,10 @@ public class ShortcutHelper {
"org.chromium.chrome.browser.webapp_shortcut_version";
public static final String REUSE_URL_MATCHING_TAB_ELSE_NEW_TAB =
"REUSE_URL_MATCHING_TAB_ELSE_NEW_TAB";
// Whether the webapp should navigate to the URL in {@link EXTRA_URL} if the webapp is already
// open. Applies to webapps and WebAPKs. Value contains "webapk" for backward compatibility.
public static final String EXTRA_FORCE_NAVIGATION =
"org.chromium.chrome.browser.webapk_force_navigation";
// When a new field is added to the intent, this version should be incremented so that it will
// be correctly populated into the WebappRegistry/WebappDataStorage.
......
......@@ -35,7 +35,6 @@ public class WebApkInfo extends WebappInfo {
private static final String TAG = "WebApkInfo";
private boolean mForceNavigation;
private Icon mBadgeIcon;
private String mWebApkPackageName;
private int mShellApkVersion;
......@@ -63,10 +62,10 @@ public class WebApkInfo extends WebappInfo {
int source = sourceFromIntent(intent);
// Force navigation if the extra is not specified to avoid breaking deep linking for old
// WebAPKs which don't specify the {@link WebApkConstants#EXTRA_WEBAPK_FORCE_NAVIGATION}
// intent extra.
// WebAPKs which don't specify the {@link ShortcutHelper#EXTRA_FORCE_NAVIGATION} intent
// extra.
boolean forceNavigation = IntentUtils.safeGetBooleanExtra(
intent, WebApkConstants.EXTRA_WEBAPK_FORCE_NAVIGATION, true);
intent, ShortcutHelper.EXTRA_FORCE_NAVIGATION, true);
return create(webApkPackageName, url, source, forceNavigation);
}
......@@ -135,10 +134,11 @@ public class WebApkInfo extends WebappInfo {
int badgeIconId = IntentUtils.safeGetInt(bundle, WebApkMetaDataKeys.BADGE_ICON_ID, 0);
Bitmap badgeIcon = decodeImageResource(res, badgeIconId);
return create(WebApkConstants.WEBAPK_ID_PREFIX + webApkPackageName, url, forceNavigation,
scope, new Icon(primaryIcon), new Icon(badgeIcon), name, shortName, displayMode,
return create(WebApkConstants.WEBAPK_ID_PREFIX + webApkPackageName, url, scope,
new Icon(primaryIcon), new Icon(badgeIcon), name, shortName, displayMode,
orientation, source, themeColor, backgroundColor, webApkPackageName,
shellApkVersion, manifestUrl, manifestStartUrl, iconUrlToMurmur2HashMap);
shellApkVersion, manifestUrl, manifestStartUrl, iconUrlToMurmur2HashMap,
forceNavigation);
}
/**
......@@ -146,8 +146,6 @@ public class WebApkInfo extends WebappInfo {
*
* @param id ID for the WebAPK.
* @param url URL that the WebAPK should navigate to when launched.
* @param forceNavigation Whether the WebAPK should navigate to {@link url} if the
* WebAPK is already open.
* @param scope Scope for the WebAPK.
* @param primaryIcon Primary icon to show for the WebAPK.
* @param badgeIcon Badge icon to use for notifications.
......@@ -166,12 +164,14 @@ public class WebApkInfo extends WebappInfo {
* WebAPK is launched from a deep link.
* @param iconUrlToMurmur2HashMap Map of the WebAPK's icon URLs to Murmur2 hashes of the
* icon untransformed bytes.
* @param forceNavigation Whether the WebAPK should navigate to {@link url} if the
* WebAPK is already open.
*/
public static WebApkInfo create(String id, String url, boolean forceNavigation, String scope,
Icon primaryIcon, Icon badgeIcon, String name, String shortName, int displayMode,
int orientation, int source, long themeColor, long backgroundColor,
String webApkPackageName, int shellApkVersion, String manifestUrl,
String manifestStartUrl, Map<String, String> iconUrlToMurmur2HashMap) {
public static WebApkInfo create(String id, String url, String scope, Icon primaryIcon,
Icon badgeIcon, String name, String shortName, int displayMode, int orientation,
int source, long themeColor, long backgroundColor, String webApkPackageName,
int shellApkVersion, String manifestUrl, String manifestStartUrl,
Map<String, String> iconUrlToMurmur2HashMap, boolean forceNavigation) {
if (id == null || url == null || manifestStartUrl == null || webApkPackageName == null) {
Log.e(TAG,
"Incomplete data provided: " + id + ", " + url + ", " + manifestStartUrl + ", "
......@@ -186,21 +186,19 @@ public class WebApkInfo extends WebappInfo {
scope = ShortcutHelper.getScopeFromUrl(manifestStartUrl);
}
return new WebApkInfo(id, url, forceNavigation, scope, primaryIcon, badgeIcon, name,
shortName, displayMode, orientation, source, themeColor, backgroundColor,
webApkPackageName, shellApkVersion, manifestUrl, manifestStartUrl,
iconUrlToMurmur2HashMap);
return new WebApkInfo(id, url, scope, primaryIcon, badgeIcon, name, shortName, displayMode,
orientation, source, themeColor, backgroundColor, webApkPackageName,
shellApkVersion, manifestUrl, manifestStartUrl, iconUrlToMurmur2HashMap,
forceNavigation);
}
protected WebApkInfo(String id, String url, boolean forceNavigation, String scope,
Icon primaryIcon, Icon badgeIcon, String name, String shortName, int displayMode,
int orientation, int source, long themeColor, long backgroundColor,
String webApkPackageName, int shellApkVersion, String manifestUrl,
String manifestStartUrl, Map<String, String> iconUrlToMurmur2HashMap) {
protected WebApkInfo(String id, String url, String scope, Icon primaryIcon, Icon badgeIcon,
String name, String shortName, int displayMode, int orientation, int source,
long themeColor, long backgroundColor, String webApkPackageName, int shellApkVersion,
String manifestUrl, String manifestStartUrl,
Map<String, String> iconUrlToMurmur2HashMap, boolean forceNavigation) {
super(id, url, scope, primaryIcon, name, shortName, displayMode, orientation, source,
themeColor,
backgroundColor, false);
mForceNavigation = forceNavigation;
themeColor, backgroundColor, false /* isIconGenerated */, forceNavigation);
mBadgeIcon = badgeIcon;
mWebApkPackageName = webApkPackageName;
mShellApkVersion = shellApkVersion;
......@@ -211,11 +209,6 @@ public class WebApkInfo extends WebappInfo {
protected WebApkInfo() {}
@Override
public boolean shouldForceNavigation() {
return mForceNavigation;
}
/**
* Returns the badge icon in Bitmap form.
*/
......@@ -250,7 +243,7 @@ public class WebApkInfo extends WebappInfo {
intent.putExtra(ShortcutHelper.EXTRA_URL, uri().toString());
intent.putExtra(ShortcutHelper.EXTRA_SOURCE, source());
intent.putExtra(WebApkConstants.EXTRA_WEBAPK_PACKAGE_NAME, webApkPackageName());
intent.putExtra(WebApkConstants.EXTRA_WEBAPK_FORCE_NAVIGATION, mForceNavigation);
intent.putExtra(ShortcutHelper.EXTRA_FORCE_NAVIGATION, shouldForceNavigation());
}
/**
......
......@@ -116,12 +116,11 @@ public class WebApkUpdateDataFetcher extends EmptyTabObserver {
iconUrlToMurmur2HashMap.put(iconUrl, murmur2Hash);
}
WebApkInfo info = WebApkInfo.create(mOldInfo.id(), mOldInfo.uri().toString(),
mOldInfo.shouldForceNavigation(), scopeUrl, new WebApkInfo.Icon(primaryIconBitmap),
new WebApkInfo.Icon(badgeIconBitmap), name, shortName, displayMode, orientation,
mOldInfo.source(), themeColor, backgroundColor, mOldInfo.webApkPackageName(),
mOldInfo.shellApkVersion(), mOldInfo.manifestUrl(), manifestStartUrl,
iconUrlToMurmur2HashMap);
WebApkInfo info = WebApkInfo.create(mOldInfo.id(), mOldInfo.uri().toString(), scopeUrl,
new WebApkInfo.Icon(primaryIconBitmap), new WebApkInfo.Icon(badgeIconBitmap), name,
shortName, displayMode, orientation, mOldInfo.source(), themeColor, backgroundColor,
mOldInfo.webApkPackageName(), mOldInfo.shellApkVersion(), mOldInfo.manifestUrl(),
manifestStartUrl, iconUrlToMurmur2HashMap, mOldInfo.shouldForceNavigation());
mObserver.onGotManifestData(info, primaryIconUrl, badgeIconUrl);
}
......
......@@ -66,6 +66,7 @@ public class WebappInfo {
private long mThemeColor;
private long mBackgroundColor;
private boolean mIsIconGenerated;
private boolean mForceNavigation;
public static WebappInfo createEmpty() {
return new WebappInfo();
......@@ -124,12 +125,14 @@ public class WebappInfo {
ShortcutHelper.MANIFEST_COLOR_INVALID_OR_MISSING);
boolean isIconGenerated = IntentUtils.safeGetBooleanExtra(intent,
ShortcutHelper.EXTRA_IS_ICON_GENERATED, false);
boolean forceNavigation = IntentUtils.safeGetBooleanExtra(
intent, ShortcutHelper.EXTRA_FORCE_NAVIGATION, false);
String name = nameFromIntent(intent);
String shortName = shortNameFromIntent(intent);
return create(id, url, scope, new Icon(icon), name, shortName, displayMode,
orientation, source, themeColor, backgroundColor, isIconGenerated);
return create(id, url, scope, new Icon(icon), name, shortName, displayMode, orientation,
source, themeColor, backgroundColor, isIconGenerated, forceNavigation);
}
/**
......@@ -146,22 +149,24 @@ public class WebappInfo {
* @param themeColor The theme color of the webapp.
* @param backgroundColor The background color of the webapp.
* @param isIconGenerated Whether the |icon| was generated by Chromium.
* @param forceNavigation Whether the webapp should navigate to {@link url} if the
* webapp is already open.
*/
public static WebappInfo create(String id, String url, String scope, Icon icon, String name,
String shortName, int displayMode, int orientation, int source, long themeColor,
long backgroundColor, boolean isIconGenerated) {
long backgroundColor, boolean isIconGenerated, boolean forceNavigation) {
if (id == null || url == null) {
Log.e(TAG, "Incomplete data provided: " + id + ", " + url);
return null;
}
return new WebappInfo(id, url, scope, icon, name, shortName, displayMode, orientation,
source, themeColor, backgroundColor, isIconGenerated);
return new WebappInfo(id, url, scope, icon, name, shortName, displayMode,
orientation, source, themeColor, backgroundColor, isIconGenerated, forceNavigation);
}
protected WebappInfo(String id, String url, String scope, Icon icon, String name,
String shortName, int displayMode, int orientation, int source, long themeColor,
long backgroundColor, boolean isIconGenerated) {
long backgroundColor, boolean isIconGenerated, boolean forceNavigation) {
Uri uri = Uri.parse(url);
if (TextUtils.isEmpty(scope)) {
scope = ShortcutHelper.getScopeFromUrl(url);
......@@ -180,6 +185,7 @@ public class WebappInfo {
mThemeColor = themeColor;
mBackgroundColor = backgroundColor;
mIsIconGenerated = isIconGenerated;
mForceNavigation = forceNavigation;
mIsInitialized = mUri != null;
}
......@@ -203,7 +209,7 @@ public class WebappInfo {
* Chrome receives a ACTION_START_WEBAPP intent.
*/
public boolean shouldForceNavigation() {
return false;
return mForceNavigation;
}
public Uri scopeUri() {
......@@ -303,6 +309,7 @@ public class WebappInfo {
public void setWebappIntentExtras(Intent intent) {
intent.putExtra(ShortcutHelper.EXTRA_ID, id());
intent.putExtra(ShortcutHelper.EXTRA_URL, uri().toString());
intent.putExtra(ShortcutHelper.EXTRA_FORCE_NAVIGATION, shouldForceNavigation());
intent.putExtra(ShortcutHelper.EXTRA_SCOPE, scopeUri().toString());
intent.putExtra(ShortcutHelper.EXTRA_ICON, encodedIcon());
intent.putExtra(ShortcutHelper.EXTRA_VERSION, ShortcutHelper.WEBAPP_SHORTCUT_VERSION);
......
......@@ -122,9 +122,9 @@ public class WebApkUpdateDataFetcherTest {
ThreadUtils.runOnUiThread(new Runnable() {
@Override
public void run() {
WebApkInfo oldInfo = WebApkInfo.create("", "", false /* forceNavigation */,
scopeUrl, null, null, null, null, -1, -1, -1, -1, -1, "random.package", -1,
manifestUrl, "", new HashMap<String, String>());
WebApkInfo oldInfo = WebApkInfo.create("", "", scopeUrl, null, null, null, null, -1,
-1, -1, -1, -1, "random.package", -1, manifestUrl, "",
new HashMap<String, String>(), false /* forceNavigation */);
fetcher.start(mTab, oldInfo, observer);
}
});
......
......@@ -163,12 +163,12 @@ public class WebApkUpdateManagerTest {
ThreadUtils.runOnUiThreadBlocking(new Runnable() {
@Override
public void run() {
WebApkInfo info = WebApkInfo.create(WEBAPK_ID, "", false /* forceNavigation */,
creationData.scope, null, null, creationData.name, creationData.shortName,
creationData.displayMode, creationData.orientation, 0,
creationData.themeColor, creationData.backgroundColor, "",
WebApkVersion.CURRENT_SHELL_APK_VERSION, creationData.manifestUrl,
creationData.startUrl, creationData.iconUrlToMurmur2HashMap);
WebApkInfo info = WebApkInfo.create(WEBAPK_ID, "", creationData.scope, null, null,
creationData.name, creationData.shortName, creationData.displayMode,
creationData.orientation, 0, creationData.themeColor,
creationData.backgroundColor, "", WebApkVersion.CURRENT_SHELL_APK_VERSION,
creationData.manifestUrl, creationData.startUrl,
creationData.iconUrlToMurmur2HashMap, false /* forceNavigation */);
updateManager.updateIfNeeded(mTab, info);
}
});
......
......@@ -94,7 +94,8 @@ public class WebappModeTest {
WebappInfo webappInfo = WebappInfo.create(id, url, null, new WebappInfo.Icon(icon), title,
null, WebDisplayMode.STANDALONE, ScreenOrientationValues.PORTRAIT,
ShortcutSource.UNKNOWN, ShortcutHelper.MANIFEST_COLOR_INVALID_OR_MISSING,
ShortcutHelper.MANIFEST_COLOR_INVALID_OR_MISSING, false);
ShortcutHelper.MANIFEST_COLOR_INVALID_OR_MISSING, false /* isIconGenerated */,
false /* forceNavigation */);
webappInfo.setWebappIntentExtras(intent);
return intent;
......
......@@ -124,12 +124,12 @@ public class WebappVisibilityTest {
WebappInfo info;
if (type == Type.WEBAPP) {
delegate = new WebappBrowserControlsDelegate(null, new Tab(0, false, null));
info = WebappInfo.create(
"", webappStartUrlOrScopeUrl, null, null, null, null, 0, 0, 0, 0, 0, false);
info = WebappInfo.create("", webappStartUrlOrScopeUrl, null, null, null, null, 0,
0, 0, 0, 0, false /* isIconGenerated */, false /* forceNavigation */);
} else {
delegate = new WebApkBrowserControlsDelegate(null, new Tab(0, false, null));
info = WebApkInfo.create("", "", false /* forceNavigation */, webappStartUrlOrScopeUrl,
null, null, null, null, 0, 0, 0, 0, 0, "", 0, null, "", null);
info = WebApkInfo.create("", "", webappStartUrlOrScopeUrl, null, null, null, null, 0, 0,
0, 0, 0, "", 0, null, "", null, false /* forceNavigation */);
}
return delegate.shouldShowBrowserControls(info, url, securityLevel);
}
......
......@@ -118,7 +118,7 @@ public class WebApkInfoTest {
Intent intent = new Intent();
intent.putExtra(WebApkConstants.EXTRA_WEBAPK_PACKAGE_NAME, WEBAPK_PACKAGE_NAME);
intent.putExtra(WebApkConstants.EXTRA_WEBAPK_FORCE_NAVIGATION, true);
intent.putExtra(ShortcutHelper.EXTRA_FORCE_NAVIGATION, true);
intent.putExtra(ShortcutHelper.EXTRA_URL, START_URL);
intent.putExtra(ShortcutHelper.EXTRA_SOURCE, ShortcutSource.NOTIFICATION);
......@@ -256,7 +256,7 @@ public class WebApkInfoTest {
/**
* Prior to SHELL_APK_VERSION 2, WebAPKs did not specify
* {@link WebApkConstants.EXTRA_WEBAPK_FORCE_NAVIGATION} in the intent. Test that
* {@link ShortcutHelper#EXTRA_FORCE_NAVIGATION} in the intent. Test that
* {@link WebApkInfo#shouldForceNavigation()} defaults to true when the intent extra is not
* specified.
*/
......
......@@ -263,12 +263,13 @@ public class WebApkUpdateManagerTest {
if (manifestData == null) return null;
final String kPackageName = "org.random.webapk";
return WebApkInfo.create(getWebApkId(kPackageName), "", false /* forceNavigation */,
manifestData.scopeUrl, new WebApkInfo.Icon(manifestData.primaryIcon),
return WebApkInfo.create(getWebApkId(kPackageName), "", manifestData.scopeUrl,
new WebApkInfo.Icon(manifestData.primaryIcon),
new WebApkInfo.Icon(manifestData.badgeIcon), manifestData.name,
manifestData.shortName, manifestData.displayMode, manifestData.orientation, -1,
manifestData.themeColor, manifestData.backgroundColor, kPackageName, -1,
WEB_MANIFEST_URL, manifestData.startUrl, manifestData.iconUrlToMurmur2HashMap);
WEB_MANIFEST_URL, manifestData.startUrl, manifestData.iconUrlToMurmur2HashMap,
false /* forceNavigation */);
}
/**
......
......@@ -33,7 +33,8 @@ public class WebappInfoTest {
WebappInfo info = WebappInfo.create(id, url, null, null, name, shortName,
WebDisplayMode.STANDALONE, ScreenOrientationValues.DEFAULT, ShortcutSource.UNKNOWN,
ShortcutHelper.MANIFEST_COLOR_INVALID_OR_MISSING,
ShortcutHelper.MANIFEST_COLOR_INVALID_OR_MISSING, false);
ShortcutHelper.MANIFEST_COLOR_INVALID_OR_MISSING, false /* isIconGenerated */,
false /* forceNavigation */);
Assert.assertNotNull(info);
}
......@@ -47,7 +48,8 @@ public class WebappInfoTest {
WebappInfo info = WebappInfo.create(id, url, null, null, name, shortName,
WebDisplayMode.STANDALONE, ScreenOrientationValues.DEFAULT, ShortcutSource.UNKNOWN,
ShortcutHelper.MANIFEST_COLOR_INVALID_OR_MISSING,
ShortcutHelper.MANIFEST_COLOR_INVALID_OR_MISSING, false);
ShortcutHelper.MANIFEST_COLOR_INVALID_OR_MISSING, false /* isIconGenerated */,
false /* forceNavigation */);
Assert.assertNotNull(info);
}
......@@ -130,7 +132,8 @@ public class WebappInfoTest {
WebappInfo info = WebappInfo.create(id, url, null, null, name, shortName,
WebDisplayMode.FULLSCREEN, ScreenOrientationValues.DEFAULT, ShortcutSource.UNKNOWN,
ShortcutHelper.MANIFEST_COLOR_INVALID_OR_MISSING,
ShortcutHelper.MANIFEST_COLOR_INVALID_OR_MISSING, false);
ShortcutHelper.MANIFEST_COLOR_INVALID_OR_MISSING, false /* isIconGenerated */,
false /* forceNavigation */);
Assert.assertEquals(WebDisplayMode.FULLSCREEN, info.displayMode());
Assert.assertEquals(ScreenOrientationValues.DEFAULT, info.orientation());
Assert.assertEquals(ShortcutSource.UNKNOWN, info.source());
......@@ -145,9 +148,10 @@ public class WebappInfoTest {
long themeColor = 0xFF00FF00L;
long backgroundColor = 0xFF0000FFL;
WebappInfo info = WebappInfo.create(id, url, null, null, name, shortName,
WebDisplayMode.STANDALONE, ScreenOrientationValues.DEFAULT, ShortcutSource.UNKNOWN,
themeColor, backgroundColor, false);
WebappInfo info =
WebappInfo.create(id, url, null, null, name, shortName, WebDisplayMode.STANDALONE,
ScreenOrientationValues.DEFAULT, ShortcutSource.UNKNOWN, themeColor,
backgroundColor, false /* isIconGenerated */, false /* forceNavigation */);
Assert.assertEquals(themeColor, info.themeColor());
Assert.assertEquals(backgroundColor, info.backgroundColor());
}
......@@ -162,7 +166,8 @@ public class WebappInfoTest {
WebappInfo info = WebappInfo.create(id, url, null, null, name, shortName,
WebDisplayMode.STANDALONE, ScreenOrientationValues.DEFAULT, ShortcutSource.UNKNOWN,
ShortcutHelper.MANIFEST_COLOR_INVALID_OR_MISSING,
ShortcutHelper.MANIFEST_COLOR_INVALID_OR_MISSING, false);
ShortcutHelper.MANIFEST_COLOR_INVALID_OR_MISSING, false /* isIconGenerated */,
false /* forceNavigation */);
Assert.assertEquals(ShortcutHelper.MANIFEST_COLOR_INVALID_OR_MISSING, info.themeColor());
Assert.assertEquals(
ShortcutHelper.MANIFEST_COLOR_INVALID_OR_MISSING, info.backgroundColor());
......@@ -271,6 +276,18 @@ public class WebappInfoTest {
}
}
/**
* Test that {@link WebappInfo#shouldForceNavigation()} defaults to false when the
* {@link ShortcutHelper#EXTRA_FORCE_NAVIGATION} intent extra is not specified.
*/
@Test
public void testForceNavigationNotSpecified() {
Intent intent = new Intent();
intent.putExtra(ShortcutHelper.EXTRA_ID, "webapp_id");
intent.putExtra(ShortcutHelper.EXTRA_URL, "about:blank");
Assert.assertFalse(WebappInfo.create(intent).shouldForceNavigation());
}
/**
* Creates intent with url and id. If the url or id are not set WebappInfo#create() returns
* null.
......
......@@ -32,7 +32,7 @@ public class WebApkNavigationClient {
intent.setPackage(webApkPackageName);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.putExtra(WebApkConstants.EXTRA_WEBAPK_FORCE_NAVIGATION, forceNavigation);
intent.putExtra(WebApkConstants.EXTRA_FORCE_NAVIGATION, forceNavigation);
return intent;
}
}
......@@ -19,9 +19,7 @@ public final class WebApkConstants {
public static final String EXTRA_SOURCE = "org.chromium.chrome.browser.webapp_source";
public static final String EXTRA_WEBAPK_PACKAGE_NAME =
"org.chromium.chrome.browser.webapk_package_name";
// Whether the WebAPK should navigate to the URL in {@link EXTRA_URL} if the WebAPK is already
// open.
public static final String EXTRA_WEBAPK_FORCE_NAVIGATION =
public static final String EXTRA_FORCE_NAVIGATION =
"org.chromium.chrome.browser.webapk_force_navigation";
public static final String DEFAULT_HOST_BROWSER = "com.android.chrome";
......
......@@ -156,8 +156,8 @@ public class MainActivity extends Activity {
if (source == WebApkConstants.SHORTCUT_SOURCE_UNKNOWN) {
source = WebApkConstants.SHORTCUT_SOURCE_EXTERNAL_INTENT;
}
forceNavigation = getIntent().getBooleanExtra(
WebApkConstants.EXTRA_WEBAPK_FORCE_NAVIGATION, true);
forceNavigation =
getIntent().getBooleanExtra(WebApkConstants.EXTRA_FORCE_NAVIGATION, true);
}
// The override URL is non null when the WebAPK is launched from a deep link. The WebAPK
......@@ -168,7 +168,7 @@ public class MainActivity extends Activity {
intent.putExtra(WebApkConstants.EXTRA_URL, mStartUrl)
.putExtra(WebApkConstants.EXTRA_SOURCE, source)
.putExtra(WebApkConstants.EXTRA_WEBAPK_PACKAGE_NAME, getPackageName())
.putExtra(WebApkConstants.EXTRA_WEBAPK_FORCE_NAVIGATION, forceNavigation);
.putExtra(WebApkConstants.EXTRA_FORCE_NAVIGATION, forceNavigation);
try {
startActivity(intent);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment