Chromium Code Reviews| Index: chrome/android/java/src/org/chromium/chrome/browser/Tab.java |
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/Tab.java b/chrome/android/java/src/org/chromium/chrome/browser/Tab.java |
| index 4db0aa3208985edfc3e3d9c09925f9e074588cca..bb861e1fd0c9c4b086467705e2f1e75fc6d78560 100644 |
| --- a/chrome/android/java/src/org/chromium/chrome/browser/Tab.java |
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/Tab.java |
| @@ -139,6 +139,10 @@ public class Tab implements NavigationClient { |
| private boolean mIsClosing = false; |
| + private Bitmap mFavicon = null; |
| + |
| + private String mFaviconUrl = null; |
| + |
| /** |
| * A default {@link ChromeContextMenuItemDelegate} that supports some of the context menu |
| * functionality. |
| @@ -885,10 +889,9 @@ public class Tab implements NavigationClient { |
| /** |
| * @return The bitmap of the favicon scaled to 16x16dp. null if no favicon |
| * is specified or it requires the default favicon. |
| - * TODO(bauerb): Upstream implementation. |
| */ |
| public Bitmap getFavicon() { |
| - return null; |
| + return mFavicon; |
| } |
| /** |
| @@ -1014,7 +1017,15 @@ public class Tab implements NavigationClient { |
| */ |
| @CalledByNative |
| protected void onFaviconUpdated() { |
| - for (TabObserver observer : mObservers) observer.onFaviconUpdated(this); |
| + if (mContentViewCore != null) { |
| + if ((mFaviconUrl == null) || (!mFaviconUrl.equals(mContentViewCore.getUrl()))) { |
|
David Trainor- moved to gerrit
2014/07/21 18:18:17
Could this change on a page refresh (even if the U
Jitu( very slow this week)
2014/07/24 14:08:21
Changes done as per suggestion
|
| + if (mNativeTabAndroid == 0) |
| + return; |
| + mFavicon = nativeGetFavicon(mNativeTabAndroid); |
| + mFaviconUrl = mContentViewCore.getUrl(); |
| + for (TabObserver observer : mObservers) observer.onFaviconUpdated(this); |
| + } |
| + } |
| } |
| /** |
| @@ -1156,4 +1167,5 @@ public class Tab implements NavigationClient { |
| private native void nativeSetActiveNavigationEntryTitleForUrl(long nativeTabAndroid, String url, |
| String title); |
| private native boolean nativePrint(long nativeTabAndroid); |
| + private native Bitmap nativeGetFavicon(long nativeTabAndroid); |
| } |