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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappActivity.java

Issue 1464743005: Remove DocumentTabObserver and merge task description updates (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added comment for Webapps and removed needsUpdate in observer call Created 5 years, 1 month 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/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()) {

Powered by Google App Engine
This is Rietveld 408576698