Index: chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappActivity.java |
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappActivity.java b/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappActivity.java |
index 3a3992b99a467f60e31c7084c105cc56e2a47ba6..7ebc2da4365a870f782680d2f558c135d54f6fd6 100644 |
--- a/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappActivity.java |
+++ b/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappActivity.java |
@@ -63,6 +63,8 @@ public class WebappActivity extends FullScreenActivity { |
private WebappUma mWebappUma; |
+ private Bitmap mLargestFavicon; |
+ |
/** |
* Construct all the variables that shouldn't change. We do it here both to clarify when the |
* objects are created and to ensure that they exist throughout the parallelized initialization |
@@ -287,6 +289,7 @@ public class WebappActivity extends FullScreenActivity { |
protected TabObserver createTabObserver() { |
return new EmptyTabObserver() { |
+ |
@Override |
public void onSSLStateUpdated(Tab tab) { |
updateUrlBar(); |
@@ -313,9 +316,15 @@ public class WebappActivity extends FullScreenActivity { |
} |
@Override |
- public void onFaviconUpdated(Tab tab) { |
+ public void onFaviconUpdated(Tab tab, Bitmap icon) { |
if (!isWebappDomain()) return; |
- updateTaskDescription(); |
+ // No need to cache the favicon if there is an icon declared in app manifest. |
+ if (mWebappInfo.icon() != null) return; |
+ if (mLargestFavicon == null || icon.getWidth() > mLargestFavicon.getWidth() |
+ || icon.getHeight() > mLargestFavicon.getHeight()) { |
+ mLargestFavicon = icon; |
+ updateTaskDescription(); |
+ } |
} |
@Override |
@@ -391,7 +400,7 @@ public class WebappActivity extends FullScreenActivity { |
if (mWebappInfo.icon() != null) { |
icon = mWebappInfo.icon(); |
} else if (getActivityTab() != null) { |
- icon = getActivityTab().getFavicon(); |
+ icon = mLargestFavicon; |
} |
if (mBrandColor == null && mWebappInfo.hasValidThemeColor()) { |