Commit 38dbc5e3 authored by Peter Kotwicz's avatar Peter Kotwicz Committed by Commit Bot

[Android WebAPK] Refactor: Fetch the share target component from the intent

This CL removes the |callingActivityComponentName| parameter from
HostBrowserLaunchParams#createForIntent() because the parameter is
redundant. The component can be retrieved from the intent.

BUG=817263

Change-Id: I0040625ae1c5a780c795c425d8e74e2c3155597a
Reviewed-on: https://chromium-review.googlesource.com/c/1298421Reviewed-by: default avatarXi Han <hanxi@chromium.org>
Commit-Queue: Peter Kotwicz <pkotwicz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#603149}
parent f144f4a9
......@@ -12,4 +12,4 @@
# //chrome/android/webapk/shell_apk:webapk is changed. This includes
# Java files, Android resource files and AndroidManifest.xml. Does not affect
# Chrome.apk
current_shell_apk_version = 68
current_shell_apk_version = 69
......@@ -32,9 +32,8 @@ public abstract class HostBrowserLauncherActivity extends Activity {
}
HostBrowserLauncherParams params =
HostBrowserLauncherParams.createForIntent(
HostBrowserLauncherActivity.this, getComponentName(),
getIntent(), hostBrowserPackageName, dialogShown,
mActivityStartTimeMs);
HostBrowserLauncherActivity.this, getIntent(),
hostBrowserPackageName, dialogShown, mActivityStartTimeMs);
onHostBrowserSelected(params);
}
});
......
......@@ -36,8 +36,7 @@ public class HostBrowserLauncherParams {
* Constructs a HostBrowserLauncherParams object from the passed in Intent and from <meta-data>
* in the Android Manifest.
*/
public static HostBrowserLauncherParams createForIntent(Context context,
ComponentName callingActivityComponentName, Intent intent,
public static HostBrowserLauncherParams createForIntent(Context context, Intent intent,
String hostBrowserPackageName, boolean dialogShown, long launchTimeMs) {
Bundle metadata = WebApkUtils.readMetaData(context);
if (metadata == null) return null;
......@@ -50,8 +49,7 @@ public class HostBrowserLauncherParams {
if (Intent.ACTION_SEND.equals(intent.getAction())
|| Intent.ACTION_SEND_MULTIPLE.equals(intent.getAction())) {
Bundle shareTargetMetaData =
fetchActivityMetaData(context, callingActivityComponentName);
Bundle shareTargetMetaData = fetchActivityMetaData(context, intent.getComponent());
startUrl = computeStartUrlForShareTarget(shareTargetMetaData, intent);
source = WebApkConstants.SHORTCUT_SOURCE_SHARE;
forceNavigation = true;
......@@ -75,7 +73,7 @@ public class HostBrowserLauncherParams {
return new HostBrowserLauncherParams(hostBrowserPackageName,
hostBrowserMajorChromiumVersion, dialogShown, intent, startUrl, source,
forceNavigation, launchTimeMs, callingActivityComponentName.getClassName());
forceNavigation, launchTimeMs, intent.getComponent().getClassName());
}
private static Bundle fetchActivityMetaData(
......
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