Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3832)

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/suggestions/SuggestionsBottomSheetContent.java

Issue 2846233003: 📰 Record user actions on the NTP and Home sheet (Closed)
Patch Set: rebase and address comments Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 9fd7a66cd553682937ae7d8fcb75cb6fea6ab811..7640b438f4289e71c0cb2e6c0b57c96cc1c76160 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
@@ -35,9 +35,6 @@
/**
* Provides content to be displayed inside of the Home tab of bottom sheet.
- *
- * TODO(dgn): If the bottom sheet view is not recreated across tab changes, it will have to be
- * notified of it, at least when it is pulled up on the new tab.
*/
public class SuggestionsBottomSheetContent implements BottomSheet.BottomSheetContent {
private static SuggestionsSource sSuggestionsSourceForTesting;
@@ -93,16 +90,25 @@ public void onDestroy() {
public void onSheetOpened() {
mRecyclerView.scrollToPosition(0);
- // TODO(https://crbug.com/689962) Ensure this call does not discard all suggestions
- // every time the sheet is opened.
adapter.refreshSuggestions();
mSuggestionsUiDelegate.getEventReporter().onSurfaceOpened();
+ SuggestionsMetrics.recordSurfaceVisible();
}
+
+ @Override
+ public void onSheetClosed() {
+ SuggestionsMetrics.recordSurfaceHidden();
+ }
+
};
mBottomSheet = activity.getBottomSheet();
mBottomSheet.addObserver(mBottomSheetObserver);
- adapter.refreshSuggestions();
- mSuggestionsUiDelegate.getEventReporter().onSurfaceOpened();
+
+ if (mBottomSheet.isSheetOpen()) {
Bernhard Bauer 2017/05/08 13:55:55 Oh, so it can happen that we initialize the sheet
+ adapter.refreshSuggestions();
+ mSuggestionsUiDelegate.getEventReporter().onSurfaceOpened();
+ SuggestionsMetrics.recordSurfaceVisible();
+ }
mShadowView = (FadingShadowView) mView.findViewById(R.id.shadow);
mShadowView.init(

Powered by Google App Engine
This is Rietveld 408576698