Chromium Code Reviews| Index: chrome/android/java/src/org/chromium/chrome/browser/webapps/ManifestUpgradeDetector.java |
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/webapps/ManifestUpgradeDetector.java b/chrome/android/java/src/org/chromium/chrome/browser/webapps/ManifestUpgradeDetector.java |
| index 1874d797bbd8038aae8ef85434f2ababc50207ad..f165463d66d48089eb6a1660021feb0e7e001a31 100644 |
| --- a/chrome/android/java/src/org/chromium/chrome/browser/webapps/ManifestUpgradeDetector.java |
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/webapps/ManifestUpgradeDetector.java |
| @@ -12,6 +12,10 @@ import org.chromium.chrome.browser.ShortcutHelper; |
| import org.chromium.chrome.browser.tab.Tab; |
| import org.chromium.chrome.browser.util.UrlUtilities; |
| +import java.util.Arrays; |
| +import java.util.HashSet; |
| +import java.util.Set; |
| + |
| /** |
| * This class checks whether the WebAPK needs to be re-installed and sends a request to re-install |
| * the WebAPK if it needs to be re-installed. |
| @@ -51,13 +55,14 @@ public class ManifestUpgradeDetector implements ManifestUpgradeDetectorFetcher.C |
| public String scopeUrl; |
| public String name; |
| public String shortName; |
| - public String iconUrl; |
| + public String bestIconUrl; |
| // Hash of untransformed icon bytes. The hash should have been taken prior to any |
| // encoding/decoding. |
| public String iconMurmur2Hash; |
| public Bitmap icon; |
| + public Set<String> iconUrls; |
| public int displayMode; |
| public int orientation; |
| public long themeColor; |
| @@ -131,8 +136,8 @@ public class ManifestUpgradeDetector implements ManifestUpgradeDetectorFetcher.C |
| */ |
| @Override |
| public void onGotManifestData(String startUrl, String scopeUrl, String name, String shortName, |
| - String iconUrl, String iconMurmur2Hash, Bitmap iconBitmap, int displayMode, |
| - int orientation, long themeColor, long backgroundColor) { |
| + String iconUrl, String iconMurmur2Hash, Bitmap iconBitmap, String[] iconUrls, |
| + int displayMode, int orientation, long themeColor, long backgroundColor) { |
| mFetcher.destroy(); |
| mFetcher = null; |
| @@ -145,9 +150,13 @@ public class ManifestUpgradeDetector implements ManifestUpgradeDetectorFetcher.C |
| fetchedData.scopeUrl = scopeUrl; |
| fetchedData.name = name; |
| fetchedData.shortName = shortName; |
| - fetchedData.iconUrl = iconUrl; |
| + fetchedData.bestIconUrl = iconUrl; |
| fetchedData.iconMurmur2Hash = iconMurmur2Hash; |
| fetchedData.icon = iconBitmap; |
| + fetchedData.iconUrls = new HashSet<String>(); |
|
pkotwicz
2016/11/01 00:29:49
Nit: Use org.chromium.base.CollectionUtil.newHashS
Xi Han
2016/11/07 16:51:42
Done.
|
| + if (iconUrls != null) { |
| + fetchedData.iconUrls.addAll(Arrays.asList(iconUrls)); |
| + } |
| fetchedData.displayMode = displayMode; |
| fetchedData.orientation = orientation; |
| fetchedData.themeColor = themeColor; |
| @@ -163,7 +172,7 @@ public class ManifestUpgradeDetector implements ManifestUpgradeDetectorFetcher.C |
| * Checks whether the WebAPK needs to be upgraded provided the fetched manifest data. |
| */ |
| private boolean needsUpgrade(FetchedManifestData fetchedData) { |
| - if (!urlsMatchIgnoringFragments(mMetaData.iconUrl, fetchedData.iconUrl) |
| + if (!urlsMatchIgnoringFragments(mMetaData.bestIconUrl, fetchedData.bestIconUrl) |
|
pkotwicz
2016/11/01 00:29:49
For a different CL
This check is not correct in a
Xi Han
2016/11/07 16:51:42
Good catch. As discussed offline, the best icon UR
|
| || !mMetaData.iconMurmur2Hash.equals(fetchedData.iconMurmur2Hash)) { |
| return true; |
| } |
| @@ -183,7 +192,8 @@ public class ManifestUpgradeDetector implements ManifestUpgradeDetectorFetcher.C |
| || mMetaData.backgroundColor != fetchedData.backgroundColor |
| || mMetaData.themeColor != fetchedData.themeColor |
| || mMetaData.orientation != fetchedData.orientation |
| - || mMetaData.displayMode != fetchedData.displayMode) { |
| + || mMetaData.displayMode != fetchedData.displayMode |
| + || !mMetaData.iconUrls.equals(fetchedData.iconUrls)) { |
| return true; |
| } |