Chromium Code Reviews| Index: chrome/android/java/src/org/chromium/chrome/browser/webapps/WebApkInfo.java |
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebApkInfo.java b/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebApkInfo.java |
| index 2dc9ce53c44e171f17d710d34288ad8e77f6dd20..9b21ef43414422b04509c9ee0570bb81ee1a48b8 100644 |
| --- a/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebApkInfo.java |
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebApkInfo.java |
| @@ -29,6 +29,9 @@ import java.util.Map; |
| * Stores info for WebAPK. |
| */ |
| public class WebApkInfo extends WebappInfo { |
| + public static final String STRING_NAME = ":string/name"; |
| + public static final String STRING_SHORT_NAME = ":string/short_name"; |
| + |
| private static final String TAG = "WebApkInfo"; |
| private boolean mForceNavigation; |
| @@ -89,8 +92,26 @@ public class WebApkInfo extends WebappInfo { |
| return null; |
| } |
| - String name = IntentUtils.safeGetString(bundle, WebApkMetaDataKeys.NAME); |
| - String shortName = IntentUtils.safeGetString(bundle, WebApkMetaDataKeys.SHORT_NAME); |
| + Resources res = null; |
| + int nameId = 0; |
| + int shortNameId = 0; |
| + try { |
| + res = ContextUtils.getApplicationContext() |
| + .getPackageManager() |
| + .getResourcesForApplication(webApkPackageName); |
| + } catch (PackageManager.NameNotFoundException e) { |
| + } |
|
pkotwicz
2017/06/20 19:39:48
If res == null, we should just return null for Web
Xi Han
2017/06/21 14:46:36
Done.
|
| + |
| + if (res != null) { |
| + nameId = res.getIdentifier(webApkPackageName + STRING_NAME, null, null); |
| + shortNameId = res.getIdentifier(webApkPackageName + STRING_SHORT_NAME, null, null); |
|
pkotwicz
2017/06/20 19:39:48
Can you pass the package name as the last paramete
Xi Han
2017/06/21 14:46:36
Done.
|
| + } |
| + String name = nameId != 0 ? res.getString(nameId) |
| + : IntentUtils.safeGetString(bundle, WebApkMetaDataKeys.NAME); |
| + String shortName = shortNameId != 0 |
| + ? res.getString(shortNameId) |
| + : IntentUtils.safeGetString(bundle, WebApkMetaDataKeys.SHORT_NAME); |
| + |
| String scope = IntentUtils.safeGetString(bundle, WebApkMetaDataKeys.SCOPE); |
| int displayMode = displayModeFromString( |