commit 4744f30185f1e76fd8243bdc07e2c5dac6dd2302 Author: Rob Wu rob@robwu.nl Date: Thu Jun 21 15:36:40 2018 +0200
Bug 1448305 - Avoid disk cache for icons of TwoLinePageRow in private tabs. r=JanH
E.g. autocompletion results and the "Recently closed" list. --- .../base/java/org/mozilla/gecko/home/TwoLinePageRow.java | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/mobile/android/base/java/org/mozilla/gecko/home/TwoLinePageRow.java b/mobile/android/base/java/org/mozilla/gecko/home/TwoLinePageRow.java index 334842e2bb2f..5be453f5a536 100644 --- a/mobile/android/base/java/org/mozilla/gecko/home/TwoLinePageRow.java +++ b/mobile/android/base/java/org/mozilla/gecko/home/TwoLinePageRow.java @@ -204,14 +204,11 @@ public class TwoLinePageRow extends ThemedLinearLayout * selected tab. */ protected void updateDisplayedUrl() { - final Tab selectedTab = Tabs.getInstance().getSelectedTab(); - final boolean isPrivate = (selectedTab != null) && (selectedTab.isPrivate()); - // We always want to display the underlying page url, however for readermode pages // we navigate to the about:reader equivalent, hence we need to use that url when finding // existing tabs final String navigationUrl = mHasReaderCacheItem ? ReaderModeUtils.getAboutReaderForUrl(mPageUrl) : mPageUrl; - Tab tab = Tabs.getInstance().getFirstTabForUrl(navigationUrl, isPrivate); + Tab tab = Tabs.getInstance().getFirstTabForUrl(navigationUrl, isCurrentTabInPrivateMode());
if (!mShowIcons || tab == null) { @@ -280,6 +277,7 @@ public class TwoLinePageRow extends ThemedLinearLayout } else if (bookmarkId < BrowserContract.Bookmarks.FAKE_PARTNER_BOOKMARKS_START) { mOngoingIconLoad = Icons.with(getContext()) .pageUrl(pageURL) + .setPrivateMode(isCurrentTabInPrivateMode()) .skipNetwork() .privileged(true) .icon(IconDescriptor.createGenericIcon( @@ -289,6 +287,7 @@ public class TwoLinePageRow extends ThemedLinearLayout } else { mOngoingIconLoad = Icons.with(getContext()) .pageUrl(pageURL) + .setPrivateMode(isCurrentTabInPrivateMode()) .skipNetwork() .build() .execute(mFavicon.createIconCallback()); @@ -307,6 +306,15 @@ public class TwoLinePageRow extends ThemedLinearLayout }
/** + * @return true if this view is shown inside a private tab, independent of whether + * a private mode theme is applied via <code>setPrivateMode(true)</code>. + */ + private boolean isCurrentTabInPrivateMode() { + final Tab tab = Tabs.getInstance().getSelectedTab(); + return tab != null && tab.isPrivate(); + } + + /** * Update the data displayed by this row. * <p> * This method must be invoked on the UI thread.
tbb-commits@lists.torproject.org