Commit a6a2140b authored by spdonghao's avatar spdonghao Committed by Chromium LUCI CQ

[Start] Refresh MV tiles in real time.

Bug: 1155757
Change-Id: Iadce101e501f1a9355b7dd479ba7aed38864a599
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2605870
Commit-Queue: Hao Dong <spdonghao@chromium.org>
Reviewed-by: default avatarXi Han <hanxi@chromium.org>
Reviewed-by: default avatarWei-Yin Chen (陳威尹) <wychen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#841199}
parent c62f6aba
......@@ -48,6 +48,7 @@ class MostVisitedListCoordinator implements TileGroup.Observer, TileGroup.TileSe
private final Supplier<Tab> mParentTabSupplier;
private TileGroup mTileGroup;
private TileRenderer mRenderer;
private SuggestionsUiDelegate mSuggestionsUiDelegate;
public MostVisitedListCoordinator(ChromeActivity activity, ViewGroup parent,
PropertyModel propertyModel, Supplier<Tab> parentTabSupplier) {
......@@ -59,27 +60,22 @@ class MostVisitedListCoordinator implements TileGroup.Observer, TileGroup.TileSe
}
public void initialize() {
if (mRenderer != null) return;
assert mTileGroup == null;
// This function is never called in incognito mode.
Profile profile = Profile.getLastUsedRegularProfile();
ImageFetcher imageFetcher = new ImageFetcher(profile);
SnackbarManager snackbarManager = mActivity.getSnackbarManager();
if (mRenderer == null) {
// This function is never called in incognito mode.
ImageFetcher imageFetcher = new ImageFetcher(profile);
mRenderer = new TileRenderer(
mActivity, SuggestionsConfig.TileStyle.MODERN, TITLE_LINES, imageFetcher);
mRenderer = new TileRenderer(
mActivity, SuggestionsConfig.TileStyle.MODERN, TITLE_LINES, imageFetcher);
mSuggestionsUiDelegate = new MostVisitedSuggestionsUiDelegate(profile, snackbarManager);
}
OfflinePageBridge offlinePageBridge =
SuggestionsDependencyFactory.getInstance().getOfflinePageBridge(profile);
TileGroupDelegateImpl tileGroupDelegate =
new TileGroupDelegateImpl(mActivity, profile, null, snackbarManager);
SuggestionsUiDelegate suggestionsUiDelegate =
new MostVisitedSuggestionsUiDelegate(profile, snackbarManager);
mTileGroup = new TileGroup(
mRenderer, suggestionsUiDelegate, null, tileGroupDelegate, this, offlinePageBridge);
mTileGroup = new TileGroup(mRenderer, mSuggestionsUiDelegate, null, tileGroupDelegate, this,
offlinePageBridge);
mTileGroup.startObserving(MAX_RESULTS);
}
......
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