Index: chrome/android/java/src/org/chromium/chrome/browser/suggestions/SuggestionsBottomSheetContent.java |
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/suggestions/SuggestionsBottomSheetContent.java b/chrome/android/java/src/org/chromium/chrome/browser/suggestions/SuggestionsBottomSheetContent.java |
index 9d6131fe0de4499c6dcaf46354583cc7c9930f39..e18a4acf536c73ae0f83659aaee57e35be28d347 100644 |
--- a/chrome/android/java/src/org/chromium/chrome/browser/suggestions/SuggestionsBottomSheetContent.java |
+++ b/chrome/android/java/src/org/chromium/chrome/browser/suggestions/SuggestionsBottomSheetContent.java |
@@ -40,13 +40,13 @@ |
*/ |
public class SuggestionsBottomSheetContent implements BottomSheet.BottomSheetContent { |
private static SuggestionsSource sSuggestionsSourceForTesting; |
- private static SuggestionsMetricsReporter sMetricsReporterForTesting; |
+ private static SuggestionsEventReporter sEventReporterForTesting; |
private final View mView; |
private final FadingShadowView mShadowView; |
private final SuggestionsRecyclerView mRecyclerView; |
private final ContextMenuManager mContextMenuManager; |
- private final SuggestionsUiDelegateImpl mSuggestionsManager; |
+ private final SuggestionsUiDelegateImpl mSuggestionsUiDelegate; |
private final TileGroup.Delegate mTileGroupDelegate; |
public SuggestionsBottomSheetContent(final ChromeActivity activity, final BottomSheet sheet, |
@@ -56,7 +56,7 @@ public SuggestionsBottomSheetContent(final ChromeActivity activity, final Bottom |
new SuggestionsNavigationDelegateImpl(activity, profile, sheet, tabModelSelector); |
mTileGroupDelegate = new TileGroupDelegateImpl( |
activity, profile, tabModelSelector, navigationDelegate, snackbarManager); |
- mSuggestionsManager = createSuggestionsDelegate(profile, navigationDelegate, sheet); |
+ mSuggestionsUiDelegate = createSuggestionsDelegate(profile, navigationDelegate, sheet); |
mView = LayoutInflater.from(activity).inflate( |
R.layout.suggestions_bottom_sheet_content, null); |
@@ -71,7 +71,7 @@ public void setTouchEnabled(boolean enabled) { |
mContextMenuManager = |
new ContextMenuManager(activity, navigationDelegate, touchEnabledDelegate); |
activity.getWindowAndroid().addContextMenuCloseListener(mContextMenuManager); |
- mSuggestionsManager.addDestructionObserver(new DestructionObserver() { |
+ mSuggestionsUiDelegate.addDestructionObserver(new DestructionObserver() { |
@Override |
public void onDestroy() { |
activity.getWindowAndroid().removeContextMenuCloseListener(mContextMenuManager); |
@@ -80,12 +80,11 @@ public void onDestroy() { |
UiConfig uiConfig = new UiConfig(mRecyclerView); |
- final NewTabPageAdapter adapter = new NewTabPageAdapter(mSuggestionsManager, |
+ final NewTabPageAdapter adapter = new NewTabPageAdapter(mSuggestionsUiDelegate, |
/* aboveTheFoldView = */ null, uiConfig, OfflinePageBridge.getForProfile(profile), |
mContextMenuManager, mTileGroupDelegate); |
mRecyclerView.init(uiConfig, mContextMenuManager, adapter); |
- final SuggestionsSource suggestionsSource = mSuggestionsManager.getSuggestionsSource(); |
activity.getBottomSheet().addObserver(new EmptyBottomSheetObserver() { |
@Override |
public void onSheetOpened() { |
@@ -94,11 +93,11 @@ public void onSheetOpened() { |
// TODO(https://crbug.com/689962) Ensure this call does not discard all suggestions |
// every time the sheet is opened. |
adapter.refreshSuggestions(); |
- suggestionsSource.onNtpInitialized(); |
+ mSuggestionsUiDelegate.getEventReporter().onSurfaceOpened(); |
} |
}); |
adapter.refreshSuggestions(); |
- suggestionsSource.onNtpInitialized(); |
+ mSuggestionsUiDelegate.getEventReporter().onSurfaceOpened(); |
mShadowView = (FadingShadowView) mView.findViewById(R.id.shadow); |
mShadowView.init( |
@@ -150,7 +149,7 @@ public int getVerticalScrollOffset() { |
@Override |
public void destroy() { |
- mSuggestionsManager.onDestroy(); |
+ mSuggestionsUiDelegate.onDestroy(); |
mTileGroupDelegate.destroy(); |
} |
@@ -163,15 +162,15 @@ public static void setSuggestionsSourceForTesting(SuggestionsSource suggestionsS |
sSuggestionsSourceForTesting = suggestionsSource; |
} |
- public static void setMetricsReporterForTesting(SuggestionsMetricsReporter metricsReporter) { |
- sMetricsReporterForTesting = metricsReporter; |
+ public static void setEventReporterForTesting(SuggestionsEventReporter eventReporter) { |
+ sEventReporterForTesting = eventReporter; |
} |
private static SuggestionsUiDelegateImpl createSuggestionsDelegate(Profile profile, |
SuggestionsNavigationDelegate navigationDelegate, NativePageHost host) { |
SnippetsBridge snippetsBridge = null; |
SuggestionsSource suggestionsSource; |
- SuggestionsMetricsReporter metricsReporter; |
+ SuggestionsEventReporter eventReporter; |
if (sSuggestionsSourceForTesting == null) { |
snippetsBridge = new SnippetsBridge(profile); |
@@ -180,15 +179,14 @@ private static SuggestionsUiDelegateImpl createSuggestionsDelegate(Profile profi |
suggestionsSource = sSuggestionsSourceForTesting; |
} |
- if (sMetricsReporterForTesting == null) { |
- if (snippetsBridge == null) snippetsBridge = new SnippetsBridge(profile); |
- metricsReporter = snippetsBridge; |
+ if (sEventReporterForTesting == null) { |
+ eventReporter = new SuggestionsEventReporterBridge(); |
} else { |
- metricsReporter = sMetricsReporterForTesting; |
+ eventReporter = sEventReporterForTesting; |
} |
SuggestionsUiDelegateImpl delegate = new SuggestionsUiDelegateImpl( |
- suggestionsSource, metricsReporter, navigationDelegate, profile, host); |
+ suggestionsSource, eventReporter, navigationDelegate, profile, host); |
if (snippetsBridge != null) delegate.addDestructionObserver(snippetsBridge); |
return delegate; |