Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 package org.chromium.chrome.browser; | 5 package org.chromium.chrome.browser; |
| 6 | 6 |
| 7 import android.app.Activity; | 7 import android.app.Activity; |
| 8 import android.content.Context; | 8 import android.content.Context; |
| 9 import android.graphics.Bitmap; | 9 import android.graphics.Bitmap; |
| 10 import android.graphics.Color; | 10 import android.graphics.Color; |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 132 */ | 132 */ |
| 133 private int mParentId = INVALID_TAB_ID; | 133 private int mParentId = INVALID_TAB_ID; |
| 134 | 134 |
| 135 /** | 135 /** |
| 136 * Whether the tab should be grouped with its parent tab. | 136 * Whether the tab should be grouped with its parent tab. |
| 137 */ | 137 */ |
| 138 private boolean mGroupedWithParent = true; | 138 private boolean mGroupedWithParent = true; |
| 139 | 139 |
| 140 private boolean mIsClosing = false; | 140 private boolean mIsClosing = false; |
| 141 | 141 |
| 142 private Bitmap mFavicon = null; | |
| 143 | |
| 144 private String mFaviconUrl = null; | |
| 145 | |
| 142 /** | 146 /** |
| 143 * A default {@link ChromeContextMenuItemDelegate} that supports some of the context menu | 147 * A default {@link ChromeContextMenuItemDelegate} that supports some of the context menu |
| 144 * functionality. | 148 * functionality. |
| 145 */ | 149 */ |
| 146 protected class TabChromeContextMenuItemDelegate | 150 protected class TabChromeContextMenuItemDelegate |
| 147 extends EmptyChromeContextMenuItemDelegate { | 151 extends EmptyChromeContextMenuItemDelegate { |
| 148 private final Clipboard mClipboard; | 152 private final Clipboard mClipboard; |
| 149 | 153 |
| 150 /** | 154 /** |
| 151 * Builds a {@link TabChromeContextMenuItemDelegate} instance. | 155 * Builds a {@link TabChromeContextMenuItemDelegate} instance. |
| (...skipping 726 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 878 @CalledByNative | 882 @CalledByNative |
| 879 public String getTitle() { | 883 public String getTitle() { |
| 880 if (mNativePage != null) return mNativePage.getTitle(); | 884 if (mNativePage != null) return mNativePage.getTitle(); |
| 881 if (mContentViewCore != null) return mContentViewCore.getTitle(); | 885 if (mContentViewCore != null) return mContentViewCore.getTitle(); |
| 882 return ""; | 886 return ""; |
| 883 } | 887 } |
| 884 | 888 |
| 885 /** | 889 /** |
| 886 * @return The bitmap of the favicon scaled to 16x16dp. null if no favicon | 890 * @return The bitmap of the favicon scaled to 16x16dp. null if no favicon |
| 887 * is specified or it requires the default favicon. | 891 * is specified or it requires the default favicon. |
| 888 * TODO(bauerb): Upstream implementation. | |
| 889 */ | 892 */ |
| 890 public Bitmap getFavicon() { | 893 public Bitmap getFavicon() { |
| 891 return null; | 894 return mFavicon; |
| 892 } | 895 } |
| 893 | 896 |
| 894 /** | 897 /** |
| 895 * Loads the tab if it's not loaded (e.g. because it was killed in backgroun d). | 898 * Loads the tab if it's not loaded (e.g. because it was killed in backgroun d). |
| 896 * @return true iff tab load was triggered | 899 * @return true iff tab load was triggered |
| 897 */ | 900 */ |
| 898 @CalledByNative | 901 @CalledByNative |
| 899 public boolean loadIfNeeded() { | 902 public boolean loadIfNeeded() { |
| 900 return false; | 903 return false; |
| 901 } | 904 } |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1007 */ | 1010 */ |
| 1008 protected TabChromeWebContentsDelegateAndroid getChromeWebContentsDelegateAn droid() { | 1011 protected TabChromeWebContentsDelegateAndroid getChromeWebContentsDelegateAn droid() { |
| 1009 return mWebContentsDelegate; | 1012 return mWebContentsDelegate; |
| 1010 } | 1013 } |
| 1011 | 1014 |
| 1012 /** | 1015 /** |
| 1013 * Called when the favicon of the content this tab represents changes. | 1016 * Called when the favicon of the content this tab represents changes. |
| 1014 */ | 1017 */ |
| 1015 @CalledByNative | 1018 @CalledByNative |
| 1016 protected void onFaviconUpdated() { | 1019 protected void onFaviconUpdated() { |
| 1017 for (TabObserver observer : mObservers) observer.onFaviconUpdated(this); | 1020 if (mContentViewCore != null) { |
| 1021 if ((mFaviconUrl == null) || (!mFaviconUrl.equals(mContentViewCore.g etUrl()))) { | |
|
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
| |
| 1022 if (mNativeTabAndroid == 0) | |
| 1023 return; | |
| 1024 mFavicon = nativeGetFavicon(mNativeTabAndroid); | |
| 1025 mFaviconUrl = mContentViewCore.getUrl(); | |
| 1026 for (TabObserver observer : mObservers) observer.onFaviconUpdate d(this); | |
| 1027 } | |
| 1028 } | |
| 1018 } | 1029 } |
| 1019 | 1030 |
| 1020 /** | 1031 /** |
| 1021 * Called when the navigation entry containing the historyitem changed, | 1032 * Called when the navigation entry containing the historyitem changed, |
| 1022 * for example because of a scroll offset or form field change. | 1033 * for example because of a scroll offset or form field change. |
| 1023 */ | 1034 */ |
| 1024 @CalledByNative | 1035 @CalledByNative |
| 1025 protected void onNavEntryChanged() { | 1036 protected void onNavEntryChanged() { |
| 1026 } | 1037 } |
| 1027 | 1038 |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1149 private native void nativeDestroyWebContents(long nativeTabAndroid, boolean deleteNative); | 1160 private native void nativeDestroyWebContents(long nativeTabAndroid, boolean deleteNative); |
| 1150 private native WebContents nativeGetWebContents(long nativeTabAndroid); | 1161 private native WebContents nativeGetWebContents(long nativeTabAndroid); |
| 1151 private native Profile nativeGetProfileAndroid(long nativeTabAndroid); | 1162 private native Profile nativeGetProfileAndroid(long nativeTabAndroid); |
| 1152 private native int nativeLoadUrl(long nativeTabAndroid, String url, String e xtraHeaders, | 1163 private native int nativeLoadUrl(long nativeTabAndroid, String url, String e xtraHeaders, |
| 1153 byte[] postData, int transition, String referrerUrl, int referrerPol icy, | 1164 byte[] postData, int transition, String referrerUrl, int referrerPol icy, |
| 1154 boolean isRendererInitiated); | 1165 boolean isRendererInitiated); |
| 1155 private native int nativeGetSecurityLevel(long nativeTabAndroid); | 1166 private native int nativeGetSecurityLevel(long nativeTabAndroid); |
| 1156 private native void nativeSetActiveNavigationEntryTitleForUrl(long nativeTab Android, String url, | 1167 private native void nativeSetActiveNavigationEntryTitleForUrl(long nativeTab Android, String url, |
| 1157 String title); | 1168 String title); |
| 1158 private native boolean nativePrint(long nativeTabAndroid); | 1169 private native boolean nativePrint(long nativeTabAndroid); |
| 1170 private native Bitmap nativeGetFavicon(long nativeTabAndroid); | |
| 1159 } | 1171 } |
| OLD | NEW |