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 @@ ...@@ -12,4 +12,4 @@
# //chrome/android/webapk/shell_apk:webapk is changed. This includes # //chrome/android/webapk/shell_apk:webapk is changed. This includes
# Java files, Android resource files and AndroidManifest.xml. Does not affect # Java files, Android resource files and AndroidManifest.xml. Does not affect
# Chrome.apk # Chrome.apk
current_shell_apk_version = 68 current_shell_apk_version = 69
...@@ -32,9 +32,8 @@ public abstract class HostBrowserLauncherActivity extends Activity { ...@@ -32,9 +32,8 @@ public abstract class HostBrowserLauncherActivity extends Activity {
} }
HostBrowserLauncherParams params = HostBrowserLauncherParams params =
HostBrowserLauncherParams.createForIntent( HostBrowserLauncherParams.createForIntent(
HostBrowserLauncherActivity.this, getComponentName(), HostBrowserLauncherActivity.this, getIntent(),
getIntent(), hostBrowserPackageName, dialogShown, hostBrowserPackageName, dialogShown, mActivityStartTimeMs);
mActivityStartTimeMs);
onHostBrowserSelected(params); onHostBrowserSelected(params);
} }
}); });
......
...@@ -36,8 +36,7 @@ public class HostBrowserLauncherParams { ...@@ -36,8 +36,7 @@ public class HostBrowserLauncherParams {
* Constructs a HostBrowserLauncherParams object from the passed in Intent and from <meta-data> * Constructs a HostBrowserLauncherParams object from the passed in Intent and from <meta-data>
* in the Android Manifest. * in the Android Manifest.
*/ */
public static HostBrowserLauncherParams createForIntent(Context context, public static HostBrowserLauncherParams createForIntent(Context context, Intent intent,
ComponentName callingActivityComponentName, Intent intent,
String hostBrowserPackageName, boolean dialogShown, long launchTimeMs) { String hostBrowserPackageName, boolean dialogShown, long launchTimeMs) {
Bundle metadata = WebApkUtils.readMetaData(context); Bundle metadata = WebApkUtils.readMetaData(context);
if (metadata == null) return null; if (metadata == null) return null;
...@@ -50,8 +49,7 @@ public class HostBrowserLauncherParams { ...@@ -50,8 +49,7 @@ public class HostBrowserLauncherParams {
if (Intent.ACTION_SEND.equals(intent.getAction()) if (Intent.ACTION_SEND.equals(intent.getAction())
|| Intent.ACTION_SEND_MULTIPLE.equals(intent.getAction())) { || Intent.ACTION_SEND_MULTIPLE.equals(intent.getAction())) {
Bundle shareTargetMetaData = Bundle shareTargetMetaData = fetchActivityMetaData(context, intent.getComponent());
fetchActivityMetaData(context, callingActivityComponentName);
startUrl = computeStartUrlForShareTarget(shareTargetMetaData, intent); startUrl = computeStartUrlForShareTarget(shareTargetMetaData, intent);
source = WebApkConstants.SHORTCUT_SOURCE_SHARE; source = WebApkConstants.SHORTCUT_SOURCE_SHARE;
forceNavigation = true; forceNavigation = true;
...@@ -75,7 +73,7 @@ public class HostBrowserLauncherParams { ...@@ -75,7 +73,7 @@ public class HostBrowserLauncherParams {
return new HostBrowserLauncherParams(hostBrowserPackageName, return new HostBrowserLauncherParams(hostBrowserPackageName,
hostBrowserMajorChromiumVersion, dialogShown, intent, startUrl, source, hostBrowserMajorChromiumVersion, dialogShown, intent, startUrl, source,
forceNavigation, launchTimeMs, callingActivityComponentName.getClassName()); forceNavigation, launchTimeMs, intent.getComponent().getClassName());
} }
private static Bundle fetchActivityMetaData( 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