Commit dafe8eec authored by Side Yilmaz's avatar Side Yilmaz Committed by Chromium LUCI CQ

Pass the correct profile to LayerTitleCache.

This CL passes the correct profile in LayerTitleCache by accessing
profile with tab#isIncognito boolean.

Bug: 1048632
Change-Id: I9555f637a890ea5052ac044667d953d221d0f84a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2567226Reviewed-by: default avatarDavid Trainor <dtrainor@chromium.org>
Commit-Queue: Side YILMAZ <sideyilmaz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#834634}
parent 48fc2519
......@@ -155,13 +155,13 @@ public class LayerTitleCache implements TitleCache {
private void fetchFaviconForTab(final Tab tab) {
if (mFaviconHelper == null) mFaviconHelper = new FaviconHelper();
// Since tab#getProfile() is not available by this time, we will use whatever last used
// profile.
// TODO (https://crbug.com/1048632): Use the current profile (i.e., regular profile or
// incognito profile) instead of always using regular profile. It works correctly now, but
// it is not safe.
mFaviconHelper.getLocalFaviconImageForURL(Profile.getLastUsedRegularProfile(),
tab.getUrlString(), mFaviconSize, new FaviconImageCallback() {
// Since tab#getProfile() is not available by this time, we will use tab#isIncognito boolean
// to get the correct profile.
Profile profile = !tab.isIncognito()
? Profile.getLastUsedRegularProfile()
: Profile.getLastUsedRegularProfile().getPrimaryOTRProfile();
mFaviconHelper.getLocalFaviconImageForURL(
profile, tab.getUrlString(), mFaviconSize, new FaviconImageCallback() {
@Override
public void onFaviconAvailable(Bitmap favicon, String iconUrl) {
updateFaviconFromHistory(tab, favicon);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment