Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(236)

Unified Diff: chrome/android/webapk/shell_apk/src/org/chromium/webapk/shell_apk/MainActivity.java

Issue 1989283002: Upstream: Launch WebApkActivity from WebAPK. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Nits. Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/android/webapk/shell_apk/src/org/chromium/webapk/shell_apk/MainActivity.java
diff --git a/chrome/android/webapk/shell_apk/src/org/chromium/webapk/shell_apk/MainActivity.java b/chrome/android/webapk/shell_apk/src/org/chromium/webapk/shell_apk/MainActivity.java
index b16b83217493d4ee03aa8b9a7daca1a1d02b8b09..d5084ad4c686e6261360d7d65fe693138ee58d24 100644
--- a/chrome/android/webapk/shell_apk/src/org/chromium/webapk/shell_apk/MainActivity.java
+++ b/chrome/android/webapk/shell_apk/src/org/chromium/webapk/shell_apk/MainActivity.java
@@ -24,15 +24,18 @@ import java.io.ByteArrayOutputStream;
* WebAPK's main Activity.
*/
public class MainActivity extends Activity {
+ // These EXTRA_* values must stay in sync with
+ // {@link org.chromium.chrome.browser.ShortcutHelper}.
private static final String EXTRA_ID = "org.chromium.chrome.browser.webapp_id";
private static final String EXTRA_ICON = "org.chromium.chrome.browser.webapp_icon";
private static final String EXTRA_NAME = "org.chromium.chrome.browser.webapp_name";
private static final String EXTRA_URL = "org.chromium.chrome.browser.webapp_url";
private static final String EXTRA_MAC = "org.chromium.chrome.browser.webapp_mac";
- private static final String EXTRA_SCOPE = "org.chromium.chrome.browser.webapp_scope";
+ private static final String EXTRA_WEBAPK_PACKAGE_NAME =
+ "org.chromium.chrome.browser.webapk_package_name";
+
private static final String META_DATA_HOST_URL = "hostUrl";
private static final String META_DATA_MAC = "mac";
- private static final String META_DATA_SCOPE = "scope";
private static final String META_DATA_RUNTIME_HOST = "runtimeHost";
private static final String TAG = "cr_MainActivity";
@@ -46,7 +49,6 @@ public class MainActivity extends Activity {
String mac = null;
String name = null;
String url = null;
- String scope = null;
String encodedIcon = null;
String runtimeHost = null;
try {
@@ -61,7 +63,6 @@ public class MainActivity extends Activity {
url = overrideUrl;
}
- scope = bundle.getString(META_DATA_SCOPE);
webappId = WebApkConstants.WEBAPK_ID_PREFIX + packageName;
mac = bundle.getString(META_DATA_MAC);
runtimeHost = bundle.getString(META_DATA_RUNTIME_HOST);
@@ -71,23 +72,24 @@ public class MainActivity extends Activity {
Bitmap icon = BitmapFactory.decodeResource(getResources(), R.drawable.app_icon);
encodedIcon = encodeBitmapAsString(icon);
Log.w(TAG, "Url of the WebAPK: " + url);
- Log.w(TAG, "webappId of the WebAPK: " + webappId);
- Log.w(TAG, "name of the WebAPK:" + name);
+ Log.w(TAG, "WebappId of the WebAPK: " + webappId);
+ Log.w(TAG, "Name of the WebAPK:" + name);
+ Log.w(TAG, "Package name of the WebAPK:" + packageName);
+
+ Intent newIntent = new Intent();
+ newIntent.setComponent(new ComponentName(runtimeHost,
+ "org.chromium.chrome.browser.webapps.WebappLauncherActivity"));
+ newIntent.putExtra(EXTRA_ID, webappId)
+ .putExtra(EXTRA_NAME, name)
+ .putExtra(EXTRA_URL, url)
+ .putExtra(EXTRA_MAC, mac)
+ .putExtra(EXTRA_ICON, encodedIcon)
+ .putExtra(EXTRA_WEBAPK_PACKAGE_NAME, packageName);
+ startActivity(newIntent);
+ finish();
} catch (NameNotFoundException e) {
e.printStackTrace();
}
-
- Intent newIntent = new Intent();
- newIntent.setComponent(new ComponentName(runtimeHost,
- "org.chromium.chrome.browser.webapps.WebappLauncherActivity"));
- newIntent.putExtra(EXTRA_ID, webappId);
- newIntent.putExtra(EXTRA_NAME, name);
- newIntent.putExtra(EXTRA_SCOPE, scope);
- newIntent.putExtra(EXTRA_URL, url);
- newIntent.putExtra(EXTRA_MAC, mac);
- newIntent.putExtra(EXTRA_ICON, encodedIcon);
- startActivity(newIntent);
- finish();
}
/**

Powered by Google App Engine
This is Rietveld 408576698