Chromium Code Reviews| 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( |