| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 package org.chromium.chrome.browser.suggestions; | 5 package org.chromium.chrome.browser.suggestions; |
| 6 | 6 |
| 7 import android.annotation.SuppressLint; | 7 import android.annotation.SuppressLint; |
| 8 import android.support.v7.widget.RecyclerView; | 8 import android.support.v7.widget.RecyclerView; |
| 9 import android.support.v7.widget.RecyclerView.OnScrollListener; | 9 import android.support.v7.widget.RecyclerView.OnScrollListener; |
| 10 import android.view.LayoutInflater; | 10 import android.view.LayoutInflater; |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 mRecyclerView.init(uiConfig, mContextMenuManager, adapter); | 92 mRecyclerView.init(uiConfig, mContextMenuManager, adapter); |
| 93 | 93 |
| 94 mBottomSheetObserver = new SuggestionsSheetVisibilityChangeObserver(this
, activity) { | 94 mBottomSheetObserver = new SuggestionsSheetVisibilityChangeObserver(this
, activity) { |
| 95 @Override | 95 @Override |
| 96 public void onSheetOpened() { | 96 public void onSheetOpened() { |
| 97 mRecyclerView.scrollToPosition(0); | 97 mRecyclerView.scrollToPosition(0); |
| 98 adapter.refreshSuggestions(); | 98 adapter.refreshSuggestions(); |
| 99 mSuggestionsUiDelegate.getEventReporter().onSurfaceOpened(); | 99 mSuggestionsUiDelegate.getEventReporter().onSurfaceOpened(); |
| 100 mRecyclerView.getScrollEventReporter().reset(); | 100 mRecyclerView.getScrollEventReporter().reset(); |
| 101 | 101 |
| 102 if (ChromeFeatureList.isEnabled( | 102 if (ChromeFeatureList.isEnabled(ChromeFeatureList.CONTEXTUAL_SUG
GESTIONS_CAROUSEL) |
| 103 ChromeFeatureList.CONTEXTUAL_SUGGESTIONS_CAROUSEL) | |
| 104 && sheet.getActiveTab() != null) { | 103 && sheet.getActiveTab() != null) { |
| 105 updateContextualSuggestions(sheet.getActiveTab().getUrl()); | 104 updateContextualSuggestions(sheet.getActiveTab().getUrl()); |
| 106 } | 105 } |
| 107 | 106 |
| 108 super.onSheetOpened(); | 107 super.onSheetOpened(); |
| 109 } | 108 } |
| 110 | 109 |
| 111 @Override | 110 @Override |
| 112 public void onContentShown() { | 111 public void onContentShown() { |
| 113 SuggestionsMetrics.recordSurfaceVisible(); | 112 SuggestionsMetrics.recordSurfaceVisible(); |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 eventReporter = sEventReporterForTesting; | 232 eventReporter = sEventReporterForTesting; |
| 234 } | 233 } |
| 235 | 234 |
| 236 SuggestionsUiDelegateImpl delegate = new SuggestionsUiDelegateImpl( | 235 SuggestionsUiDelegateImpl delegate = new SuggestionsUiDelegateImpl( |
| 237 suggestionsSource, eventReporter, navigationDelegate, profile, h
ost, referencePool); | 236 suggestionsSource, eventReporter, navigationDelegate, profile, h
ost, referencePool); |
| 238 if (snippetsBridge != null) delegate.addDestructionObserver(snippetsBrid
ge); | 237 if (snippetsBridge != null) delegate.addDestructionObserver(snippetsBrid
ge); |
| 239 | 238 |
| 240 return delegate; | 239 return delegate; |
| 241 } | 240 } |
| 242 } | 241 } |
| OLD | NEW |